Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust degrees of freedom for sphericity correction in repeated measure Anova from car package

Tags:

r

anova

r-car

I am running a repeated measures ANOVA using the car package. Which works fine and returns an output similar to this:

Univariate Type III Repeated-Measures ANOVA Assuming Sphericity

                SS num Df Error SS den Df        F    Pr(>F)    
(Intercept) 7260.0      1   603.33     15 180.4972 9.100e-10 ***
phase        167.5      2   169.17     30  14.8522 3.286e-05 ***
hour         106.3      4    73.71     60  21.6309 4.360e-11 ***
phase:hour    11.1      8   122.92    120   1.3525    0.2245    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 


Mauchly Tests for Sphericity

        Test statistic  p-value
phase             0.70470 0.086304
hour              0.11516 0.000718
phase:hour        0.01139 0.027376


Greenhouse-Geisser and Huynh-Feldt Corrections
for Departure from Sphericity

            GG eps Pr(>F[GG])    
phase      0.77202  0.0001891 ***
hour       0.49842  1.578e-06 ***
phase:hour 0.51297  0.2602357    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Now it shows me that in some cases a correction for Sphericity has to be applied. As I understand it this correction does not only affect p-values but also degrees of freedom (df). Output however does not show this. So how can I display the adjusted df?

like image 523
JereB Avatar asked Nov 10 '22 04:11

JereB


1 Answers

Maybe you've already sorted this out, but to correct the degrees of freedom in cases of Greenhouse-Geisser or Huynh-Feldt corrections, you simply multiply each degree of freedom by the corresponding epsilon value. Here is an example based on your result:

# degrees of freedom for phase:hour
num_Df <- 8
den_Df <- 120

# Greenhouse-Geisser epsilon
gg_e <- 0.51297

# adjusted degrees of freedom
num_Df_adj <- gg_e * num_Df 
den_Df_adj <- gg_e * den_Df  
like image 119
xilliam Avatar answered Nov 15 '22 05:11

xilliam