[R] is there a way to use "aov" to do mixed linear models with both random and fixed effects?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Nov 10 08:48:46 CET 2008


Michael wrote:
> if I do:
> 
> yyy=aov(Y~A*B*C);
> 
> it seems that the three way ANOVA is based on all fixed-effects.
> 
> There is no way to signal to "aov" the A and B are random effects and
> C is fixed effect; or A is random and B and C are fixed?


Just put the appropriate Error() term in the model formula.

> Moreover, I guess I will need the Expected Mean Squares in order to do
> the F-test, where can I obtain these Expected Mean Squares in R?
> 
> And is there a command that directly give me the F-tests?

You usually get an stratified analysis, where this isn't necessary.

Notice though that nothing works properly with aov unless the error 
factor(s) are completely balanced.

> Any good tutorial for mixed linear models in R(e.g. the three-way
> ANOVA with two random factors as mentioned above, etc. )

Hmm, there's a bit of a gap there, I suspect. At least the two-way 
layout is covered in Baron&Li's tutorial. There also appears to be some 
coverage in Venables&Ripley (MASS), but I don't have a copy to hand.

-- 
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list