[R-sig-ME] lmer code for multiple random slopes
Phillip Alday
me @end|ng |rom ph||||p@|d@y@com
Tue Feb 16 14:18:11 CET 2021
I suspect we'll need to know a bit more about your data to answer this
question. Can you share it in any form (e.g. variables renamed and
levels of factors changed to something opaque) ?
Best,
Phillip
On 16/2/21 4:02 am, Peter R Law via R-sig-mixed-models wrote:
> I am trying to fit a model with two covariates, x and z say, for response y, with a random factor g and want each of x and y to have a random slope. I expected
>
> lmer(y ~ x + z + (x+z|g),...)
>
> to fit a model with 6 random variance components, the intercept, two slopes and three correlations. But I got an error message saying there were 74 random variance components and my data was insufficient to fit the model. Yet
>
> lmer(y ~ x + z + (x+z||g),...)
>
> returned what I expected, a model with the random intercept and two slopes but no correlations. How is lmer interpreting the first line of code above and how I would code for what I want. I have not been able to find any examples in the literature or online that help me but I may have easily missed something so if anyone knows of a useful link that'd be great. The only examples of multiple random slopes I've seen take the form
>
> lmer(y~x + z +(x|g) + (z|g),...)
>
> specifically excluding correlations between the random slopes and intercept of the two predictors. Even if the latter is a more sensible approach I'd like to understand the coding issue.
>
> Thanks.
>
> Peter
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list