You are here

3-level longitudinal latent growth curve model

5 posts / 0 new
Last post
cdmcdermott221's picture
Joined: 10/09/2018 - 09:22
3-level longitudinal latent growth curve model
Binary Data OpenMx Single Level Model ESA.R2.18 KB
Image icon Snapshot Data.PNG30.53 KB

Hello all,

I posted this question in the Mixed Effects and Nested Models discussion board, but haven't heard back in a few weeks and my analysis is a bit time-dependent.

I know similar questions have been posted here but I'm still unable to figure out the code for my model, as I am super new to OpenMx and structural equation modeling in general. I have data from a cluster-randomized RCT, collected at three time-points on children nested within schools. I would like to look at the effect of the intervention over time for the children, but taking the clustering from the schools into account. I'm trying to get my structural equation model to match this mixed model (with the data in long format) from the nlme package:

MixedModel <- lme(ESA ~ Time + trtGrp + Time*trtGrp,
random = list(School = ~1, idChild = ~1),
weights =varIdent(School),
corr = corCompSymm(form= ~Time),
method = "REML")

where ESA is the outcome (emotional self-awareness), Time is as a factor variable (so gives the slopes from Time 1 [ref] to Time 2, and Time 1 to Time 3), trtGrp is the intervention group, and the variance/covariance matrix for the three time-points is compound symmetry. The intercept is random ONLY for Schools. The intercept is fixed for Children, and the slope is fixed for both Children and School.
For structural equation modeling, I've been using a latent growth curve, with the data in wide format. Since the measures are not linear from T1 to T3, I've created two slopes (t1 to t2, and t1 to t3). The bit I'm struggling with is adding a random intercept for schools in OpenMx. I've attached my script to this post, as well as a screenshot of part of my data.

With this model, I can match everything to my mixed model except for the school intercept variance (since I haven't added it in here). I have no idea how to add another level, or how to add it so that the only thing it does is give a random intercept for School. Someone did respond to my original post and pointed me to this example:

However, I'm still unable to figure out how to make this work for my own data. Again, all I really need is for the intercept to be random at the School level, everything else is a fixed effect. If anyone is able to help, I would greatly appreciate it!

Thanks so much!

jpritikin's picture
Joined: 05/24/2012 - 00:35
complete runnable example

Can you provide a small subset of the data so that this script is a complete executable example? Providing some data as an image is not helpful.

cdmcdermott221's picture
Joined: 10/09/2018 - 09:22
data CSV

Sorry for the delay, I thought I responded last week but must not have submitted. I clearly misunderstood what you meant by subset, sorry about that! I attached my data in csv format, is that okay? Please let me know if you're unable to use this.

I believe my data needs to be in wide format since it's repeated measures (and I want the covariance matrix to be compound symmetry) and I want two separate slopes from T1 to T2 and T1 to T3. Thanks so much for your help!

File attachments: 
jpritikin's picture
Joined: 05/24/2012 - 00:35
like this?

Maybe this is the model you want?

mhunter's picture
Joined: 07/31/2009 - 15:26
Example 3-level models

These two are three-level models:



If you're just having trouble extending to a 3-level model as an SEM, then these may help. The data are all structured as "tall", not "wide".

Log in or register to post comments