Do you have any materials that demonstrate how to estimate structural equation models using lavaan in R?

This is a question we often hear, particularly from students and junior researchers who don’t have access to expensive commercial software for fitting structural equation models. It is possible to estimate a wide array of SEMs, ranging from simple path models to fully latent SEMs to growth curve models and beyond, using the lavaan package within R. For those who may be interested, we have developed detailed demonstrations of how to estimate a broad class of SEMs using lavaan, making these free for download.

Briefly, R is a software program for statistical analysis and graphics that is freely available to users worldwide. R has many built-in functions and abilities that provide a powerful platform for data management, statistical modeling, and graphical analysis. A key strength of R is that user-provided “packages” can also be downloaded that conduct a mind-boggling number of different computational tasks and statistical models. Indeed, there are literally thousands of packages freely available to all R users. One package that is particularly salient when thinking about SEMs is called lavaan. Developed by Yves Rosseel at Ghent University (Rosseel, 2012), lavaan (short for latent variable analysis) is a freely available R package that allows for the estimation of a broad class of SEMs with results comparable to those obtained from commercial software.

For our summer workshops, we provide detailed demonstrations of a variety of software packages. This year we decided to develop lavaan demonstration materials to add to our upcoming SEM workshop and longitudinal SEM workshop (for which seats remain available as of the time of this posting). In the spirit of R and lavaan being freely available, we have decided to distribute our SEM demonstration notes using lavaan to anyone who might be interested.

We have posted two files free for download. The first is a 172-page PDF that provides detailed examples and discussion of a variety of SEMs including path analysis, factor analysis, SEMs with paths between latent variables, SEMs with discrete dependent variables, and growth curve models. The second is a ZIP file that contains all of the data and associated lavaan code needed to estimate the models discussed in the demonstration notes. We welcome you to use these materials freely for any non-commercial research or teaching endeavor.

Note that these notes and scripts were developed using R version 3.5.2 and lavaan version 0.6-3. As these programs evolve, some commands may change.

R Core Team (2018). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL

Rosseel, Y. (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48, 1-36.

Related Articles

A reviewer recently asked me to comment on the issue of equivalent models in my structural equation model. What is the difference between alternative models and equivalent models within an SEM?

An equivalent model can be thought of as a re-parameterization of the original model. In other words, it is just a different way of “packaging” the same information in the data and no equivalent model can be distinguished from another based on fit alone. If you were to fit a series of equivalent models to the same sample data you obtain exactly the same chi-square test statistic, RMSEA, CFI, TLI, and any other omnibus measure of fit. It is often best to treat this as a limitation of any given study and to potentially present one or a small number of equivalent model options to the reader so that these too might be considered as plausible representations of the data.


Your email address will not be published. Required fields are marked *