Skip to content
Prev 2496 / 7420 Next

aov vs. glm

On Thu, 2011-11-10 at 18:22 -0500, Lara R. Appleby 04 wrote:
I don't believe you; care to provide supporting evidence?

Here is a counter example that shows that these are

## From Venables and Ripley (2002) p.165.
data(npk, package="MASS")
     
## Set orthogonal contrasts.
op <- options(contrasts=c("contr.helmert", "contr.poly"))

npk.glm <- glm(yield ~ block + N*P*K, data = npk)
npk.aov <- aov(yield ~ block + N*P*K, data = npk)
npk.lm  <- lm(yield ~ block + N*P*K, data = npk)
anova(npk.glm, test = "F")
anova(npk.lm)
summary(npk.aov)
options(op)

All three give the same results:
Analysis of Deviance Table

Model: gaussian, link: identity

Response: yield

Terms added sequentially (first to last)


      Df Deviance Resid. Df Resid. Dev       F   Pr(>F)   
NULL                     23     876.37                    
block  5   343.30        18     533.07  4.4467 0.015939 * 
N      1   189.28        17     343.79 12.2587 0.004372 **
P      1     8.40        16     335.39  0.5441 0.474904   
K      1    95.20        15     240.19  6.1657 0.028795 * 
N:P    1    21.28        14     218.90  1.3783 0.263165   
N:K    1    33.14        13     185.77  2.1460 0.168648   
P:K    1     0.48        12     185.29  0.0312 0.862752   
N:P:K  0     0.00        12     185.29                    
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
Analysis of Variance Table

Response: yield
          Df Sum Sq Mean Sq F value   Pr(>F)   
block      5 343.29  68.659  4.4467 0.015939 * 
N          1 189.28 189.282 12.2587 0.004372 **
P          1   8.40   8.402  0.5441 0.474904   
K          1  95.20  95.202  6.1657 0.028795 * 
N:P        1  21.28  21.282  1.3783 0.263165   
N:K        1  33.14  33.135  2.1460 0.168648   
P:K        1   0.48   0.482  0.0312 0.862752   
Residuals 12 185.29  15.441                    
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
Df Sum Sq Mean Sq F value   Pr(>F)   
block        5 343.29  68.659  4.4467 0.015939 * 
N            1 189.28 189.282 12.2587 0.004372 **
P            1   8.40   8.402  0.5441 0.474904   
K            1  95.20  95.202  6.1657 0.028795 * 
N:P          1  21.28  21.282  1.3783 0.263165   
N:K          1  33.14  33.135  2.1460 0.168648   
P:K          1   0.48   0.482  0.0312 0.862752   
Residuals   12 185.29  15.441                    
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 

HTH

G