Comparing OpenMx to lavaan
It can be seen that lavaan has a much simpler syntax that allows to rapidly model basic SEM models. However, we were a bit unfair to OpenMx because we used a path model specification for lavaan and a matrix specification for OpenMx. The truth is that OpenMx is still probably a bit wordier than lavaan, but let's apply a path model specification in each to do a fair head-to-head comparison.
We will use the famous Holzinger-Swineford 1939 dataset here from the lavaan package to do our modeling, as follows:
hs.dat <- HolzingerSwineford1939
We will create a new dataset with a shorter name so that we don't have to keep typing HozlingerSwineford1939
.
Explaining an example in lavaan
We will learn to fit the Holzinger-Swineford model in this section. We will start by specifying the SEM model using the lavaan model
syntax:
hs.model.lavaan <- ' visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9 visual ~~ textual visual ~~ speed textual...