[R] lme: error message with random=~1

A.J. Rossini blindglobe at gmail.com
Wed Jan 5 14:10:29 CET 2005


On Wed, 05 Jan 2005 13:31:51 +0100, Thomas Petzoldt
<thpe at hhbio.wasser.tu-dresden.de> wrote:
> Dimitris Rizopoulos wrote:
> > Hi Thomas,
> >
> > "random=~1" works if your data frame is in "groupedData" format, check
> > this:
> >
> > # Orthodont is in groupedData format
> > fm1 <- lme(distance~age+Sex, data=Orthodont, random=~1)
> > #####
> > dat <- as.data.frame(Orthodont)
> > fm2.1 <- lme(distance~age+Sex, data=dat, random=~1)
> >
> > `dat' is an ordinary data.frame and thus random=~1 doesn't work. But
> > this works:
> >
> > fm2.2 <- lme(distance~age+Sex, data=dat, random=~1|Subject)
> > # you declare the grouping factor
> >
> > I hope it helps.
> >
> > Best,
> > Dimitris
> 
> Thank you very much, now I see, why the Orthodont example works. There
> is however an important difference. In the example the random effects
> structure is not only ~1 but in reality ~1|Subject, which is inherited
> from the groupedData object. So
> 
> ranef(fm1)
> 
> yields 27 intercepts, but what I want is only one single intercept.

Then you don't want a random intercept, right?    Those are fitted
estimates, if I'm not mistaken.


best,
-tony

"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).

A.J. Rossini
blindglobe at gmail.com




More information about the R-help mailing list