write_lavaan {lavaanExtra} | R Documentation |
Vector-based lavaan syntax interpreter
Description
Vector-based lavaan syntax interpreter.
Usage
write_lavaan(
mediation = NULL,
regression = NULL,
covariance = NULL,
indirect = NULL,
latent = NULL,
intercept = NULL,
threshold = NULL,
constraint.equal = NULL,
constraint.smaller = NULL,
constraint.larger = NULL,
custom = NULL,
label = FALSE,
use.letters = FALSE
)
Arguments
mediation |
Mediation indicators ( |
regression |
Regression indicators ( |
covariance |
(Residual) (co)variance indicators ( |
indirect |
Indirect effect indicators ( |
latent |
Latent variable indicators ( |
intercept |
Intercept indicators ( |
threshold |
Threshold indicators ( |
constraint.equal |
Equality indicators ( |
constraint.smaller |
Smaller than indicators ( |
constraint.larger |
Greater than indicators ( |
custom |
Custom specifications. Takes a single string just
like regular |
label |
Logical, whether to display path names for the mediation argument. |
use.letters |
Logical, for the labels, whether to use letters instead of the variable names. |
Value
A character string, representing the specified lavaan
model.
See Also
The corresponding vignette: https://lavaanextra.remi-theriault.com/articles/write_lavaan.html
Examples
x <- paste0("x", 1:9)
(latent <- list(
visual = x[1:3],
textual = x[4:6],
speed = x[7:9]
))
HS.model <- write_lavaan(latent = latent)
cat(HS.model)
library(lavaan)
fit <- lavaan(HS.model,
data = HolzingerSwineford1939,
auto.var = TRUE, auto.fix.first = TRUE,
auto.cov.lv.x = TRUE
)
summary(fit, fit.measures = TRUE)