[R] Need help understanding output from aov and from anova
Suman Sundaresh
sumansun at gmail.com
Thu Jun 4 00:54:46 CEST 2009
Hi all,
I noticed something strange when I ran aov and anova.
vtot=c(7.29917, 7.29917, 7.29917) #identical values
fac=as.factor(c(1,1,2)) #group 1 has first two elements, group 2 has
the 3rd element
When I run:
> anova(lm(vtot~fac))
Analysis of Variance Table
Response: vtot
Df Sum Sq Mean Sq F value Pr(>F)
fac 1 1.6818e-30 1.6818e-30 0.3333 0.6667
Residuals 1 5.0455e-30 5.0455e-30
I get a p-value of 0.667. This seems strange to me. I would have
expected the p-value to be NaN.
Again, when I run:
> summary(aov(vtot~fac))
Df Sum Sq Mean Sq F value Pr(>F)
fac 1 1.6818e-30 1.6818e-30 0.3333 0.6667
Residuals 1 5.0455e-30 5.0455e-30
Again same p-value.
Now, if I set fac to c(1,2,2) which is essentially just switching the groups.
fac=as.factor(c(1,2,2))
And run,
> anova(lm(vtot~fac))
Analysis of Variance Table
Response: vtot
Df Sum Sq Mean Sq F value Pr(>F)
fac 1 6.7274e-30 6.7274e-30 1.3340e+32 < 2.2e-16 ***
Residuals 1 5.043e-62 5.043e-62
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
The p-value is really significant which again looks very strange.
Please could someone shed some light on what I may be missing here?
Thanks very much.
Suman.
More information about the R-help
mailing list