Closed BenGoudsmit closed 4 years ago
The definition of dForm seems correct.
Regarding your multivariate mixed model, I cannot say if this “correct”; this depends on your data and the model you want to fit for each longitudinal outcome. But, in any case, this is a valid model.
From: Ben notifications@github.com Sent: Friday, September 4, 2020 1:19 PM To: drizopoulos/JMbayes JMbayes@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [drizopoulos/JMbayes] Multivariate spline JM configuration (#73)
Dear prof. Rizopoulos,
I want to construct multivariate spline-based JMs in JMbayes, and also specify dForm so that both value and slope are used. In your help file I only see examples of univariate spline-based mixed-effect models, e.g.:
linear mixed model with natural cubic splines for the time effect
lmeFit.pbc1 <- lme(log(serBilir) ~ ns(year, 2), data = pbc2, random = ~ ns(year, 2) | id, method = "ML")
With dForm for slope:
we include the time-dependent slopes term
dForm <- list(fixed = ~ 0 + dns(year, 2), random = ~ 0 + dns(year, 2), indFixed = 2:3, indRandom = 2:3)
So far, I have constructed (working) mixed-effect models like this:
mixedmodel_spline <- mvglmer(list( log10A ~ ns(years, df=3) (age + disease+ gender) + (years| id), log10B ~ ns(years, df=3) (age + disease + gender) + (years| id), log10C ~ ns(years, df=3) (age + disease+ gender) + (years| id), log10D ~ ns(years, df=3) (age + disease+ gender) + (years| id)), data = longtrain, families = list(gaussian, gaussian, gaussian, gaussian))
Is this correct? Or should I add: random= list(id = pdDiag(form= ~ns(years, df=3)))? And if so, what would the mvglmer formula be?
Lastly, what would the Forms argument look like for these 4 longitudinal measurements? Something like this?
Forms <- list( "A" = "value", "A" = list(fixed = ~ 0 + dns(years, df=3) + gender + disease+ age, random = ~ 0 + dns(years, df=3), indFixed = c(2:4,8:16), indRandom = c(2:4,8:16),name = "slope"), "B" = "value", "B" = list(fixed = ~ 0 + dns(years, df=3) + gender + disease+ age, random = ~ 0 + dns(years, df=3), indFixed = c(2:4,8:16), indRandom = c(2:4,8:16),name = "slope"), "C" = "value", "C" = list(fixed = ~ 0 + dns(years, df=3) + gender + disease+ age, random = ~ 0 + dns(years, df=3), indFixed = c(2:4,8:16), indRandom = c(2:4,8:16),name = "slope"), "D" = "value", "D" = list(fixed = ~ 0 + dns(years, df=3) + gender + disease+ age, random = ~ 0 + dns(years, df=3), indFixed = c(2:4,8:16), indRandom = c(2:4,8:16),name = "slope") )
Many thanks for your efforts.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdrizopoulos%2FJMbayes%2Fissues%2F73&data=02%7C01%7Cd.rizopoulos%40erasmusmc.nl%7C4428f613148245a8171408d850c444ae%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C637348151175982561&sdata=YFpiNZJ4SOtyec4YfWOixBe7wd4NS2Bnsyq7tfND9UM%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADE7TTZGZVTYV5GXXIDLDBDSEDEIXANCNFSM4QYDZF3Q&data=02%7C01%7Cd.rizopoulos%40erasmusmc.nl%7C4428f613148245a8171408d850c444ae%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C637348151175992551&sdata=20aPij2RaGinP52KLXwQwd4Kq4DeEZqk83IbRLOY2Dk%3D&reserved=0.
What would a mvglmer specification look like for two linear (B and C) and one spline-modeled outcome (A) with natural cubic splines for the time and also with flexible modelling of subject-specific longitudinal developments? The code below does not work, what do I mis-specify? Something like??:
mixedmodel<- mvglmer(list(
A~ ns(years, df=3) + gender + age + disease, random= list(id = pdDiag(form= ~ns(years, df=3))), B ~ years + age + gender + disease + (years | id), C ~ years + age + gender + disease + (years | id)), data=longtrain, families=list(gaussian, gaussian, gaussian))
Of course, I would love to come to the EMC for a collaboration.
You cannot fit a mixed model with a diagonal covariance matrix for the random effects in mvglmer() currently.
Best, Dimitris
From: Ben notifications@github.com Sent: Monday, September 7, 2020 12:04 PM To: drizopoulos/JMbayes JMbayes@noreply.github.com Cc: D. Rizopoulos d.rizopoulos@erasmusmc.nl; Comment comment@noreply.github.com Subject: Re: [drizopoulos/JMbayes] Multivariate spline JM configuration (#73)
What would a mvglmer specification look like for two linear (B and C) and one spline-modeled outcome (A) with natural cubic splines for the time and also with flexible modelling of subject-specific longitudinal developments? The code below does not work, what do I mis-specify? Something like??:
mixedmodel<- mvglmer(list( A~ ns(years, df=3) + gender + age + disease, random= list(id = pdDiag(form= ~ns(years, df=3))), B ~ years + age + gender + disease + (years | id), C ~ years + age + gender + disease + (years | id)), data=longtrain, families=list(gaussian, gaussian, gaussian))
Of course, I would love to come to the EMC for a collaboration.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdrizopoulos%2FJMbayes%2Fissues%2F73%23issuecomment-688218119&data=02%7C01%7Cd.rizopoulos%40erasmusmc.nl%7C4a2c6c3e7d8846bf66b708d85315481f%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C637350698152225199&sdata=l4rQlDRv6NsQwSm7To%2BpmRPzz3HTPVd8M2S89dxdqVo%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADE7TT35AIIR54SU3KJWIP3SESVXLANCNFSM4QYDZF3Q&data=02%7C01%7Cd.rizopoulos%40erasmusmc.nl%7C4a2c6c3e7d8846bf66b708d85315481f%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C637350698152235195&sdata=OC9evtm4uFvyXFwAf4rQ5tdOKhgz1Itl55FsvOPP4Xk%3D&reserved=0.
Dear prof. Rizopoulos,
I want to construct multivariate spline-based JMs in JMbayes, and also specify dForm so that both value and slope are used. In your help file I only see examples of univariate spline-based mixed-effect models, e.g.:
linear mixed model with natural cubic splines for the time effect
With dForm for slope:
we include the time-dependent slopes term
So far, I have constructed (working) mixed-effect models like this:
Is this correct? Or should I add: random= list(id = pdDiag(form= ~ns(years, df=3)))? And if so, what would the mvglmer formula be?
Lastly, what would the Forms argument look like for these 4 longitudinal measurements? Something like this?
Many thanks for your efforts.