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.

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

67,461

Version

0.6-19

License

GPL (>= 2)

Maintainer

Last Published

September 26th, 2024

Functions in lavaan (0.6-19)

inspectSampleCov

Observed Variable Correlation Matrix from a Model and Data
lavNames

lavaan Names
fitMeasures

Fit Measures for a Latent Variable Model
lavCor

Polychoric, polyserial and Pearson correlations
growth

Fit Growth Curve Models
lavExport

lavaan Export
getCov

Utility Functions For Covariance Matrices
lavMatrixRepresentation

lavaan matrix representation
lavInspect

Inspect or extract information from a fitted lavaan object
lavListInspect

Inspect or extract information from a lavaanList object
lavPredictY

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

Determine an optimal lambda penalty value through cross-validation
lavTablesFitCp

Pairwise maximum likelihood fit statistics
lavTest

Test of exact fit
lavTestScore

Score test
lavTestLRT

LRT test
lavResiduals

Residuals
lavOptions

lavaan Options
lavPredict

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

lavaan frequency tables
lav_partable

lavaan partable functions
lav_model

lavaan model functions
lavaan-class

Class For Representing A (Fitted) Latent Variable Model
lav_samplestats

lavaan samplestats functions
lav_matrix

Utility Functions: Matrices and Vectors
lav_func

Utility Functions: Gradient and Jacobian
lav_constraints

Utility Functions: Constraints
lavTestWald

Wald test
lavaan

Fit a Latent Variable Model
lavaanList

Fit List of Latent Variable Models
modificationIndices

Modification Indices
lav_export_estimation

lav_export_estimation
lav_data

lavaan data functions
mplus2lavaan.modelSyntax

Convert Mplus model syntax to lavaan
parameterEstimates

Parameter Estimates
mplus2lavaan

mplus to lavaan converter
model.syntax

The Lavaan Model Syntax
parTable

Parameter Table
lavaanList-class

Class For Representing A List of (Fitted) Latent Variable Models
summary.efaList

Summarizing EFA Fits
sam

Fit Structural Equation Models using the SAM approach
varTable

Variable Table
sem

Fit Structural Equation Models
simulateData

Simulate Data From a Lavaan Model Syntax
standardizedSolution

Standardized Solution
InformativeTesting methods

Methods for output InformativeTesting()
Demo.twolevel

Demo dataset for a illustrating a multilevel CFA.
estfun

Extract Empirical Estimating Functions
efa

Exploratory Factor Analysis
InformativeTesting

Testing order/inequality Constrained Hypotheses in SEM
cfa

Fit Confirmatory Factor Analysis Models
HolzingerSwineford1939

Holzinger and Swineford Dataset (9 Variables)
PoliticalDemocracy

Industrialization And Political Democracy Dataset
Demo.growth

Demo dataset for a illustrating a linear growth model.
FacialBurns

Dataset for illustrating the InformativeTesting function.
bootstrapLavaan

Bootstrapping a Lavaan Model