R lavann
lavann is a SEM fitting software.
Contents
Installation
install.package('lavaan')
Usage
" Y =~ y1 + y2 + y3 X =~ x1 + x2 + x3 Z =~ z1 + z2 + z3 Y ~ X + Z " |> sem(data = data, std.lv = TRUE) |> lavaanPlot(coefs = TRUE)
This displays:
- chi-squared test statistic for the model
regression coefficients for the measurement model(s), including Z statistics, under the Latent Variables header.
regression coefficients for the structural model, including Z statistics, under the Regression header
- covariances among latent variables, including Z statistics
- variances of observed variables, including Z statistics
Note that certain variances are forced to be 1 by assumption; in this case the variances of latent variables (i.e., X and Z) and the variance of the outcome variable's errors (i.e. .Y; the leading dot indicates a variance).
lavaan estimates latent variances whereas gsem fits data to a model using maximum likelihood. While regression coefficients can be comparable, the methods are fundamentally not.