How can I get aov to show me the F-statistic and p-value?

南笙酒味 提交于 2019-12-24 07:04:06

问题


The following script

#!/usr/bin/Rscript --vanilla
x <- c(4.5,6.4,7.2,6.7,8.8,7.8,9.6,7.0,5.9,6.8,5.7,5.2)
fertilizer<- factor(c('A','A','A','A','B','B','B','B','C','C','C','C'))
crop <- factor(c('I','II','III','IV','I','II','III','IV','I','II','III','IV'))
av <- aov(x~fertilizer*crop)
summary(av)

yields

                Df  Sum Sq Mean Sq
fertilizer       2 13.6800  6.8400
crop             3  2.8200  0.9400
fertilizer:crop  6  6.5800  1.0967

For other data, aov usually gives the F-statistic and associated p-value. What is wrong/special about this data that causes R to omit the juicy parts?


回答1:


Should you using + instead of * in the formula?

> summary(aov(x~fertilizer + crop))
            Df  Sum Sq Mean Sq F value  Pr(>F)  
fertilizer   2 13.6800  6.8400  6.2371 0.03426 *
crop         3  2.8200  0.9400  0.8571 0.51218  
Residuals    6  6.5800  1.0967                  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 


来源:https://stackoverflow.com/questions/2390338/how-can-i-get-aov-to-show-me-the-f-statistic-and-p-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!