lavaan: An Open Source Structural Equation Modeling Package Using the R System for Statistical Modeling
Link to the last RSS article here: SPSS -- Ed.
By Dr. Rich Herrington, Research and Statistical Support Consultant
In a previous article, Dr. Starkweather covered implementing structural equations models (SEM) within the R statistical system. Specifically, the R packages sem and lavaan were used in the article’s R script examples. In this article, we highlight some of the capabilities, and recent changes, to the R package lavaan.
The web page for the lavaan package can be found at http://www.lavaan.org. The corresponding CRAN website for this package is found at: http://cran.r-project.org/web/packages/lavaan/index.html . Recently, a review article covering package lavaan, has appeared in the Journal of Statistical Software: http://www.jstatsoft.org/v48/i02/paper .
One of the authors primary reasons for developing lavaan was to provide “access to an easy-to-use, but complete, SEM program that is inexpensive to install in a computer classroom” (1). This ease of use extends to the model syntax that has been chosen for lavvan. The author chose to emulate the syntax of the well known SEM software Mplus. Additionally, lavaan provides a “mimic” option for output formatting. If mimic=”Mplus”, lavaan produces output that resembles the output of Mplus (similar mimic options exist for emulating LISREL and EQS output). Similar to Mplus, the conventions adopted in lavaan follow the following nomenclature (table taken from reference 1.):
An example of the prototypical R code necessary to declare a lavaan model in R appears as follows:
Note that lines with “#” are comment lines and do not effect the evaluation of the script. The R code above assigns a character string to the model object “myModel”. An example taken from the help pages of lavaan include a famous model and data set, included in many articles and texts covering SEM methodology:
lavaan SEM R script:
The resulting lavaan output:
Output Part 1:
Output Part 2:
Some of the functionality available to users in the current version of lavaan (0.5.9) includes:
- Esitmators: ML, GLS, WLS, MLM, MLF, MLR
- Can use Bollen-Stine bootstrapping
- Provides full FIML missing value analysis for MCAR and MAR settings
- Can implement general nonlinear equality and inequality constraints
- Provides full support for mean structures with parameter restrictions across groups
- Provides modification indicies and expected parameter changes based on these indices
- Provides full support for categorical and ordinal data using three stage WLS: WLS, WLSM, & WLSMV