a naive question about aov() in R
1
0
Entering edit mode
tony.fox2016 ▴ 40
@tonyfox2016-9796
Last seen 8.7 years ago

Hi all,

I found that in R, when applying aov() to 3 or more groups of data, even there is only one observation in some group, aov() still works. I am not sure how it calculate the within-group variance for this group without any replicates, such as the group z in the following code:

 

x<-rnorm(mean=5,10)

y<-rnorm(mean=10,10)

z<-20

f<-factor(c(rep('x',10),rep('y',10),'z'))

summary(lm(aov(c(x,y,z)~f)))

 

The output is: 

Call:

lm(formula = aov(c(x, y, z) ~ f))

 

Residuals:

     Min       1Q   Median       3Q      Max 

-1.41996 -0.51930 -0.04419  0.41832  1.75994 

 

Coefficients:

            Estimate Std. Error t value Pr(>|t|)    

(Intercept)    4.710      0.304   15.49 7.52e-12 ***

fy             5.018      0.430   11.67 7.89e-10 ***

fz            15.290      1.008   15.16 1.07e-11 ***

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 

Residual standard error: 0.9614 on 18 degrees of freedom

Multiple R-squared:  0.9442,

Adjusted R-squared:  0.938 

F-statistic: 152.3 on 2 and 18 DF,  p-value: 5.254e-12

 

 

 

 

R • 1.2k views
ADD COMMENT
0
Entering edit mode

In the result, group z has a p-value (in the row fz). I am curious if this p-value makes any sense.

ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 3 days ago
United States

This is neither a Bioconductor nor an R question. Instead it's a basic stats question, and you would be better served by asking somewhere like stackoverflow. The degrees of freedom for an ANOVA model are based on the entire model, not the individual groups, so each group 'borrows information' from all other groups in the model when you test for significance. If you care to know more, here is a link to a basic ANOVA explanation.
 

ADD COMMENT

Login before adding your answer.

Traffic: 481 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6