Re: [R] hierarchical linear models, mixed models and lme

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Thu, 20 Dec 2007 17:54:09 +0000 (UTC)

Nicolas Ris <Nicolas.Ris <at> sophia.inra.fr> writes:

> I am trying to analyse the data of the box 10.5 in the Biometry from
> Sokal and Rohlf (2001) using R. This is a three-level nested anova with
> equal sample size : 3 different treatments are compared ; 2 rats (coded
> 1 or 2) / treatment are studied ; 3 preparations (coded 1, 2 or 3) /
> rats are available ; 2 readings of the glycogen content / preparations
> are realised. Treatment is fixed whereas Rats (nested in Treatment) and
> Prep (nested in Rats) are random effects.
>
> According to a previous discussion found in the R-help archives (January
> 2007), I have tried the following formula :
> > box105.lme<-lme(content~treatment, box105.gd, random=~1|rats/prep)
> However, the formula summary(box105.lme) gives wrong estimates for the

Since your factors are codes as numbers, the first thing I would check if these are really factors in your data frame. If these are numeric, you will get a regression and degrees of freedom are totally off. Try

box105.gd$rats = as.factor(box105.gd$rats) box105.gd$prep = as.factor(box105.gd$prep)

I am sure there will be some differences to Sokal/Rohlf afterwards, but you should come closer. Please post a complete, self-running examples if you have more questions.

Dieter



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 20 Dec 2007 - 18:31:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Dec 2007 - 19:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.