Dear Zhen,

You can use this with pdDiag(). An example:

library(nlme)
res <- lme(distance ~ age*Sex, random = list(Subject = pdDiag(~ age)), 
data=Orthodont)
summary(res)

Best,
Wolfgang

> -----Original Message-----
> From: R-help <r-help-boun...@r-project.org> On Behalf Of ??
> Sent: Monday, January 8, 2024 12:43
> To: R-help <R-help@r-project.org>
> Subject: [R] how to specify uncorrelated random effects in nlme::lme()
>
> Dear professor,
>
> I'm using package nlme, but I can't find a way to specify two uncorrelated
> random effects. For example, a random intercept and a random slope. In package
> lme4, we can specify&nbsp;x + (x ll g) to realize, but how in nlme?
>
> Thanks!
>
> ————————————————————————
>  Zhen Wang
>  Graduate student, Department of Medical Statistics, School of Public Health,
> Sun Yat-sen University
> E-mail:&nbsp;wangzh...@mail2.sysu.edu.cn
> 王震
> 中山大学公共卫生学院医学统计学系2022级硕士研究生
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to