RE: [R] mixed model

From: Doran, Harold <HDoran_at_air.org>
Date: Thu 26 May 2005 - 02:06:32 EST


I may not follow entirely here, but your random effects structure isn't correct for lme. Also, nlme cannot handle (at least well) models with crossed random effects. A better option would be to use the lmer function.

Setting up the structure for the random effects in nlme would look something like:

lme(y~ fixed, data, random~= z1 + z2 |ID)

Where ID is a variable that contains the grouping structure of your data.

In lmer, which is more appropriate for models with crossed random effects, you lmer call might be something along the lines of:

lmer(y ~ fixed + (z1|ID) + (z2|ID), data)

See the most recent version of R news for more info on this topic.

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of NATALIA F TCHETCHERINA
Sent: Wednesday, May 25, 2005 11:50 AM
To: r-help@stat.math.ethz.ch
Subject: [R] mixed model

 Hello all,
 I have problem with setting up random effects.  I have a model:
 y=x1+x2+x1*x2+z1+z1*x2
 where x1, x2, x1*x2 are fixed effects

 and z1, z1*x2 are random effects (crossed effects) I use library(nlme) 'lme' function.
 My question is: how I should set up random effects?  I did
 lme(y~x1+x2+x1:x2, data=DATA, random=~z1+z1:x2, na.action='na.omit') but it did not work.

 Sincerely, Natalia.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 26 02:11:58 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:05 EST