aov() can also be used with an Error() term, when it is not just a front-end to lm and does fits random effects. (As the help page for aov says.)
On Tue, 8 Apr 2003, Paul, David A wrote:
I'm certainly no expert, but I believe that aov( ) is simply a front-end to the lm( ) function, which fits fixed-effects linear models. As you may know, it is possible to write any ANOVA model as a regression model with appropriate use of indicator variables for the various levels of treatments. So, aov( ) does not, in general, yield results that are comparable to those generated by lme( ). You have specified the same _fixed_ effect ( ~ Age ) in both aov( ) and lme( ) which is why they give you the same parameter estimates for this covariate.
Not really. The error structure is different, but that may not matter if there is the right nesting/balance in the design. After all `randomized block designs' are random effects normally analysed as fixed effects, and the results are the same.
When you perform anova( ) to compare the two lme( ) models, you are performing a likelihood ratio test. This is not generally the same as the F-test/t-test used to evaluate the marginal significance of a fixed-effect term in a linear model, which explains the difference between the p-values.
(and those lme fits were by ML rather than the default REML used earlier). In general there are other differences due to the different assumptions about error structures, and when there are likelihood-ratio tests would generally be preferred.
Best, david paul -----Original Message----- From: Martin Hoyle [mailto:plxmh at nottingham.ac.uk] Sent: Tuesday, April 08, 2003 10:09 AM To: r-help at stat.math.ethz.ch Subject: [R] Basic LME Hello R Users, I am investigating the basic use of the LME function, using the following example; Response is Weight, covariate is Age, random factor is Genotype model.lme <- lme (Weight~Age, random=~ 1|Genotype) After summary(model.lme), I find that the estimate of Age is 0.098 with p=0.758. I am comparing the above model with the AOV function; model.aov <- aov (Weight~Age + Genotype) I find that the estimate of Age is also 0.098, and p=0.758 as in the LME model above. So, my questions are; 1: I expected that the LME model would be a better way to analyse this data compared to the AOV model, since Genotype is a random factor. However, I obtain the same parameter estimate and p value for Age. Please can someone tell me why? 2: When using LME, when I am after a p value for the covariate Age, is it better to do the following; Model.lme2 <- lme (Weight~Age, random=~ 1|Genotype, method="ML") Model.lme3 <- lme (Weight~1, random=~ 1|Genotype, method="ML") Anova(Model.lme2, Model.lme3) Giving likelihood ratio=0.102, with p=0.749, which is slightly different to the p values of 0.758 above. Thanks for your attention, Martin. Martin Hoyle, School of Life and Environmental Sciences, University of Nottingham, University Park, Nottingham, NG7 2RD, UK Webpage: http://myprofile.cos.com/martinhoyle
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
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