I forgot to cc: R-help on this reply.
---------- Forwarded message ----------
From: Douglas Bates <dmbates at gmail.com>
Date: Jun 19, 2005 7:55 PM
Subject: Re: [R] How to sample from a linear mixed model
To: S??ren H??jsgaard <Soren.Hojsgaard at agrsci.dk>
On 6/19/05, S??ren H??jsgaard <Soren.Hojsgaard at agrsci.dk>
wrote:> I would like to draw a sample from a linear mixed model y=Xb+Zu+e which has
been fitted with lme(), i.e. a model y ~ N(Xb, C), where C=Z cov(u) Z' +
cov(e).
> I've tried to figure out how to extract C from an lme object, because
that would solve my problem when also using the predict() function, but without
any luck.
> Can anyone help on that?
C is not stored in an lme object. In fact it is never created.
(Consider the dimensions of this matrix. It could be huge.)
The easiest way to simulate data from a linear mixed model is to
simulate u and e then form Xb+Zu+e