Extracting EFA solutions into R

24 views
Skip to first unread message

Catia Oliveira

unread,
Mar 8, 2024, 9:07:34 AM3/8/24
to mplusau...@googlegroups.com
Dear all,

I hope you are well.
I tried to use "extractEFAparameters" to read the parameters from EFA into R but it did not work:

# Load the MplusAutomation package library(MplusAutomation) # Read Mplus output files (assuming the files are in the specified directory) efa_output <- readModels(target = "./mplus_output/"  , filefilter = "efa_30m") # Extract EFA parameters from the output efa_parameters <- extractEFAparameters(efa_output)

It produced the following error:
"error: 'extractEFAparameters' is not an exported object from "namespace:MplusAutomation"

Thank you for your help.

Best wishes,

Catia

Daniel Morillo Cuadrado

unread,
Mar 8, 2024, 9:40:16 AM3/8/24
to Catia Oliveira, MplusAutomation
I've had to go back in time an eternity but, after taking a look, I think ˋextractEFAparameters()ˋ was originally not intended to be called directly. That's what the message is saying, that it is not a fucntion that is available for you to call. Originally, this was only called from within ˋreadModels()ˋ. Does the latter solve your problem?

For what I can see ˋextractEFAparameters()ˋ is now documented, so it should be exported. This is clearly a bug to be solved.

--
You received this message because you are subscribed to the Google Groups "MplusAutomation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mplusautomati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mplusautomation/CACw%2BTfe4CUab24UwdZ2F2RhKsE7t7f-XkOHsC68cFFmn8PxAeA%40mail.gmail.com.

Daniel Morillo Cuadrado

unread,
Mar 8, 2024, 11:39:20 AM3/8/24
to MplusAutomation, Catia Oliveira
I tried to make a quick fix, would you be so kind as to try it @Catia Oliveira ?

Please run the following:

if (!require("devtools")) install.packages("devtools")
devtools::install_github("DaniMori/MplusAutomation@bugfix/export-efa-params")

And then run your code again. Please let me know if it works then.


michael.hallquist

unread,
Mar 12, 2024, 9:58:03 AM3/12/24
to MplusAutomation
Hi Catia,

As Dani notes, the extractEFAparameters function was never intended to be exported or used directly. I apologize for this being present in the package documentation, which was confusing. In fact, I've now cleaned up the documentation in the development version of the package to reduce confusion about some of the "extract" functions that were there. The readModels() function is the primary way to access any model output information.

If you want just the parameters of EFA models, you could use the convenience function get_parameters on the model list, like 

efa_parameters <- get_parameters(efa_output)

Or you can just access the $parameters element of each output manually, like this:

all_params <- lapply(efa_output, function(x) x$parameters$efa)

Hope this helps! And Dani, thanks for the pull request, but I don't want to proliferate extract functions, so I won't be exported extractEFAparameters since it is the internal function used for parsing, which would be unfriendly for users.

Best,
Michael
Reply all
Reply to author
Forward
0 new messages