R中的aov:没有显示F统计量

时间:2014-04-29 21:14:11

标签: r anova

在R中使用aov()函数时,我没有得到F统计量或p值。 (我看了t his question,但我使用的是单向设计,所以答案不适用。)

自变量是"老师"因变量是"得分。"我已经从下面复制了我的代码,并随机抽取了数据。

teacher <- c("B","C", "B", "A", "A", "B", "A", "D", "B", "C",
             "D", "C", "B", "C", "C", "B", "C", "B", "B", "D", "A", "A", "C", "A", "D")

score <- c(10,13,13,7,7,4,7,10,3,13,11,17,14,11,13,8,15,13,8,9,8,12,10,5,11)

mydata <- data.frame(teacher,score)

aov(score~teacher, data = mydata)

结果如下:

Call:
   aov(formula = score ~ teacher, data = mydata)

Terms:
                 teacher Residuals
Sum of Squares  108.0245  183.8155
Deg. of Freedom        3        21

Residual standard error: 2.958567
Estimated effects may be unbalanced

所以我的问题是:为什么我没有获得F统计/ p值?我如何获得这些值?

1 个答案:

答案 0 :(得分:4)

p值在摘要中。如果您尝试:

  

摘要(aov(得分〜老师,数据= mydata))

你会得到:

            Df Sum Sq Mean Sq F value Pr(>F)  
teacher      3  108.0   36.01   4.114 0.0192 *
Residuals   21  183.8    8.75                 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1