So I'm trying to get Factor Scores after an SEM, and I want to test different scenarios for policy analysis.
Each scenario consists of setting all collected values of one of the latent variables (so all corresponding indicators) to the maximum level (5 on a likert scale) . When I do this, using lavPredict, I get the following:
model1 = '
OVERALL=~Q1+Q2+Q4
IAQ=~Q19+Q20+Q21+Q22
ACOUSTIC=~Q24+Q25+Q27+Q28
THERMAL=~Q13+Q14+Q15+Q17
OVERALL~IAQ+ACOUSTIC+THERMAL
'
model1.fit <- sem(model1, data = mydata, std.lv=TRUE, fixed.x=TRUE, ordered = names(mydata))
#Factor Score
lavPredict(model1.fit, newdata = dataIAQ, label = TRUE)
Error in lav_data_full(data = data, group = group, cluster = cluster, :
lavaan ERROR: ordered variable(s) has/have only 1 level
Note that mydata is the original data collected, and dataIAQ is the one where I manually set the answers to 5.
Is there a way to fix this?
Thanks!