Learn R Programming

⚠️There's a newer version (0.6-19) 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.

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: http://lavaan.org

Copy Link

Version

Install

install.packages('lavaan')

Monthly Downloads

68,297

Version

0.6-15

License

GPL (>= 2)

Maintainer

Yves Rosseel

Last Published

March 14th, 2023

Functions in lavaan (0.6-15)

growth

Fit Growth Curve Models
inspectSampleCov

Observed Variable Correlation Matrix from a Model and Data
lavCor

Polychoric, polyserial and Pearson correlations
lavExport

lavaan Export
lavMatrixRepresentation

lavaan matrix representation
lavNames

lavaan Names
lavListInspect

Inspect or extract information from a lavaanList object
lavInspect

Inspect or extract information from a fitted lavaan object
fitMeasures

Fit Measures for a Latent Variable Model
getCov

Utility Functions For Covariance Matrices
lavOptions

lavaan Options
lavTestScore

Score test
lavTestLRT

LRT test
parTable

Parameter Table
lavTablesFitCp

Pairwise maximum likelihood fit statistics
lavPredict

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

Residuals
lavPredictY

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

lavaan frequency tables
lavTest

Test of exact fit
lav_data

lavaan data functions
lavTestWald

Wald test
lavaan

Fit a Latent Variable Model
lav_model

lavaan model functions
lavaan-class

Class For Representing A (Fitted) Latent Variable Model
lav_matrix

Utility Functions: Matrices and Vectors
lav_samplestats

lavaan samplestats functions
lav_func

Utility Functions: Gradient and Jacobian
lav_partable

lavaan partable functions
lav_constraints

Utility Functions: Constraints
lavaanList-class

Class For Representing A List of (Fitted) Latent Variable Models
mplus2lavaan.modelSyntax

Convert Mplus model syntax to lavaan
mplus2lavaan

mplus to lavaan converter
sam

Fit Structural Equation Models using the SAM approach
lavaanList

Fit List of Latent Variable Models
sem

Fit Structural Equation Models
parameterEstimates

Parameter Estimates
modificationIndices

Modification Indices
InformativeTesting methods

Methods for output InformativeTesting()
model.syntax

The Lavaan Model Syntax
standardizedSolution

Standardized Solution
simulateData

Simulate Data From a Lavaan Model Syntax
summary.efaList

Summarizing EFA Fits
varTable

Variable Table
Demo.growth

Demo dataset for a illustrating a linear growth model.
Demo.twolevel

Demo dataset for a illustrating a multilevel CFA.
bootstrapLavaan

Bootstrapping a Lavaan Model
cfa

Fit Confirmatory Factor Analysis Models
estfun

Extract Empirical Estimating Functions
efa

Exploratory Factor Analysis
InformativeTesting

Testing order/inequality Constrained Hypotheses in SEM
PoliticalDemocracy

Industrialization And Political Democracy Dataset
HolzingerSwineford1939

Holzinger and Swineford Dataset (9 Variables)
FacialBurns

Dataset for illustrating the InformativeTesting function.