runehaubo / lmerTestR

Repository for the R-package lmerTest
49 stars 9 forks source link

differences in denominator DF for type II/III anova #43

Open ntardiff opened 3 years ago

ntardiff commented 3 years ago

Hello,

I ran an ANOVA using Satterthwaite df on the same model using both type II and type III sums of squares. The model contains no interactions and all factors are effect coded (contr.sum), and so if run w/ vanilla lm type II and III SS give the same results (using car::Anova).

I find that using lmerTest (version 3.1-2), the results are also the same EXCEPT in the case of a multiple-df test on a factor w/ 3 levels (congruent.f).

anova(choice_lm.test,type="II")
Type II Analysis of Variance Table with Satterthwaite's method
             Sum Sq Mean Sq NumDF  DenDF  F value    Pr(>F)    
congruent.f 15.3285  7.6643     2 52.468  51.1370 4.759e-13 ***
isH.f        0.0666  0.0666     1 39.174   0.4445 0.5088568    
zaSNR        2.5808  2.5808     1 44.202  17.2194 0.0001492 ***
blz         22.1505 22.1505     1 42.820 147.7910 1.785e-15 ***
posX         0.1401  0.1401     1 34.631   0.9345 0.3404018    
posY         2.0839  2.0839     1 38.255  13.9038 0.0006217 ***

anova(choice_lm.test,type="III")
Type III Analysis of Variance Table with Satterthwaite's method
             Sum Sq Mean Sq NumDF  DenDF  F value    Pr(>F)    
congruent.f 15.3285  7.6643     2 57.663  51.1370 1.683e-13 ***
isH.f        0.0666  0.0666     1 39.174   0.4445 0.5088568    
zaSNR        2.5808  2.5808     1 44.202  17.2194 0.0001492 ***
blz         22.1505 22.1505     1 42.820 147.7910 1.785e-15 ***
posX         0.1401  0.1401     1 34.631   0.9345 0.3404018    
posY         2.0839  2.0839     1 38.255  13.9038 0.0006217 ***

In this case, the denominator DF differs between the two approaches, but all values are the same for all other parameters, including the single-df factor isH.f. Can you explain why this would be the case?

Thanks, Nathan