[R] lme: error message with random=~1
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.ac.be
Wed Jan 5 13:43:05 CET 2005
Hi Thomas,
I don't quite understand what you want to do. If you use "random=~1"
(or "random=~1|Subject" if you don't have a groupedData), then you
just fit a random-intercepts model. "ranef(fm1)" gives you the
Empirical Bayes estimates (i.e., posterior means) for the
random-effects which you can use for instance, if you'd like
subject-specific fitted values.
Best,
Dimitris
----- Original Message -----
From: "Thomas Petzoldt" <thpe at hhbio.wasser.tu-dresden.de>
To: "Dimitris Rizopoulos" <dimitris.rizopoulos at med.kuleuven.ac.be>
Cc: <petzoldt at rcs.urz.tu-dresden.de>; <r-help at stat.math.ethz.ch>
Sent: Wednesday, January 05, 2005 1:31 PM
Subject: Re: [R] lme: error message with random=~1
> 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.
>
> Thomas
>
More information about the R-help
mailing list