How do I find out who is included in the fitting?

25 views
Skip to first unread message

franz...@gmail.com

unread,
Jul 27, 2018, 4:38:37 AM7/27/18
to lavaan
Dear lavaan-friends!

I have a super basic question and I guess there is probably an answer somewhere in this group. So I am happy to be forwarded to that topic.

As I have a couple of missings in my dataset and the number of observations already indicates that not all persons are taken into account when lavaan fits the model, I was wondering how I can find out who is included?

Thank you!

Best,

Franzi

Jeremy Miles

unread,
Jul 27, 2018, 4:48:33 PM7/27/18
to lav...@googlegroups.com
You can use the complete.cases() function on a data frame that contains only the variables that you use in the model.



--
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.
--
--
My employer has nothing to do with this email. 

Terrence Jorgensen

unread,
Jul 29, 2018, 7:20:20 PM7/29/18
to lavaan
I was wondering how I can find out who is included?

lavInspect(fit, "case.idx")

These are the rows of data used in the analysis.

Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

franz...@gmail.com

unread,
Jul 30, 2018, 12:32:09 PM7/30/18
to lavaan
Thank you all so much!!! :)

franz...@gmail.com

unread,
Aug 2, 2018, 8:51:57 AM8/2/18
to lavaan
Hello,

another thing: is it possible to save something like a dummy variable to exclude people from analysis with less items?

Best,

Franzi

Terrence Jorgensen

unread,
Aug 3, 2018, 6:45:27 AM8/3/18
to lavaan
is it possible to save something like a dummy variable to exclude people from analysis with less items?

They are row numbers from your data set, so you can check whether each row (number) of data is in that list

1:nrow(myData) %in% lavInspect(fit, "case.idx")

That will be a TRUE/FALSE vector, which also functions as a dummy code because TRUE == 1L and FALSE == 0L.
Reply all
Reply to author
Forward
0 new messages