library(lavaan)
dat <- dat_path_model
mod <-
"
x3 ~ a*x1 + b*x2
x4 ~ a*x1
ab := a*b
"
fit <- sem(mod, dat_path_model, fixed.x = TRUE)
mod_to_add <- get_add(fit)
out <- fit_many(mod_to_add, fit)
out
print(out, max_models = 1)
Run the code above in your browser using DataLab