[R] Fwd: How to sample from a linear mixed model

Søren Højsgaard Soren.Hojsgaard at agrsci.dk
Mon Jun 20 17:03:11 CEST 2005


Thanks. I wonder if there is a general way of extracting var(u) and var(e), which would be needed to simulate u and e. Clearly, one can get the estimated parameters, but is there a clever way of 'setting up' the matrices??
Best
Søren

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

______________________________________________
R-help at 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




More information about the R-help mailing list