welchADF.test {welchADF} | R Documentation |
General Approximate Degrees of Freedom Solution for Inference and Estimation
Description
Computes the Welch-James statistic with Approximate Degrees of Freedom, based on the SAS code by H.J. Keselman, R.R. Wilcox and L.M. Lix.
Usage
welchADF.test(formula, ...)
## S3 method for class 'formula'
welchADF.test(formula, data, subset, ...)
## S3 method for class 'lm'
welchADF.test(formula, ...)
## S3 method for class 'aov'
welchADF.test(formula, ...)
## S3 method for class 'lmer'
welchADF.test(formula, ...)
## Default S3 method:
welchADF.test(formula, response, between.s = NULL,
within.s = NULL, subject = NULL, contrast = c("omnibus",
"all.pairwise"), effect = NULL, correction = c("hochberg", "holm"),
trimming = FALSE, per = 0.2, bootstrap = FALSE, numsim_b = 999,
effect.size = FALSE, numsim_es = 999, scaling = TRUE,
standardize.effsz = TRUE, alpha = 0.05, seed = 0, ...)
Arguments
formula |
A data frame or a formula or an lm object returned by |
... |
Further arguments to be passed to specialized methods. Should be named arguments. |
data |
A data.frame with the data, formatted as follows: one row per observation of the response variable(s), and as many columns as needed to indicate the factor combination to which the observation corresponds. If necessary, an extra column with the subject ID for designs having within-subjects factors (can be omitted if there is only one within-subjects factor, see the vignette). |
subset |
A specification of the rows to be used as in |
response |
A string or vector of strings with the name(s) of the column(s) of |
between.s |
Vector of strings with the columns that correspond to between-subjects factors, if any (defaults to NULL). |
within.s |
Vector of strings with the columns that correspond to within-subjects factors, if any (defaults to NULL). |
subject |
Name of the column (if any) containing the subject ID (defaults to NULL). |
contrast |
One of |
effect |
If |
correction |
The type of p-value correction when applying multiple pariwise comparisons (i.e. when |
trimming |
Boolean to control the use of robust estimators.
|
per |
(Only if trimming is TRUE) The proportion of trimming in EACH tail of the data distribution. Must be between 0 and .49 (i.e., 49% trimming in each tail). Recommended per = 0.2 symmetric trimming (i.e., 20% of the observations in each tail are trimmed). |
bootstrap |
Boolean; whether bootstrap should be used to compute a critical value for the test statistic produced by WJGLM. |
numsim_b |
If |
effect.size |
Boolean; whether effect size estimates should be computed. |
numsim_es |
Positive integer defining the number of bootstrap samples to generate a CI for the effect size estimate (defaults to 999). Ignored if |
scaling |
Boolean; whether a scaling factor for the effect size estimator should be used (0.642 for 20% symmetric trimming) when
robust estimators are adopted. |
standardize.effsz |
Boolean: whether the effect size should be standardized by the average of variances or not. Defaults to TRUE. |
alpha |
Significance threshold for the confidence interval calculation, where 1 - |
seed |
Initial seed (positive integer) for the (R default) random number generator. Defaults to NULL (seed taken from the current time). |
Value
An object of class "welchADFt" which is a list of lists (one sub-list per effect, even if there is only one).
There are methods print.welchADFt
and summary.welchADFt
Methods (by class)
-
formula
: Specialized method that accepts a formula -
lm
: Specialized method that accepts a linear model object of classlm
-
aov
: Specialized method that accepts an Analysis of Variance Model of classaov
-
lmer
: Specialized method that accepts a Linear Mixed-Effects Model of classlmer
-
default
: Default method that accepts a data.frame (see argumentformula
) and where factors are passed as strings corresponding to column names
References
Villacorta, P.J. (2017). The welchADF Package for Robust Hypothesis Testing in Unbalanced Multivariate Mixed Models with Heteroscedastic and Non-normal Data. The R Journal, 9:2, 309 - 328.
Website with the original SAS code and examples: http://supp.apa.org/psycarticles/supplemental/met_13_2_110/met_13_2_110_supp.html
Keselman, H. J., Wilcox, R. R., & Lix, L. M. (2003). A generally robust approach to hypothesis testing in independent and correlated groups designs. Psychophysiology, 40, 586-596.
Lix, L. M., & Keselman, H. J. (1995). Approximate degrees of freedom tests: A unified perspective on testing for mean equality. Psychological Bulletin, 117, 547-560.
Carpenter, J., & Bithell, J. (2000). Bootstrap confidence intervals: When, which, what? A practical guide for medical statisticians. Statistics in Medicine, 19, 1141-1164.
Efron, B., & Tibshirani, R. (1986). Bootstrap methods for standard errors, confidence intervals, and other measures of statistical accuracy. Statistical Science, 1, 54-75.
See Also
print.welchADFt
, summary.welchADFt
p.adjust.methods
perceptionData
adhdData
adhdData2
womenStereotypeData
miceData
Examples
# Omnibus contrast only of those effects included, namely condition and sex (no interaction)
omnibus_LSM_formula <- welchADF.test(y ~ condition + sex, data = womenStereotypeData)
# Works well with update.default() method
omnibus_interact_formula <- update(omnibus_LSM_formula, . ~ condition*sex)
summary(omnibus_LSM_formula)
summary(omnibus_interact_formula)
# Fit a linear model using the built-in function stats::lm
lm.women <- lm(y ~ condition + sex, womenStereotypeData)
# Fit an Analysis of Variance model using the built-in function stats::aov
aov.women <- aov(lm.women)
# Now use the this object to apply a welchADF test to the same formula and data
omnibus_no_interact <- welchADF.test(lm.women, contrast = "omnibus")
omnibus_no_interactB <- welchADF.test(aov.women) # omnibus as well
# Integrates well with the update.default() method
omnibus_interact <- update(omnibus_no_interact, . ~ condition*sex)
summary(omnibus_no_interact)
summary(omnibus_interact)
# Two-way factorial design using the default interface. See the vignette.
omnibus_LSM <- welchADF.test(womenStereotypeData, response = "y", between.s =
c("condition", "sex"), contrast = "omnibus")
# Method update() also works with the welchADF.test.default interface
omnibus_trimmed <- update(omnibus_LSM, effect = "condition", trimming = TRUE)
pairwise_LSM <- update(omnibus_LSM, contrast = "all.pairwise", effect = c("condition", "sex"))
pairwise_trimmed <- update(pairwise_LSM, trimming = TRUE) # just trimming
summary(omnibus_LSM)
pairwise_LSM
## Not run:
pairwise_trimmed_boot <- update(pairwise_trimmed, bootstrap = TRUE) # trimming and bootstrapping
summary(pairwise_trimmed_boot)
## End(Not run)