Multivariate multilevel model with R (nlme or lme4 packages)
I am trying to run a multivariate multilevel model with R. We're analyzing an RCT study with four measurement points and two outcomes.
We have already performed two separate MLMs but the Reviewer wants to see one multivariate MLM. I found some suggestions on the internet for MLMs with Bayesian approaches (see below). However, since I am (unfortunately) super unfamiliar with Baysian models (yet), I want to find a solution using nlme or lme4 packages (if possible). However, I am unsure about the code, because the model did not converge.
IV = Group (1 vs. 2), IV = Time (0, 1, 2, 3), DV1 = T_Conf, DV2 = T_Anx
In normal long-format, the data looks like this:
| ID | Group | Time | T_Conf | T_Anx |
|---|---|---|---|---|
| 1 | 1 | 0--- | 3.0 | 2.1 |
| 1 | 1 | 1--- | 2.8 | 1.5 |
| 1 | 1 | 2--- | 2.8 | 1.7 |
| 1 | 1 | 3--- | 2.2 | 2.0 |
| 2 | 1 | 0--- | 2.0 | 2.3 |
| 2 | 1 | 1--- | 2.7 | 1.6 |
In long-format with a dummy variable, the data look like this:
| ID | Group | Time | Outcome | Values | Conf | Anx | Variable |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 0 | T_Conf | 3.0. | 1. | 0 | 1 |
| 1 | 1 | 0 | T_Anx | 2.1. | 0 | 1 | 2 |
| 1 | 1 | 1 | T_Conf | 2.8. | 1 | 0 | 1 |
| 1 | 1 | 1 | T_Anx | 1.5. | 0 | 1 | 2 |
| 2 | 1 | 2 | T_Conf | 2.8. | 1 | 0 | 1 |
| 2 | 1 | 2 | T_Anx | 1.7. | 0 | 1 | 2 |
I tried this Code for a random intercept model:
Random Intercept Model
mod1 <- lmer(Values ~ 0 + Outcome + Outcome:Group + Outcome:Time + Outcome:(Group*Time) + (1 | Outcome/ID), data = long_mlm)
summary(mod1)
The Output looks like this:
`Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesLinear mixed model fit by REML ['lmerMod'] Formula: Values ~ 0 + Outcome + Outcome:Group + Outcome:Time + Outcome:(Group * Time) + (1 | Outcome/ID) Data: long_mlm
REML criterion at convergence: 537.1
Scaled residuals: Min 1Q Median 3Q Max -3.9046 -0.4821 -0.0007 0.4619 4.4660
Random effects:
Groups Name Variance Std.Dev.
ID:Outcome (Intercept) 0.16346 0.4043
Outcome (Intercept) 0.08742 0.2957
Residual 0.08585 0.2930
Number of obs: 552, groups: ID:Outcome, 138; Outcome, 2
Fixed effects: Estimate Std. Error t value OutcomeT_Anx 1.849818 0.346567 5.338 OutcomeT_Conf 2.905798 0.346567 8.385 OutcomeT_Anx:Group 0.134496 0.113853 1.181 OutcomeT_Conf:Group -0.120994 0.113853 -1.063 OutcomeT_Anx:Time -0.187087 0.050105 -3.734 OutcomeT_Conf:Time 0.142493 0.050105 2.844 OutcomeT_Anx:Group:Time 0.004734 0.031552 0.150 OutcomeT_Conf:Group:Time -0.048866 0.031552 -1.549
Correlation of Fixed Effects:
OtcT_A OtcT_C OtT_A:G OtT_C:G OT_A:T OT_C:T OT_A:G:
OutcomT_Cnf 0.000
OtcmT_Anx:G -0.495 0.000
OtcmT_Cnf:G 0.000 -0.495 0.000
OtcmT_Anx:T -0.217 0.000 0.395 0.000
OtcmT_Cnf:T 0.000 -0.217 0.000 0.395 0.000
OtcmT_A:G:T 0.206 0.000 -0.416 0.000 -0.949 0.000
OtcmT_C:G:T 0.000 0.206 0.000 -0.416 0.000 -0.949 0.000
optimizer (nloptwrap) convergence code: 0 (OK)
unable to evaluate scaled gradient
Model failed to converge: degenerate Hessian with 1 negative eigenvalues`
Can somebody help? Is this code correct? If no, what do I have to change? If yes, how can I interpret the results?