[R] coefs from summary.lm of an aov object

Martin Ivanov tramni at abv.bg
Thu Feb 4 19:02:47 CET 2010


 Dear R users, 

This is probably a very stupid question, nevertheless I obviously am not qualified enough
to cope with it. I do not understand what the coefficients are that are output by running 
summary.lm on an aov object. I thought they should be the differential effects for the levels of the factor and the overall mean, but they are obviously not, as illustrated by the following simple example:

x <- c(1:15); y <- factor(c(rep("a", 5), rep("b", 10)))
> tapply(X=x, INDEX=y, FUN=mean)
   a    b 
 3.0 10.5 

> mean(x)
[1] 8

> a <- aov(x ~ y)
> summary.lm(a)$coef
            Estimate Std. Error  t value     Pr(>|t|)
(Intercept)      3.0   1.192928 2.514821 0.0258555905
yb               7.5   1.461032 5.133357 0.0001921826


> model.tables(a)
Tables of effects

 y 
     a    b
    -5  2.5
rep  5 10.0

Besides, I fit a factor with two levels, "a" and "b", but there is only the "yb" coefficient for the "b" level, no "ya" coefficient for the "a" factor level. I read a lot of materials on anova with R, but I could not find what are these coefficients. I would be grateful if someone gives me some clue. And what is the intercept term? I though it should be the overall mean, but it is obviously not. 

Regards and best wishes,

Martin Ivanov



More information about the R-help mailing list