I want to conduct a (10) x (2) repeated measures ANOVA but can't seem to produce the results for Mauchly's test of sphericity in my output. I have tried using both the anova_test
function from the rstatix package and the ezANOVA
function from the ez package, but neither produce results from Mauchly's sphericity test. For context, my data looks like this:
subject session reward_size during_cs_rate
<fct> <fct> <fct> <dbl>
1 M3 1 Small Reward 0.056
2 M3 1 Large Reward 0.056
3 M3 2 Small Reward 0.024
4 M3 2 Large Reward 0.088
5 M3 3 Small Reward 0.16
6 M3 3 Large Reward 0.232
7 M3 4 Small Reward 0.016
8 M3 4 Large Reward 0.04
9 M3 5 Small Reward 0.016
10 M3 5 Large Reward 0.032
# … with 150 more rows
I have 8 subjects and two within-subjects factors: session (10 levels) and reward size (2 levels). A factorial repeated measured ANOVA should produce Mauchly's test of sphericity for the session factor. Yet, this is what I get:
> cr_aov <- anova_test(data = pav_master,
dv = during_cs_rate,
wid = subject,
within = c(session, reward_size),
effect.size = "pes")
> get_anova_table(cr_aov)
ANOVA Table (type III tests)
Effect DFn DFd F p p<.05 pes
1 session 9 63 6.793 9.48e-07 * 0.492
2 reward_size 1 7 0.615 4.59e-01 0.081
3 session:reward_size 9 63 2.622 1.20e-02 * 0.272
I get the exact same results with the ezANOVA
function. I have found that if I slice my data so that I cut the first factor to just 8 levels (same as my sample size), the ANOVA finally produces the results for Mauchly's test.
> test_data <- pav_master %>%
arrange(session) %>%
slice(1:128)
> anova_test(data = test_data,
dv = during_cs,
wid = subject,
within = c(session, reward_size))
> test_aov
ANOVA Table (type III tests)
$ANOVA
Effect DFn DFd F p p<.05 ges
1 session 7 49 5.073 0.000221 * 2.21e-01
2 reward_size 1 7 0.002 0.964000 1.57e-05
3 session:reward_size 7 49 1.927 0.085000 4.70e-02
$`Mauchly's Test for Sphericity`
Effect W p p<.05
1 session 5.00e-03 0.815
2 session:reward_size 5.65e-05 0.066
$`Sphericity Corrections`
Effect GGe DF[GG] p[GG] p[GG]<.05 HFe DF[HF] p[HF] p[HF]<.05
1 session 0.512 3.58, 25.08 0.005 * 1.114 7.8, 54.61 0.000221 *
2 session:reward_size 0.435 3.04, 21.31 0.155 0.807 5.65, 39.57 0.104000
Does this mean I need my sample size to be larger or equal to the number of levels for my within-subjects factors? Is there some way I can force R to run the Mauchly test and show me the results without changing my sample size?