Fabian Scheipl
2006-Aug-24 13:58 UTC
[R] lmer(): specifying i.i.d random slopes for multiple covariates
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 -- Echte DSL-Flatrate dauerhaft f?r 0,- Euro*. Nur noch kurze Zeit!
Spencer Graves
2006-Sep-03 05:05 UTC
[R] lmer(): specifying i.i.d random slopes for multiple covariates
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
>