Pregunta

When using the aov() function in R, I do not get an F statistic or p-values. (I looked at this question, but I am using a one-way design, so the answer does not apply).

The independent variable is "teacher" and the dependent variable is "score." I have copied my code below with a random sample of cases from the data.

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)

The results look like:

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

So my questions are: Why am I not getting an F statistic/p-value? How do I get these values?

¿Fue útil?

Solución

The p values are in the summary. If you try:

summary(aov(score~teacher, data = mydata))

You'll get:

            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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top