[R] AOV in MASS not the same??

Liaw, Andy andy_liaw at merck.com
Tue Aug 6 22:26:10 CEST 2002

> From: Peter Ho [mailto:peter at esb.ucp.pt]
> I would appreciate it if someone could explain the results of the 
> example from the aov() help file. The output given below is different 
> from book
> Venables and Ripley -  MASS

> The output for the ANOVA table is exactly the same as in Venables and 
> Ripley MASS page 177, but the values of the coefficients are 
> different. 

I believe this is in the FAQ.  By default Splus uses the Helmert contrasts
for factors.  R uses the "treatment contrasts", which are the differences
between the 1st and all other levels of the factor (most likely easier to
interpret than the Helmert contrast).  I guess that's the reason the
coefficients in R are labelled "block2" through "block6".

> I also have a more general question in relation to the coefficient 
> terms. Why are there more than one coefficint for the 
> blocking factor. I 
> want to construct a normal probability plot of effects and since the 
> ANOVA table gives me one block term, why are are more than one 
> coefficient term for blocks. Is there another way to extract the 
> regression coefficients? I don't understand why there are 
> more than one 
> blocking coefficient .

Sorry to be frank--- where did you learn your linear model / ANOVA?  For a
factor with k levels, there are k-1 contrasts, and thus k-1 coefficients.
The entry in the ANOVA table encompasses all these coefficients.  (Notice
there are 6 blocks, so 5 df for the block term in the ANOVA table, and 5
coefficients for block).
> Also in this analysis the block coefficients are from block2 
> to block 6, 
> whereas we have block1 to block5 in MASS.

See above.
> Another point is that at the end of the ANOVA (summary) table  the 
> warning "Estimated effects may be unbalanced" (aslo different 
> from the 
> book) . In this case, should aov() be used or should I refit 
> the model 
> with , say lme() ?

MASS, up to the 3rd edition, is totally based on Splus, and R is *not*
Splus.  You should not expect the output to be identical to that degree.
That's almost like asking all vendors of C compilers to use exactly the same
set of error messages!

I'd suggest you get more familiar with aov (and linear model formulations)
before you wet your feet with lme, or risk being drown.

> Thanks
> Peter


Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list