[R] how to specify uncorrelated random effects in nlme::lme()

Viechtbauer, Wolfgang (NP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Tue Jan 9 13:22:47 CET 2024


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-bounces using r-project.org> On Behalf Of ??
> Sent: Monday, January 8, 2024 12:43
> To: R-help <R-help using 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 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: wangzh597 using mail2.sysu.edu.cn
> 王震
> 中山大学公共卫生学院医学统计学系2022级硕士研究生


More information about the R-help mailing list