Learn R Programming

lavaan

lavaan is a free, open source R package for latent variable analysis. You can use lavaan to estimate a large variety of multivariate statistical models, including path analysis, confirmatory factor analysis, structural equation modeling and growth curve models.

The lavaan package is developed to provide useRs, researchers and teachers a free open-source, but commercial-quality package for latent variable modeling. The long-term goal of lavaan is to implement all the state-of-the-art capabilities that are currently available in commercial packages. However, lavaan is still under development, and much work still needs to be done.

Job ad

As part of an NWO-funded project for Dutch open-science infrastructural development, we are looking for a (second) researcher/junior postdoc for the lavaan project. The job ad can be found on the University of Twente.

The deadline is 31 July 2026.

The proposal for the full project can be found on Zenodo. The post-doc position above is part of Work Package 2 (WP2).

Installation

Install the stable version from CRAN:

install.packages("lavaan")

Or the development version from GitHub:

# install.packages("remotes")
remotes::install_github("yrosseel/lavaan")

Usage

To get a first impression of how lavaan works in practice, consider the following example of a SEM model (the Political Democracy Example from Bollen's 1989 book):

library(lavaan)

model <- '
   # latent variable definitions
     ind60 =~ x1 + x2 + x3
     dem60 =~ y1 + y2 + y3 + y4
     dem65 =~ y5 + y6 + y7 + y8
   # regressions
     dem60 ~ ind60
     dem65 ~ ind60 + dem60
   # residual covariances
     y1 ~~ y5
     y2 ~~ y4 + y6
     y3 ~~ y7
     y4 ~~ y8
     y6 ~~ y8
'
fit <- sem(model, data = PoliticalDemocracy)
summary(fit)

More information can be found on the website: https://lavaan.org

Copy Link

Version

Install

install.packages('lavaan')

Monthly Downloads

82,174

Version

0.7-2

License

GPL (>= 2)

Maintainer

Yves Rosseel

Last Published

July 16th, 2026

Functions in lavaan (0.7-2)

lavNames

lavaan Names
lavInspectSampleCov

Observed Variable Covariance Matrix from a Model and Data
lavInspect

Inspect or extract information from a fitted lavaan object
lavListInspect

Inspect or extract information from a lavaanList object
growth

Fit Growth Curve Models
lavPredict

Predict the values of latent variables (and their indicators)
lavEffects

Indirect and Total Effects
lavOptions

lavaan Options
lavCor

Polychoric, polyserial and Pearson correlations
lavMatrixRepresentation

lavaan matrix representation
lavTest

Test of exact fit
lavResidualsY

Compute residuals for the y-variables given the values of the x-variables
lavPredictY_cv

Determine an optimal lambda penalty value through cross-validation
lavResiduals

Residuals
lavTestLRT

LRT test
lavTestWald

Wald test
lavTestScore

Score test
lavPredictY

Predict the values of y-variables given the values of x-variables
lavTablesFitCp

Pairwise maximum likelihood fit statistics
lavTables

lavaan frequency tables
lav_export_estimation

lav_export_estimation
lav_model_plotinfo

Get model information
lav_matrix

Utility Functions: Matrices and Vectors
lav_long_names

Deprecated functions with long names
lav_label_code

Provides a formatted label for use in tikz, svg or Rplot
lav_constraints

Utility Functions: Constraints
lavExport

lavaan Export
lav_func

Utility Functions: Gradient and Jacobian
lav_data

lavaan data functions
lav_model

lavaan model functions
lav_partable

lavaan partable functions
lavScores

Extract Empirical Estimating Functions
lavaan-deprecated

Deprecated functions in lavaan package
lavaan

Fit a Latent Variable Model
lavaan-class

Class For Representing A (Fitted) Latent Variable Model
lav_plotinfo_rgraph

Plots a graph in R
lav_plotinfo_svgcode

Creates code to show a diagram in svg format
lav_plotinfo_tikzcode

Creates code to show a diagram in tikz format
lav_plotinfo_positions

Position the nodes in the diagram
lav_samplestats

lavaan samplestats functions
lav_mplus_lavaan

mplus to lavaan converter
parTable

Parameter Table
modificationIndices

Modification Indices
open_parser

The open parser configuration
lav_mplus_syntax_model

Convert Mplus model syntax to lavaan
lav_plot

Create diagram code for tikz or svg, or produce an R plot
lavaanList-class

Class For Representing A List of (Fitted) Latent Variable Models
lavaanList

Fit List of Latent Variable Models
mimic

The mimic= option
model.syntax

The Lavaan Model Syntax
sem

Fit Structural Equation Models
lavParameterEstimates

Parameter Estimates
varTable

Variable Table
sam

Fit Structural Equation Models using the SAM approach
standardizedSolution

Standardized Solution
lav_efalist_summary

Summarizing EFA Fits
lavSimulateData

Simulate Data From a Lavaan Model Syntax
Demo.growth

Demo dataset for illustrating a linear growth model
lav_getcov

Utility Functions For Covariance Matrices
fitMeasures

Fit Measures for a Latent Variable Model
lavBootstrap

Bootstrapping a Lavaan Model
cfa

Fit Confirmatory Factor Analysis Models
Demo.twolevel

Demo dataset for illustrating a multilevel CFA
HolzingerSwineford1939

Holzinger and Swineford Dataset (9 Variables)
PoliticalDemocracy

Industrialization And Political Democracy Dataset
efa

Exploratory Factor Analysis
estimator_iv

Instrumental Variable (MIIV-2SLS) Estimation