Dear forum,
I am quite new to lavaan and basically, I would like to do an EFA with the WLSMV estimator and multiple imputation via mice ('pmm') (and if I can figure it out apply rotation) by using semTools.
Unfortunately, I get various errors and I cannot figure out the problem behind it. I installed the development version of semTools various times and first it went ok, but when I ran the code a second and third time, the errors occured and the summary output was different. Additionally, I would like to get the "pooled" standardized loadings and I could not figure out how to get them. I would be very grateful for any help!
I used the following code:
set.seed(20170110)
HSMiss <- HolzingerSwineford1939[,paste("x", 1:9, sep="")]
randomMiss <- rbinom(prod(dim(HSMiss)), 1, 0.1)
randomMiss <- matrix(as.logical(randomMiss), nrow=nrow(HSMiss))
HSMiss[randomMiss] <- NA
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
out1 <- runMI(HS.model,
data=HSMiss,
m = 5,
miPackage="mice",
fun="cfa",
meanstructure = TRUE)
summary(out1)
lavaanList (0.6-11) -- based on 5 datasets (5 converged)
Latent Variables:
est.ave
visual =~
x1 1.000
x2 0.572
x3 0.760
textual =~
x4 1.000
x5 1.157
x6 0.990
speed =~
x7 1.000
x8 1.116
x9 1.069
Covariances:
est.ave
visual ~~
textual 0.394
speed 0.275
textual ~~
speed 0.176
Intercepts:
est.ave
.x1 4.909
.x2 6.135
.x3 2.250
.x4 3.059
.x5 4.301
.x6 2.197
.x7 4.215
.x8 5.508
.x9 5.368
visual 0.000
textual 0.000
speed 0.000
Variances:
est.ave
.x1 0.624
.x2 1.164
.x3 0.856
.x4 0.368
.x5 0.450
.x6 0.381
.x7 0.781
.x8 0.475
.x9 0.582
visual 0.754
textual 0.896
speed 0.376
fitMeasures(out1, "chisq")
Error in getMethod("coef", "lavaan.mi") :
no method found for function
'coef'and Signatur lavaan.mi
fitMeasures(out1, fit.measures = ("all"), test = "D2", pool.robust=TRUE)
Error in getMethod("resid", "lavaan.mi") :
no method found for function
for 'resid' und Signatur lavaan.mi
>sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8
[3] LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C
[5] LC_TIME=German_Germany.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mice_3.14.0 semTools_0.5-5.926 lavaan_0.6-11
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 pillar_1.7.0 compiler_4.2.0
[4] prettyunits_1.1.1 remotes_2.4.2 tools_4.2.0
[7] testthat_3.1.4 pkgbuild_1.3.1 pkgload_1.2.4
[10] tibble_3.1.6 memoise_2.0.1 lifecycle_1.0.1
[13] nlme_3.1-157 lattice_0.20-45 pkgconfig_2.0.3
[16] rlang_1.0.2 psych_2.2.3 cli_3.3.0
[19] parallel_4.2.0 pbivnorm_0.6.0 fastmap_1.1.0
[22] dplyr_1.0.9 withr_2.5.0 generics_0.1.2
[25] vctrs_0.4.1 desc_1.4.1 fs_1.5.2
[28] devtools_2.4.3 tidyselect_1.1.2 stats4_4.2.0
[31] rprojroot_2.0.3 grid_4.2.0 glue_1.6.2
[34] R6_2.5.1 processx_3.5.3 fansi_1.0.3
[37] sessioninfo_1.2.2 tidyr_1.2.0 callr_3.7.0
[40] purrr_0.3.4 magrittr_2.0.3 MASS_7.3-56
[43] backports_1.4.1 ps_1.7.0 ellipsis_0.3.2
[46] usethis_2.1.5 mnormt_2.0.2 numDeriv_2016.8-1.1
[49] utf8_1.2.2 broom_0.8.0 cachem_1.0.6
[52] tmvnsim_1.0-2 crayon_1.5.1 brio_1.1.3