[R] help with aov

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Mar 18 19:36:46 CET 2004


This is nothing to do with aov: if you want to look at coefficients you 
may as well use lm().  The idea of aov is to look at factors as a whole.

You do need to understand codings: looks like you want to specify 
contr.sum contrasts.  The best place to read about this is chapter 6 of 
MASS.


On Thu, 18 Mar 2004, Martin Olivier wrote:

> Hi all,
> 
> Suppose the following data and the simple model
> y<-1:12+rnorm(12)
> fac1<-c(rep("A",4),rep("B",4),rep("C",4))
> fac2<-rep(c("D","C"),6)
> dat<-data.frame(y,fac1,fac2)
> tmp<-aov(y~fac1+fac2,dat)
> 
> the command tmp$coeff gives the fllowing results :
> 
> (Intercept)       fac1B       fac1C       fac2D
> 3.307888    2.898187    7.409010   -1.088588
> 
> But mean(y) gives 6.199327 and is different of Intercept..
> So, I don't understand the parametrization with the aov() function.
> I would like the estimations with the constraints
>  fac1A+fac1B+fac1C =0 and fac2D+fac2C=0...
> 
> What is the solution?
> 
> 
> Thanks,
> Olivier.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list