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