Converts the named list key format used by
report_alpha into a lavaan model syntax string suitable for
passing directly to lavaan::cfa(). Each list element becomes one
factor definition line of the form factorname =~ item1+item2+....
Value
A single character string containing the full lavaan model specification with one factor definition per line.
Examples
set.seed(12345)
population_model <- "t1=~x1+.5*x2+.5*x3
t2=~x4+.5*x5+.5*x6
t3=~x7+.5*x8+.5*x9"
model_data <- lavaan::simulateData(population_model, sample.nobs = 1000)
key <- list(f1 = paste0("x", 1:3), f2 = paste0("x", 4:6), f3 = paste0("x", 7:9))
model <- key_to_cfa_model(key)
fit <- lavaan::cfa(model, model_data)