afex (version 0.26-0)

test_levene: Assumption Tests for ANOVAs

Description

test_levene computes Levene's test for homogeneity of variances across groups via car::leveneTest. test_sphericity computes Mauchly test of sphericity via car::Anova.

Usage

test_levene(afex_aov, center = mean, ...)

test_sphericity(afex_aov)

Arguments

afex_aov

afex_aov object.

center

Function to compute the center of each group; mean (the default) gives the original Levene's test.

...

passed to leveneTest

Examples

Run this code
# NOT RUN {
### Setup ANOVAs
data(obk.long, package = "afex")
between_1 <- aov_car(value ~ treatment + Error(id), data = obk.long)
between_2 <- aov_car(value ~ treatment*gender + Error(id), data = obk.long)
mixed <- aov_car(value ~ treatment * gender + Error(id/(phase*hour)), data = obk.long)
within <- aov_car(value ~ 1 + Error(id/(phase*hour)), data = obk.long)

### Levene Test for Homogeneity of Variances
test_levene(between_1)
test_levene(between_2)
test_levene(mixed)
# }
# NOT RUN {
test_levene(within) ## fails
# }
# NOT RUN {
### Mauchly Test of Sphericity
# }
# NOT RUN {
## fails for between-subjects only models:
test_sphericity(between_1)
test_sphericity(between_2)
# }
# NOT RUN {
test_sphericity(mixed)
test_sphericity(within)

# }

Run the code above in your browser using DataCamp Workspace