| apa_anova | R Documentation |
Makes an analysis of variance source table with sums of squares, degrees of freedom, mean squares, F tests, p-values, and effect sizes. Values come from parameters::model_parameters(), and effect sizes come from the effectsize package (e.g., effectsize::eta_squared()).
apa_anova(
fit,
anova_parameters = c("Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
"Effect_Size"),
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
...
)
## S3 method for class 'lm'
apa_anova(
fit,
anova_parameters = c("Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
"Effect_Size"),
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
...
)
## S3 method for class 'aovlist'
apa_anova(
fit,
anova_parameters = c("Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
"Effect_Size"),
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
...
)
## S3 method for class 'anova'
apa_anova(
fit,
anova_parameters = c("Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
"Effect_Size"),
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
...
)
## S3 method for class 'afex_aov'
apa_anova(
fit,
anova_parameters = c("Parameter", "df", "df_error", "Mean_Square", "F", "p",
"Effect_Size"),
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = TRUE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
...
)
## S3 method for class 'merMod'
apa_anova(
fit,
anova_parameters = mixed_anova_parameters,
effect_size = NULL,
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
ddf = c("Kenward-Roger", "Satterthwaite"),
...
)
## Default S3 method:
apa_anova(fit, ...)
## S3 method for class 'mlm'
apa_anova(
fit,
anova_parameters = manova_anova_parameters,
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
test = c("Pillai", "Wilks", "Hotelling-Lawley", "Roy"),
univariate = FALSE,
...
)
## S3 method for class 'manova'
apa_anova(
fit,
anova_parameters = manova_anova_parameters,
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
test = c("Pillai", "Wilks", "Hotelling-Lawley", "Roy"),
univariate = FALSE,
...
)
## S3 method for class 'Anova.mlm'
apa_anova(
fit,
anova_parameters = manova_anova_parameters,
effect_size = c("eta", "omega", "epsilon"),
partial = TRUE,
generalized = FALSE,
type = NULL,
ci = 0.95,
residual_label = "Error",
starred = NA,
bolded = NA,
column_formats = NULL,
test = NULL,
univariate = FALSE,
...
)
fit |
an |
anova_parameters |
columns to display. |
effect_size |
effect size to display: |
partial |
if |
generalized |
if |
type |
type of sums of squares for |
ci |
confidence level for the effect size interval, shown if |
residual_label |
label for residual (error) rows |
starred |
columns to star with significant p-values (e.g., |
bolded |
columns to bold, if significant |
column_formats |
column_formats object to format columns. If NULL, the default column_formats is used. |
... |
further arguments passed to |
ddf |
for linear mixed models, method of approximating the denominator degrees of freedom: |
test |
for multivariate models, the multivariate test statistic:
|
univariate |
for multivariate models, if |
For repeated-measures models fit with aov(y ~ a * b + Error(id / b)), each error stratum is introduced by a heading row ("Between subjects" or "Within subjects"), and each stratum's error term follows its effects.
Model comparisons (e.g., anova(m1, m2)) are not ANOVA source tables. Use apa_performance_comparison() for them.
For afex models (afex::aov_car(), afex::aov_ez(), afex::aov_4()), each effect has its own error term, so the table shows each effect's degrees of freedom (df~effect~, df~error~), mean squared error (MSE), F, p, and effect size, as in afex's own nice() tables. Degrees of freedom and p-values reflect the sphericity correction set in afex (Greenhouse-Geisser by default), and generalized \eta^2 is the default effect size, as in afex.
For linear mixed models fit with lme4::lmer() or lmerTest::lmer(), F tests of the fixed effects come from the lmerTest package, which approximates the denominator degrees of freedom with Kenward-Roger's method (default, as in apa_parameters(), which requires the pbkrtest package) or Satterthwaite's method (ddf = "Satterthwaite"). Tests are Type III by default, as in lmerTest, whose Type III tests do not depend on how factors are coded. The table shows each effect's degrees of freedom (df~effect~, df~error~), F, and p. Sums of squares and effect sizes have no agreed-upon definition in mixed models, so they are not shown by default. With effect_size = "eta" (or "omega" or "epsilon"), partial effect sizes are computed from F and its degrees of freedom (e.g., effectsize::F_to_eta2()), which only approximates them. ANOVA tables made by lmerTest's anova() are displayed the same way. Generalized linear mixed models (lme4::glmer()) have no F tests; use apa_parameters() for them.
For multivariate analyses of variance, from stats::manova() or from
stats::lm() with several outcomes (lm(cbind(y1, y2) ~ x)), the table
has a row for each effect with its multivariate test statistic (Pillai's
trace by default; test chooses Wilks's lambda, the Hotelling–Lawley
trace, or Roy's largest root), its approximate F test (df~1~,
df~2~, p), and partial \eta^2, computed from the
approximate F and its degrees of freedom (e.g., effectsize::F_to_eta2()).
Sums of squares are sequential (Type I) by default, as in
stats::summary.manova(); type = 2 or 3 gives car::Anova() tests.
car::Anova() tables of such models (class Anova.mlm) are displayed the
same way. The intercept is not shown. With univariate = TRUE, the table
instead shows the univariate ANOVA of each outcome, under a heading row
for each outcome, as a follow-up to the multivariate tests.
apa7_tbl (tibble)
Greenhouse, S. W., & Geisser, S. (1959). On methods in the analysis of profile data. Psychometrika, 24(2), 95–112. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02289823")}
Huynh, H., & Feldt, L. S. (1976). Estimation of the Box correction for degrees of freedom from sample data in randomized block and split-plot designs. Journal of Educational Statistics, 1(1), 69–82. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3102/10769986001001069")}
Kenward, M. G., & Roger, J. H. (1997). Small sample inference for fixed effects from restricted maximum likelihood. Biometrics, 53(3), 983–997. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2533558")}
Olejnik, S., & Algina, J. (2003). Generalized eta and omega squared statistics: Measures of effect size for some common research designs. Psychological Methods, 8(4), 434–447. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/1082-989X.8.4.434")}
Satterthwaite, F. E. (1946). An approximate distribution of estimates of variance components. Biometrics Bulletin, 2(6), 110–114. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/3002019")}
Pillai, K. C. S. (1955). Some new test criteria in multivariate analysis. The Annals of Mathematical Statistics, 26(1), 117–121. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/aoms/1177728599")}
Wilks, S. S. (1932). Certain generalizations in the analysis of variance. Biometrika, 24(3/4), 471–494. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biomet/24.3-4.471")}
d <- mtcars
d$cyl <- factor(d$cyl)
d$am <- factor(d$am)
fit <- aov(mpg ~ cyl * am, data = d)
apa_anova(fit)
# Omega squared with a 90% confidence interval
apa_anova(
fit,
anova_parameters = c(
"Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
"Effect_Size", "CI"
),
effect_size = "omega",
ci = .90
)
# Type 2 sums of squares (requires the car package)
if (requireNamespace("car", quietly = TRUE)) {
apa_anova(fit, type = 2)
}
if (requireNamespace("afex", quietly = TRUE)) {
data(obk.long, package = "afex")
fit_afex <- afex::aov_ez(
"id", "value", obk.long,
between = "treatment", within = "phase", fun_aggregate = mean
)
apa_anova(fit_afex)
}
if (requireNamespace("lme4", quietly = TRUE) &&
requireNamespace("lmerTest", quietly = TRUE) &&
requireNamespace("pbkrtest", quietly = TRUE)) {
fit_lmer <- lme4::lmer(
Reaction ~ Days + (Days | Subject),
data = lme4::sleepstudy
)
apa_anova(fit_lmer)
}
# Multivariate analysis of variance
if (requireNamespace("carData", quietly = TRUE)) {
fit_manova <- manova(
cbind(post.test.1, post.test.2, post.test.3) ~ group,
data = carData::Baumann
)
apa_anova(fit_manova)
apa_anova(fit_manova, test = "Wilks")
# Univariate follow-ups
apa_anova(fit_manova, univariate = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.