sem
Fit confirmatory factor analysis and structural equation models using lavaan syntax, with fit indices and modification indices.
Instructions
Confirmatory factor analysis or structural equation modelling with lavaan. Give the model in lavaan syntax:
=~ defines a latent factor ('anxiety =~ q1 + q2 + q3')
~ a regression ('outcome ~ anxiety + age')
~~ a covariance
:= a derived quantity
Reports chi-square, CFI, TLI, RMSEA with its interval, SRMR, standardised loadings and path estimates, and composite reliability / AVE per factor. Set modification_indices=true to see which fixed parameters would most improve fit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Dataset name in the session. | |
| type | No | cfa, sem, path or growth. | sem |
| group | No | Grouping column for a multi-group model. | |
| model | Yes | lavaan model syntax; separate statements with newlines. | |
| digits | No | Decimal places. | |
| std_lv | No | Standardise latent variables instead of fixing the first loading to 1. | |
| missing | No | listwise, or 'fiml' to use full-information maximum likelihood. | listwise |
| save_as | No | Name for the fitted model in the session. | |
| bootstrap | No | Bootstrap samples for standard errors; 0 disables. | |
| estimator | No | ML, MLR (robust), WLSMV (for ordinal indicators), GLS or DWLS. | ML |
| mi_threshold | No | Only show modification indices at or above this value. | |
| modification_indices | No | Report modification indices. |