lavPredict

33 views
Skip to first unread message

Nour Fayed

unread,
Nov 15, 2018, 1:03:40 AM11/15/18
to lavaan
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!

Christopher David Desjardins

unread,
Nov 15, 2018, 11:57:37 AM11/15/18
to lav...@googlegroups.com
I am guessing by "dataIAQ", you mean you set that latent variable's indicators: Q19, Q20, Q21, and Q22 to 5? Then they have no variance and no covariance. Does this model run? If you have a variable with only one value, then it's a constant. You should remove it.

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Nour Fayed

unread,
Nov 15, 2018, 12:08:17 PM11/15/18
to lavaan
Yes that's exactly what I did.. I guess I'll have to figure another way.
Thanks!
Reply all
Reply to author
Forward
0 new messages