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

Copy Link

Version

Install

install.packages('lavaan')

Monthly Downloads

54,496

Version

0.6-17

License

GPL (>= 2)

Maintainer

Last Published

December 20th, 2023

Functions in lavaan (0.6-17)

lavCor

Polychoric, polyserial and Pearson correlations
lavListInspect

Inspect or extract information from a lavaanList object
lavNames

lavaan Names
getCov

Utility Functions For Covariance Matrices
lavMatrixRepresentation

lavaan matrix representation
fitMeasures

Fit Measures for a Latent Variable Model
lavInspect

Inspect or extract information from a fitted lavaan object
lavExport

lavaan Export
inspectSampleCov

Observed Variable Correlation Matrix from a Model and Data
growth

Fit Growth Curve Models
lavResiduals

Residuals
lavTables

lavaan frequency tables
lavTestLRT

LRT test
lavOptions

lavaan Options
lavTestScore

Score test
lavPredictY

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

Pairwise maximum likelihood fit statistics
parTable

Parameter Table
lavPredict

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

Test of exact fit
lav_data

lavaan data functions
lav_matrix

Utility Functions: Matrices and Vectors
lav_constraints

Utility Functions: Constraints
lavaan-class

Class For Representing A (Fitted) Latent Variable Model
lavTestWald

Wald test
lav_func

Utility Functions: Gradient and Jacobian
lav_model

lavaan model functions
lav_partable

lavaan partable functions
lav_samplestats

lavaan samplestats functions
lavaan

Fit a Latent Variable Model
sam

Fit Structural Equation Models using the SAM approach
modificationIndices

Modification Indices
sem

Fit Structural Equation Models
model.syntax

The Lavaan Model Syntax
mplus2lavaan

mplus to lavaan converter
InformativeTesting methods

Methods for output InformativeTesting()
parameterEstimates

Parameter Estimates
lavaanList-class

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

Fit List of Latent Variable Models
standardizedSolution

Standardized Solution
simulateData

Simulate Data From a Lavaan Model Syntax
mplus2lavaan.modelSyntax

Convert Mplus model syntax to lavaan
summary.efaList

Summarizing EFA Fits
varTable

Variable Table
efa

Exploratory Factor Analysis
FacialBurns

Dataset for illustrating the InformativeTesting function.
InformativeTesting

Testing order/inequality Constrained Hypotheses in SEM
PoliticalDemocracy

Industrialization And Political Democracy Dataset
HolzingerSwineford1939

Holzinger and Swineford Dataset (9 Variables)
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