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" <[EMAIL PROTECTED]>
To: "Dimitris Rizopoulos" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[email protected]>
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


______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to