Learn R Programming

⚠️There's a newer version (0.7-2) of this package.Take me there.

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.

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

80,721

Version

0.6-21

License

GPL (>= 2)

Maintainer

Yves Rosseel

Last Published

December 21st, 2025

Functions in lavaan (0.6-21)

lavCor

Polychoric, polyserial and Pearson correlations
lavListInspect

Inspect or extract information from a lavaanList object
lavMatrixRepresentation

lavaan matrix representation
growth

Fit Growth Curve Models
lavInspectSampleCov

Observed Variable Correlation Matrix from a Model and Data
lavPredict

Predict the values of latent variables (and their indicators).
lavPredictY

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

lavaan Names
lavInspect

Inspect or extract information from a fitted lavaan object
lavOptions

lavaan Options
lavTables

lavaan frequency tables
lavTablesFitCp

Pairwise maximum likelihood fit statistics
lavTestLRT

LRT test
lav_data

lavaan data functions
lavTestScore

Score test
lavTest

Test of exact fit
lavTestWald

Wald test
lavResiduals

Residuals
lavPredictY_cv

Determine an optimal lambda penalty value through cross-validation
lav_constraints

Utility Functions: Constraints
lav_plotinfo_positions

Position the nodes in the diagram
lav_plotinfo_rgraph

Plots a graph in R.
lav_partable

lavaan partable functions
lav_model_plotinfo

Get model information
lav_label_code

Provides formatted label for use in tikz, svg or rplot
lavExport

lavaan Export
lav_matrix

Utility Functions: Matrices and Vectors
lav_func

Utility Functions: Gradient and Jacobian
lav_export_estimation

lav_export_estimation
lavaan-class

Class For Representing A (Fitted) Latent Variable Model
lavaan-deprecated

Deprecated functions in lavaan package
lav_model

lavaan model functions
lavaanList

Fit List of Latent Variable Models
lav_plot

Creates diagram code for tikz, svg or creates an Rplot
lav_plotinfo_tikzcode

Creates code to show a diagram in tikz format.
lav_plotinfo_svgcode

Creates code to show a diagram in svg format.
lavScores

Extract Empirical Estimating Functions
lav_samplestats

lavaan samplestats functions
lav_mplus_lavaan

mplus to lavaan converter
modificationIndices

Modification Indices
model.syntax

The Lavaan Model Syntax
lav_mplus_syntax_model

Convert Mplus model syntax to lavaan
lavaan

Fit a Latent Variable Model
sam

Fit Structural Equation Models using the SAM approach
sem

Fit Structural Equation Models
lavaanList-class

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

Parameter Table
lav_efalist_summary

Summarizing EFA Fits
standardizedSolution

Standardized Solution
lav_data_simulate_old

Simulate Data From a Lavaan Model Syntax
lavParameterEstimates

Parameter Estimates
varTable

Variable Table
cfa

Fit Confirmatory Factor Analysis Models
FacialBurns

Dataset, originally used for illustrating the InformativeTesting function.
lav_getcov

Utility Functions For Covariance Matrices
lavBootstrap

Bootstrapping a Lavaan Model
Demo.twolevel

Demo dataset for a illustrating a multilevel CFA.
efa

Exploratory Factor Analysis
Demo.growth

Demo dataset for a illustrating a linear growth model.
PoliticalDemocracy

Industrialization And Political Democracy Dataset
HolzingerSwineford1939

Holzinger and Swineford Dataset (9 Variables)
fitMeasures

Fit Measures for a Latent Variable Model