Another important type of latent variable models are latent growth curve
models. Growth modeling is often used to analyze longitudinal or developmental
data. In this type of data, an outcome measure is measured on several
occasions, and we want to study the change over time. In many cases, the
trajectory over time can be modeled as a simple linear or quadratic curve.
Random effects are used to capture individual differences. The random effects
are conveniently represented by (continuous) latent variables, often called
*growth factors*. In the example below, we use an artifical dataset called
`Demo.growth`

where a score (say, a standardized score on a reading ability
scale) is measured on 4 time points. To fit a linear growth model for these
four time points, we need to specify a model with two latent variables: a
random intercept, and a random slope:

In this model, we have fixed all the coefficients of the growth
functions. To fit this model, the lavaan package provides a special
`growth()`

function:

Technically, the `growth()`

function is almost identical to the `sem()`

function. But a mean structure is automatically assumed, and the observed
intercepts are fixed to zero by default, while the latent variable
intercepts/means are freely estimated. A slightly more complex model adds two
regressors (`x1`

and `x2`

) that influence the latent growth factors. In
addition, a time-varying covariate `c`

that influences the outcome measure at
the four time points has been added to the model. A graphical representation
of this model is presented below.

The corresponding syntax is the following:

For ease of copy/pasting, the complete R code needed to specify and fit this linear growth model with a time-varying covariate is printed again below: