ID # of individual factor scores

277 views
Skip to first unread message

cezre...@gmail.com

unread,
Oct 29, 2015, 2:57:47 PM10/29/15
to lavaan
After fitting a CFA model, we would like to get the individual factor scores.  We use the function predict(model) to get these scores.  However, we would also like as output the individual membership ID that is associated with each individual factor score.  This seems to be very easy; but we have not been able to figure out a way to output each person's ID# with the actual factor score.  We can get the ID# separately, and merge it with the factor score; but this seems like a less safe way to do it than having the joint ID# and factor score output.  Any ideas on how to accomplish this?

Thanks.

Chris

Terrence Jorgensen

unread,
Oct 30, 2015, 4:14:10 AM10/30/15
to lavaan
Assuming you have no missing data (so everyone gets a factor score), you can submit your observed data as the "newdata" argument, so you know  the vector of factor scores is in the same order as the rows in your data.  Something like this:

myData$fs <-  predict(model, myData) 

Terry

Chris Zwilling

unread,
Oct 30, 2015, 3:47:20 PM10/30/15
to lav...@googlegroups.com
Thanks a bunch, Terry!

Chris

--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/mf9WVimJFLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages