Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

test_assumptions

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

Author(s)

Mattan S. Ben-Shachar and Henrik Singmann

Examples

### 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

## End(Not run)

### Mauchly Test of Sphericity
## Not run: 
## fails for between-subjects only models:
test_sphericity(between_1)
test_sphericity(between_2)

## End(Not run)
test_sphericity(mixed)
test_sphericity(within)

afex

Analysis of Factorial Experiments

v0.28-1
GPL (>= 2)
Authors
Henrik Singmann [aut, cre] (<https://orcid.org/0000-0002-4842-3657>), Ben Bolker [aut], Jake Westfall [aut], Frederik Aust [aut] (<https://orcid.org/0000-0003-4900-788X>), Mattan S. Ben-Shachar [aut], Søren Højsgaard [ctb], John Fox [ctb], Michael A. Lawrence [ctb], Ulf Mertens [ctb], Jonathon Love [ctb], Russell Lenth [ctb], Rune Haubo Bojesen Christensen [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.