Random slopes in twolevel longitudina...
Message/Author
 Fredrik Falkenström posted on Tuesday, November 27, 2018 - 1:33 am
I want to estimate a model with repeated measures nested within patients nested within therapists, with a random slope for one of the cross-lagged effects with variances both between patients and between therapists. The code below won’t work since the variance for the slope (S*) is on both within- and between levels. Is it possible to also get an estimate for the random slope on the within level?

%within%
B_X BY X1@1 X2@1 X3@1;
B_Y BY Y1@1 Y2@1 Y3@1;

cX1 BY X1@1;
cX2 BY X2@1;
cX3 BY X3@1;

cY1 BY Y1@1;
cY2 BY Y2@1;
cY3 BY Y3@1;

X1-Y3@0;
[cX1-cY3@0];

cX2 on cY1;
cX3 on cY2;

S | cY2 on cX1 (syx);
S | cY3 on cX2 (syx);

cX1 cY1 WITH B_X@0 B_Y@0;

B_X with B_Y;
S*;

%between%
X1-Y3;
[B_X* B_Y*];
[X1@0 X2* X3* Y1@0 Y2* Y3*];
S*; [S*];

Best,

Fredrik Falkenström
 Bengt O. Muthen posted on Tuesday, November 27, 2018 - 4:57 pm
I see one problem in your statements

S | cY2 on cX1 (syx);
S | cY3 on cX2 (syx);

- you cannot label a random slope expression because it does not refer to a single parameter. S has a mean, variance, and relationships with other variables. So the labels should appear where these aspects of S are referred to.

I think it is probably easiest to do this as 3-level instead of having time in wide format. So use 2 cluster variables: Therapist and Patient. Then the S variance is easily specified on the 2 Between levels with the bar statement on Within.

The S* approach you use (see page 755 in the V8 UG) gives S variance on Within and Between but I am not sure how that turns out in this context. I don't know what error you got.
 Fredrik Falkenström posted on Wednesday, November 28, 2018 - 2:01 am
Thanks! The parameter labels was a mistake, I included them in one of my runs because I wanted to ensure that the slope was estimated with equal loadings for both paths (cY2 on cX1 and cY3 on cX2), but perhaps that is always the case? Anyway, the problem was solved in the UG passage that you referred to, by stating S* | cY2 on cX1 and S* | cY3 on cX2. Unfortunately, the model did not converge using ML, and apparently it is not possible to get within-level slope variances with Bayesian estimation yet?
 Fredrik Falkenström posted on Wednesday, November 28, 2018 - 2:22 am
Sorry for the double response here, but I forgot to mention that the 3-level option probably won't work since I am controlling for the effect of the prior value of the outcome variable. The model I am using is Hamaker's Random Intercept Cross-Lagged Panel model, and I assume it is not possible to use in 3-level format?
 Bengt O. Muthen posted on Wednesday, November 28, 2018 - 5:39 pm
Your two-level approach with S* | ... should work in principle. I assume you have Cluster = therapist. The integration gets high-dimensional due to random slopes for latent variables so maybe that's your stumbling block; check Tech8 for negative Abs changes (see our TEch8 FAQ). Also, I don't see that your model has auto-regressions in it for your 2 DVs.

You can send the output for your best effort to Support along with your license number. It would be nice to have this random slope extension of the RI-CLPM going.
 Fredrik Falkenström posted on Thursday, November 29, 2018 - 2:26 pm
Thanks. I had to shorten the code to fit the constraint on message length, so the autoregressions apparently didn't make it into my post.

I now get the following error message:
THE ESTIMATED WITHIN COVARIANCE MATRIX COULD NOT BE INVERTED. COMPUTATION COULD NOT BE COMPLETED IN ITERATION 1. CHANGE YOUR MODEL AND/OR STARTING VALUES.

The error persists with changed starting values and some changes to the model. I'll send my data and input file to the support.