I am trying to figure out how to conduct analyses using CFA and SEM models with three or more levels. Pritikin et al. (2017) investigates how to conduct a three-level and up to five-level SEM using OpenMx. Given that most software is limited to two or three levels, I find this interesting. The article presents sample code for how a two-level model a two-level SEM can be fitted by including the upper level model as a submodel of the base model (line 13), but it is unclear whether this strategy works for higher level models.

1 SubjectData <− unique (sleepstudy $ Subject)
3 bySubj <− mxModel(
4 model=“bySubj”, type=“RAM”,
5 latentVars=c (“slope”, “intercept”),
6 mxData(data. frame (Subject=SubjectData),
7 type=“raw”, primaryKey = “Subject”),
8 mxPath(from=c (“intercept”, “slope”), arrows =2, values =1),
9 mxPath(from=“intercept”, to=“slope”, arrows =2,
10 values =.25, labels=“cov1”))
12 sleepModel <− mxModel(
13 model=“sleep”, type=“RAM”, bySubj,
14 manifestVars=“Reaction”, latentVars = “Days”,
15 mxData(sleepstudy, type=“raw”),
16 mxPath(from=“one”, to=“Reaction”, arrows =1, free=TRUE),
17 mxPath(from=“one”, to=“Days”, arrows =1,
18 free=FALSE, labels=“data. Days”),
19 mxPath(from=“Days”, to=“Reaction”, arrows =1, free=TRUE),
20 mxPath(from=“Reaction”, arrows =2, values =1),
21 mxPath(paste0 (‘bySubj’, c (‘intercept’, ‘slope’)),
22 ‘Reaction’, arrows =1, free=FALSE, values=c (1,NA),
23 labels=c (NA,”data. Days”), joinKey=“Subject”))

Say I wanted to fit a three-level regression model (below) or even four or five levels. Is it as "simple" as adding the higher level model as a submodel in the model of the level below?

E.g. Figure 8 from Pritikin et al (2017). enter image description here

E.g. level 5-model as submodel of level 4-model, level 4-model as submodel of level 2-model

level5 <− mxModel(
            model=“bySubj”, type=“RAM”,
            <insert variables, paths,etc...>

level4 <− mxModel(
                model=“level4”, type=“RAM”, level5,
                <insert variables, paths,etc...>
level3 <− mxModel(
                model=“level3”, type=“RAM”, level4,
                <insert variables, paths,etc...>
level2 <− mxModel(
                model=“level2”, type=“RAM”, level3,
                <insert variables, paths,etc...>
level1 <− mxModel(
                model=“level1”, type=“RAM”, level2,
                <insert variables, paths,etc...>

1 Answer 1


Yes, for example see this 3 level growth curve model.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.