[R] lmer(): specifying i.i.d random slopes for multiple covariates

Spencer Graves spencer.graves at pdf.com
Sun Sep 3 07:05:15 CEST 2006

      The first example in the 'lmer' help page is the following: 

     (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))

      If this does not answer your question, please provide commented, 
minimal, self-contained, reproducible code with your explanation of why 
and how it does not. 

      Hope this helps. 
      Spencer Graves

Fabian Scheipl wrote:
> Dear readers,
> Is it possible to specify a model
> y=X %*% beta + Z %*% b ; b=(b_1,..,b_k) and b_i~N(0,v^2) for i=1,..,k
> that is, a model where the random slopes for different covariates are i.i.d., in lmer() and how?
> In lme() one needs a constant grouping factor (e.g.: all=rep(1,n)) and would then specify:
> lme(fixed= y~X, random= list(all=pdIdent(~Z-1)) ) ,
> that´s how it's done in the lmeSplines- documentation.
> Any hints would be greatly appreciated- I'm trying to write a suite of functions that will transform additive models into their mixed-effects representation like lmeSplines but using lmer() instead of lme().
> Thank you for your time,
> Fabian Scheipl

More information about the R-help mailing list