[R-sig-ME] How to update random effects without updating fixed effects and covariance

Douglas Bates bates at stat.wisc.edu
Sun Feb 27 15:54:03 CET 2011

On Fri, Feb 25, 2011 at 6:46 PM, Ali Nasiri Amini
<alinasiriamini at gmail.com> wrote:
> Hello,

> Let assume that I have two dataset d1 and d2. I fitted a mixed model
> on dataset d1 and estimated fixed effects, random effects, and
> covariance matrix of random effects. Now I want to use the fixed
> effect and covariance matrices that is derived from d1 and estimate
> only random effects for d2. To be more specific let us consider the
> sleepstudy example that is given in the book.

> fm <- lmer(Reaction ~ 1 + Days + (1 + Days|Subject), sleepstudy, REML
> = 0, verbose = TRUE)

> Now consider that I have a new data set from 2 new subjects, i.e a
> data frame sleepstudy2. I am interested to estimate only random
> effects corresponding to these new subjects assuming fixed effect and
> covariance matrix estimated from original dataset. I think this should
> be just a few lines of code but I could figure it out.

The calculation to determine the conditional means of the random
effects given the model parameters is a penalized least squares
problem. It can be set up in various ways.  The particular way that it
is expressed in lmer (at least in the lme4a package) is described in

More information about the R-sig-mixed-models mailing list