SRMR. The last section contains the parameter estimates. It starts with (technical) information about the
method that was used to compute the standard errors. (Most users can safely ignore this information). Then, it
tabulates all free (and xed) parameters that were included in the model. Typically, rst the latent variables are
shown, followed by covariances and (residual) variances. The rst column (Estimate) contains the (estimated
or xed) parameter value for each model parameter; the second column (Std.err) contains the standard error
for each estimated parameter; the third column (Z-value) contains the Wald statistic (which is simply obtained
by dividing the parameter value by its standard error), and the last column (P(>|z|)) contains the p-value for
testing the null hypothesis that the parameter value equals zero in the population.
Note that in the Variances: section, there is a dot before the observed variables’ names. This is because they
are dependent (or endogenous) variables (predicted by the latent variables), and therefore, the value for the
variance that is printed in the output is an estimate of the residual variance: the left-over variance that is not
explained by the predictor(s). By contrast, there is no dot before the latent variable names, because they are
exogenous variables in this model (there are no single-headed arrows pointing to them). The values for the
variances here are the estimated total variances of the latent variables.
To wrap up this rst example, we summarize the complete code that was needed to t this three-factor model:
# load the lavaan package (only needed once per session)
library(lavaan)
# specify the model
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
# fit the model
fit <- cfa(HS.model, data = HolzingerSwineford1939)
# display summary output
summary(fit, fit.measures = TRUE)
Simply copying this code and pasting it in R should work. The syntax illustrates the typical workow in the
lavaan package:
1. Specify your model using the lavaan model syntax. In this example, only latent variable denitions have
been used. In the following examples, other formula types will be used.
2. Fit the model. This requires a dataset containing the observed variables (or alternatively the sample
covariance matrix and the number of observations). In this example, we have used the cfa() function.
Other functions in the lavaan package are sem() and growth() for tting full structural equation models
and growth curve models respectively. All three functions are so-called user-friendly functions, in the
sense that they take care of many details automatically, so we can keep the model syntax simple and
concise. If you wish to t non-standard models or if you don’t like the idea that things are done for you
automatically, you can use the lower-level function lavaan() instead, where you have full control.
3. Extract information from the tted model. This can be a long verbose summary, or it can be a single
number only (say, the RMSEA value). In the spirit of R, you only get what you asked for. We try to not
print out unnecessary information that you would ignore anyway.
14