Michael
2008-Nov-10 07:22 UTC
[R] is there a way to use "aov" to do mixed linear models with both random and fixed effects?
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? 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? Any good tutorial for mixed linear models in R(e.g. the three-way ANOVA with two random factors as mentioned above, etc. ) Thanks a lot!
Peter Dalgaard
2008-Nov-10 07:48 UTC
[R] is there a way to use "aov" to do mixed linear models with both random and fixed effects?
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
Dieter Menne
2008-Nov-10 07:56 UTC
[R] is there a way to use "aov" to do mixed linear models with both random and fixed effects?
Michael <comtech.usa <at> gmail.com> writes:> 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?It is possible to do blocking with aov and the Error() term, but I would recommend against it, even if this method is still taught in universities. Use mixed models in package nlme, function lme, and you get a good documentation in the book by Pinheiro/Bates. Dieter