[R] Noobie ANOVA intercept question

John Fox jfox at mcmaster.ca
Wed Apr 1 21:23:47 CEST 2009


Dear Allen,

On Wed, 1 Apr 2009 10:44:33 -0700 (PDT)
 AllenL <allen.larocque at gmail.com> wrote:
> 
> Dear R list,
> I've been attempting to interpret the results from a three-way ANOVA.
> I
> think I understand contrasts and the R defaults for these (treatment
> contrasts). My question is: what is the intercept in this test? As
> far as I
> can tell, its NOT the expected value of a point that belongs to the
> first
> level of all three explanatory factors (because there is only one
> point that
> satisfies these requirements and their values differ). Its not the
> grand
> mean, or any of the treatment means. What is this thing?

Actually, the intercept IS the estimated expected value of an
observation that belongs to the first level of all three factors, but
conditional on the model that you've fit, which is an additive model.
Had you fit a model with all interactions, SQBLOOMS ~ BED*WATER*SHADE,
then the intercept would have been the mean (i.e., single observation)
in this cell.

BTW, more than half the data were deleted due to NAs.
 
> 
> (Note: this dataset is from an example I'm working through in Grafen
> & Hails
> 2002 text)
> 
> Q2: Just noticed that in pasting I lose mono-spaced formatting. Is it
> possible to post to the list such that format is maintained?

This is a function of your mail client, not R. The r-help list sends
out plain-text email, so the monospaced font was restored.

I hope this helps,
 John

> 
> Thanks in advance!
> 
> 
> 
> Relevant output:
> 
> 
> > anova(mod1)
> Analysis of Variance Table
> 
> Response: SQBLOOMS
>           Df Sum Sq Mean Sq F value    Pr(>F)    
> BED        2 4.1323  2.0661  9.4570 0.0007277 ***
> WATER      2 3.7153  1.8577  8.5029 0.0013016 ** 
> SHADE      3 1.6465  0.5488  2.5120 0.0789451 .  
> Residuals 28 6.1173  0.2185                      
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> > summary(mod1)
> 
> Call:
> lm(formula = SQBLOOMS ~ BED + WATER + SHADE)
> 
> Residuals:
>      Min       1Q   Median       3Q      Max 
> -1.23992 -0.18979 -0.01840  0.17471  0.74686 
> 
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)    
> (Intercept)   3.7765     0.2203  17.139 2.23e-16 ***
> BED2          0.3185     0.1908   1.669 0.106242    
> BED3         -0.5044     0.1908  -2.643 0.013293 *  
> WATER2        0.7842     0.1908   4.109 0.000313 ***
> WATER3        0.4489     0.1908   2.353 0.025905 *  
> SHADE2        0.1969     0.2203   0.894 0.379172    
> SHADE3       -0.2157     0.2203  -0.979 0.336068    
> SHADE4       -0.3673     0.2203  -1.667 0.106641    
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> 
> Residual standard error: 0.4674 on 28 degrees of freedom
>   (51 observations deleted due to missingness)
> Multiple R-squared: 0.6081,     Adjusted R-squared: 0.5102 
> F-statistic: 6.208 on 7 and 28 DF,  p-value: 0.0001911 
> 
> > model.frame(mod1)
>    SQBLOOMS BED WATER SHADE
> 1     4.359   1     1     1
> 2     3.317   1     1     2
> 3     3.606   1     1     3
> 4     4.123   1     1     4
> 5     4.472   1     2     1
> 6     4.583   1     2     2
> 7     4.359   1     2     3
> 8     4.690   1     2     4
> 9     4.123   1     3     1
> 10    4.123   1     3     2
> 11    3.464   1     3     3
> 12    3.873   1     3     4
> 13    3.606   2     1     1
> 14    4.000   2     1     2
> 15    3.464   2     1     3
> 16    3.873   2     1     4
> 17    4.690   2     2     1
> 18    5.000   2     2     2
> 19    5.385   2     2     3
> 20    4.583   2     2     4
> 21    4.690   2     3     1
> 22    4.690   2     3     2
> 23    4.690   2     3     3
> 24    4.243   2     3     4
> 25    3.317   3     1     1
> 26    3.606   3     1     2
> 27    3.317   3     1     3
> 28    2.828   3     1     4
> 29    3.873   3     2     1
> 30    5.000   3     2     2
> 31    3.742   3     2     3
> 32    2.449   3     2     4
> 33    4.000   3     3     1
> 34    4.583   3     3     2
> 35    3.162   3     3     3
> 36    3.162   3     3     4
> 
> 
> > model.tables(mod1,"means",se=TRUE)
> Tables of means
> Grand mean
>          
> 4.029028 
> 
>  BED 
> BED
>     1     2     3 
> 4.091 4.409 3.587 
> 
>  WATER 
> WATER
>     1     2     3 
> 3.618 4.402 4.067 
> 
>  SHADE 
> SHADE
>     1     2     3     4 
> 4.126 4.322 3.910 3.758 
> 
> Standard errors for differences of means
>            BED  WATER  SHADE
>         0.1908 0.1908 0.2203
> replic.     12     12      9
> 
>  
> 
> 
> Design matrix:
> > model.matrix(mod1)
>    (Intercept) BED2 BED3 WATER2 WATER3 SHADE2 SHADE3 SHADE4
> 1            1    0    0      0      0      0      0      0
> 2            1    0    0      0      0      1      0      0
> 3            1    0    0      0      0      0      1      0
> 4            1    0    0      0      0      0      0      1
> 5            1    0    0      1      0      0      0      0
> 6            1    0    0      1      0      1      0      0
> 7            1    0    0      1      0      0      1      0
> 8            1    0    0      1      0      0      0      1
> 9            1    0    0      0      1      0      0      0
> 10           1    0    0      0      1      1      0      0
> 11           1    0    0      0      1      0      1      0
> 12           1    0    0      0      1      0      0      1
> 13           1    1    0      0      0      0      0      0
> 14           1    1    0      0      0      1      0      0
> 15           1    1    0      0      0      0      1      0
> 16           1    1    0      0      0      0      0      1
> 17           1    1    0      1      0      0      0      0
> 18           1    1    0      1      0      1      0      0
> 19           1    1    0      1      0      0      1      0
> 20           1    1    0      1      0      0      0      1
> 21           1    1    0      0      1      0      0      0
> 22           1    1    0      0      1      1      0      0
> 23           1    1    0      0      1      0      1      0
> 24           1    1    0      0      1      0      0      1
> 25           1    0    1      0      0      0      0      0
> 26           1    0    1      0      0      1      0      0
> 27           1    0    1      0      0      0      1      0
> 28           1    0    1      0      0      0      0      1
> 29           1    0    1      1      0      0      0      0
> 30           1    0    1      1      0      1      0      0
> 31           1    0    1      1      0      0      1      0
> 32           1    0    1      1      0      0      0      1
> 33           1    0    1      0      1      0      0      0
> 34           1    0    1      0      1      1      0      0
> 35           1    0    1      0      1      0      1      0
> 36           1    0    1      0      1      0      0      1
> 
> -- 
> View this message in context:
>
http://www.nabble.com/Noobie-ANOVA-intercept-question-tp22831838p22831838.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/




More information about the R-help mailing list