Closed studerus closed 4 years ago
Have you tried it? It is just a wrapper around lavaan()
, so you can use the same sample.cov=
and sample.nobs=
arguments.
unrotated <- efaUnrotate(HolzingerSwineford1939, nf = 3,
varList=paste0("x", 1:9),
sample.cov = cov(HolzingerSwineford1939[paste0("x", 1:9)]),
sample.nobs = nrow(HolzingerSwineford1939))
If you want to be able to trust your SEs, you need to analyze a covariance matrix (you can still look at the standardized solution). Otherwise, you need to constrain your residual variances such that the total implied variances are 1 (because that is fixed in a correlation matrix).
I tried it but experienced an error if only sample.cov
is supplied without data
. In your example you have provided both, in which case I think lavaan
will analyze the data
.
Ah yes, I was working too quickly, didn't remember to remove data=
. I just updated efaUnrotate()
to accept summary statistics. You can install the development version (also of lavaan) in a fresh R session, then restart R before loading semTools:
install.packages("lavaan", repos = "http://www.da.ugent.be", type = "source")
devtools::install_github("simsem/semTools/semTools")
## restart R
library(semTools)
unrotated <- efaUnrotate(nf = 3,
sample.cov = cov(HolzingerSwineford1939[paste0("x", 1:9)]),
sample.nobs = nrow(HolzingerSwineford1939))
summary(unrotated, std = TRUE)
Let me know if it doesn't work for your own data.
FYI, lavaan provides some experimental support for EFA now: https://github.com/yrosseel/lavaan/issues/112 (see example at the end of the thread). So I expect efaUnrotate()
will eventually be deprecated, but not until lavaan's functionality is well documented.
Thanks a lot for the quick fix! It works now.
Ah yes, I was working too quickly, didn't remember to remove
data=
. I just updatedefaUnrotate()
to accept summary statistics. You can install the development version (also of lavaan) in a fresh R session, then restart R before loading semTools:install.packages("lavaan", repos = "http://www.da.ugent.be", type = "source") devtools::install_github("simsem/semTools/semTools") ## restart R library(semTools) unrotated <- efaUnrotate(nf = 3, sample.cov = cov(HolzingerSwineford1939[paste0("x", 1:9)]), sample.nobs = nrow(HolzingerSwineford1939)) summary(unrotated, std = TRUE)
Let me know if it doesn't work for your own data.
FYI, lavaan provides some experimental support for EFA now: yrosseel/lavaan#112 (see example at the end of the thread). So I expect
efaUnrotate()
will eventually be deprecated, but not until lavaan's functionality is well documented.
It is possible to run Bifactor-ESEM using semTools? If yes, where can I find related examples? Thanks.
ESEM using semTools?
No, don't expect this to be supported by semTools
.
It would be nice if the efaUnrotate function could also handle correlation or covariance matrices as input for the exploratory factor analysis.