lavaan icon indicating copy to clipboard operation
lavaan copied to clipboard

Write EFA() function for lavaan - Reminder

Open hugoharada opened this issue 5 years ago • 12 comments

Write efa() function to address issues discussed in the following thread.

https://groups.google.com/forum/#!topic/lavaan/ujkHmCVirEY

hugoharada avatar Jul 23 '18 04:07 hugoharada

Hi Hugo/Yves, just wondering if you know whether there's been any progress on this?

dugaldfoster avatar Dec 06 '18 11:12 dugaldfoster

Hi,

semTools has the functions efaUnrotate(), orthRotate(), and oblqRotate() which allow to run EFA (first command) and to rotate the solution (latter two commands). They have worked greatly so far. Have you experienced issues with those functions?

On Thu, Dec 6, 2018 at 12:48 PM dugaldfoster [email protected] wrote:

Hi Hugo/Yves, just wondering if you know whether there's been any progress on this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yrosseel/lavaan/issues/112#issuecomment-444845595, or mute the thread https://github.com/notifications/unsubscribe-auth/ASWvFioLqrHt_uQVkUAIJX-wmpoPV7Ewks5u2QQWgaJpZM4VaWoY .

fabriciofialho avatar Dec 06 '18 12:12 fabriciofialho

Hi Fabricio,

Thanks for your reply. I was just wondering whether lavaan also offered EFA options, or if the idea to add that had been dropped. In the thread, Yves mentioned a way to "hack" an EFA in lavaan using the std.lv = and orthogonal = TRUE specifications. Would this just give the same results as the equivalent function in semTools?

dugaldfoster avatar Dec 07 '18 16:12 dugaldfoster

You will run into identification problems unless you place an additional inequality constraint on a function of the loadings. You can see the constraint semTools::efaUnrotate() uses at the bottom of the summary() output. I'm not sure what reference Sunthud used when he programmed that.

TDJorgensen avatar Dec 07 '18 23:12 TDJorgensen

Full support for EFA has been included in 0.6-4. There is no dedicated function yet, but the following syntax can be used the with sem/lavaan functions:

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))

Documentation is on its way.

yrosseel avatar Jul 01 '19 12:07 yrosseel

Full support for EFA has been included in 0.6-4. There is no dedicated function yet, but the following syntax can be used the with sem/lavaan functions:

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))

Documentation is on its way.

Thank you very much for the lavaan package and the syntax. Would you please let me know how to add a bi-factor the model? Thanks and happy new year!

mrli1234 avatar Dec 28 '20 01:12 mrli1234

how to add a bi-factor the model?

A bifactor model is a CFA model. You just need to specify your hypothesized factors in your model syntax. For example, adding a general factor to the ?cfa help-page example:

HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 
G =~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 '

fit <- cfa(HS.model, data = HolzingerSwineford1939, 
           orthogonal = TRUE, std.lv = TRUE)

TDJorgensen avatar Dec 28 '20 03:12 TDJorgensen

how to add a bi-factor the model?

A bifactor model is a CFA model. You just need to specify your hypothesized factors in your model syntax. For example, adding a general factor to the ?cfa help-page example:

HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 
G =~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 '

fit <- cfa(HS.model, data = HolzingerSwineford1939, 
           orthogonal = TRUE, std.lv = TRUE)

Thank you very much for your reply. This is a normal bifactor model.

However, I think the model provided by yrosseel is an exploratory sem model(esem)? I would to establish a bifactor-esem model.

Thanks again and happy new year!

mrli1234 avatar Dec 28 '20 04:12 mrli1234

Bifactor rotation is on my TODO list for 0.6-9

yrosseel avatar Jan 28 '21 14:01 yrosseel

Bifactor rotation is on my TODO list for 0.6-9

Thanks. Hope to see it soon.

mrli1234 avatar Mar 21 '21 00:03 mrli1234

@yrosseel Which bifactor rotations are you intending to implement? The Jennrich rotations appear to perform poorly, but a direct Schmid-Leiman rotation based on a target matrix appears to work well https://psycnet.apa.org/record/2019-42954-001

bwiernik avatar May 08 '21 00:05 bwiernik

Full support for EFA has been included in 0.6-4. There is no dedicated function yet, but the following syntax can be used the with sem/lavaan functions:

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))

Documentation is on its way.

Dear @yrosseel , greetings. A question: in this script, one can use target rotation? Or not yet? Thanks

cmerinos avatar Aug 14 '21 01:08 cmerinos

In lavaan 0.6-13, the efa() function can be used for exploratory factor analysis. I will now close this issue. For comments and/or feature requests concerning the efa() function, please open a new issue.

yrosseel avatar Oct 06 '22 15:10 yrosseel