RE: [R] mixed model

From: Doran, Harold <>
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-----
Sent: Wednesday, May 25, 2005 11:50 AM
Subject: [R] mixed model

 Hello all,
 I have problem with setting up random effects.  I have a model:
 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. mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! 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