EFA in lavaan

213 views
Skip to first unread message

Valeria Ivaniushina

unread,
Jan 27, 2021, 4:24:19 PM1/27/21
to lav...@googlegroups.com
Hi

I am interested in doing exploratory factor analysis in lavaan
I found this code ( https://github.com/yrosseel/lavaan/issues/112 ) :

model <- '
efa("efa")*f1 +
efa("efa")*f2 +
efa("efa")*f3 +
efa("efa")*f4 =~ y1 + y2 + y3 + y4 + y5 + y6 +
y7 + y8 + y9 + y10 + y11 + y12
'
fit <- sem(model, data = Data, rotation = "geomin",
rotation.args = list(geomin.epsilon = 0.01, rstarts = 30,
algorithm = "gpa", orthogonal = FALSE,
row.weights = "none", std.ov = TRUE))

But I need some additional explanation.

1. Usually the code runs OK, but sometimes I see an error:
"Error in if (ncol(S) == 1L) { :argument is of length zero"
After several tries I figured out that this error arises when the number of factors specified in the model it too high.
Is it correct?

2. In MPlus I could specify in one command several number of factors -- say, from 1 to 3 -- and then choose the best solution.
It there such an option in lavaan?

Best,
Valeria



Mauricio Garnier-Villarreal

unread,
Jan 27, 2021, 5:02:08 PM1/27/21
to lavaan
Valeria

No, you have to run the models separated for each number of factors, and in post analysis choose the " best" model

It is normal to have estimation problems when you estimate "too many" factors for the respective data/number of items. So, there is no number at which this happens consistently, as it depends on the data

Valeria Ivaniushina

unread,
Jan 29, 2021, 7:18:17 AM1/29/21
to lav...@googlegroups.com
Thank you, Mauricio

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/8f2a8ae3-2242-4a67-adc9-2c22db1f1a58n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages