0

I'm creating a linear model for an ANOVA to look for main effects and interactions. When I flip around the order of the interaction term, I get different statistical outputs (see below).

    fat <- lm(percentpre~geno*transplant, data=subset(fat3w, phase=="avg" & transp.g=="0.8"))
    anova(fat)

Response: percentpre Df Sum Sq Mean Sq F value Pr(>F)
geno 1 7.806 7.806 2.7858 0.1076
transplant 1 84.062 84.062 30.0008 1.09e-05 *** geno:transplant 1 0.084 0.084 0.0299 0.8641
Residuals 25 70.050 2.802


Signif. codes: 0 ‘*’ 0.001 ‘’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

versus


    fat <- lm(percentpre~transplant*geno, data=subset(fat3w, phase=="avg" & transp.g=="0.8"))
    anova(fat)

Response: percentpre Df Sum Sq Mean Sq F value Pr(>F)
transplant 1 90.420 90.420 32.2699 6.481e-06 *** geno 1 1.448 1.448 0.5167 0.4789
transplant:geno 1 0.084 0.084 0.0299 0.8641
Residuals 25 70.050 2.802


Signif. codes: 0 ‘*’ 0.001 ‘’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

It doesn't make a difference significance-wise, but I'm worried about the main effects which do (particularly the geno effect) which seems to change quite a bit. Any explanations as to why this might be?

User1865345
  • 8,202
Megan
  • 1

1 Answers1

0

anova(lm()) produces results for Type I sums of squares. For unbalanced designs, the order of the terms in the model will matter.

Instead, you may want to use the following, which will give you Type II sums of squares.

library(car)

Anova(fat)

Sal Mangiafico
  • 11,330
  • 2
  • 15
  • 35