Get startedGet started for free

Mauchly's test

To check the sphericity assumption, you can perform Mauchly's test. Coding Mauchly's test in R yourself is beyond the scope of this introductory statistics course, so the necessary code is provided for you.

To do the test, you'll make use of a function called mauchly.test(). The first argument has to be an object of class SSD or mlm.

For the working memory example, you first need to define an object of class SSD or mlm. In order to do this, you first define a variable iq with columns containing the values for each condition, then make an mlm object using iq and the lm() function. Finally, you provide mlm as an input to the mauchly.test().

If Mauchly's test yields a significant result, then the sphericity assumption is violated. In this case, the two most popular adjustments are Greenhouse-Geisser and Huyn-Feldt.

This exercise is part of the course

Intro to Statistics with R: Repeated measures ANOVA

View Course

Exercise instructions

The code is already provided. Just submit it and interpret the results.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define the iq data frame
iq <- cbind(wm$iq[wm$condition == "8 days"],
            wm$iq[wm$condition == "12 days"],
            wm$iq[wm$condition == "17 days"],
            wm$iq[wm$condition == "19 days"])

# Make an mlm object
mlm <- lm(iq ~ 1)

# Mauchly's test
mauchly.test(mlm, x = ~ 1)
Edit and Run Code