Closed kstyck closed 5 years ago
I'm not sure what the issue is on your machine, but I just ran your example on my machine without any error. I have the same versions you do, except my R is version 3.5.2 and on Windows (but I doubt that is the problem).
other attached packages:
[1] mice_3.3.0 lattice_0.20-38 semTools_0.5-1.908 lavaan_0.6-3 jtools_1.1.1
[6] emmeans_1.3.1
It is possible I forgot to iterate the version number when I fixed this bug before. Can you try installing the development version of semTools again?
I cannot tell you how many times I closed the console and reinstalled the development version of semTools only to obtain the error message again... of course, when you ask me to do it works like a charm! Thanks! Sorry to be a bother.
no worries, glad it works!
fitMeasures() returns an error (similar to the bug reported for fitMeasures() with lavaan.mi() earlier) when cfi.mi() is used with data that is a list of imputed datasets obtained from the mice package (even when the development version is installed). Thanks in advance for your help! :-)
Example from the help page of runMI
HSMiss <- HolzingerSwineford1939[ , c(paste("x", 1:9, sep = ""), "ageyr","agemo","school")] set.seed(12345) HSMiss$x5 <- ifelse(HSMiss$x5 <= quantile(HSMiss$x5, .3), NA, HSMiss$x5) age <- HSMiss$ageyr + HSMiss$agemo/12 HSMiss$x9 <- ifelse(age <= quantile(age, .3), NA, HSMiss$x9) HS.model <- ' visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9 ' set.seed(12345) HS.mice <- mice(HSMiss, m=3) HS.mice.list <- complete(data=HS.mice, action=c(1:3), mild=T) out <- cfa.mi(HS.model, data=HS.mice.list) summary(out) fitMeasures(out) Error in gp.resid.lavaan.mi(Observed = object@SampleStatsList[useImps], : object 'N' not found
sessionInfo() R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.6
Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] polycor_0.7-9 psych_1.8.10 plyr_1.8.4 semTools_0.5-1.908 mice_3.3.0 lattice_0.20-35
[7] lavaan_0.6-3
loaded via a namespace (and not attached): [1] tidyselect_0.2.4 remotes_2.0.2 purrr_0.2.5 splines_3.5.1 usethis_1.4.0 stats4_3.5.1 pan_1.6
[8] survival_2.42-3 rlang_0.2.2 pkgbuild_1.0.2 jomo_2.6-5 nloptr_1.2.1 pillar_1.3.0 foreign_0.8-70
[15] glue_1.3.0 withr_2.1.2 sessioninfo_1.1.1 bindrcpp_0.2.2 bindr_0.1.1 devtools_2.0.1 memoise_1.1.0
[22] callr_3.1.1 ps_1.3.0 curl_3.3 parallel_3.5.1 broom_0.5.0 Rcpp_0.12.18 backports_1.1.2
[29] desc_1.2.0 pkgload_1.0.2 fs_1.2.6 lme4_1.1-18-1 mnormt_1.5-5 digest_0.6.16 processx_3.2.1
[36] dplyr_0.7.6 rprojroot_1.3-2 grid_3.5.1 cli_1.0.0 tools_3.5.1 magrittr_1.5 tibble_1.4.2
[43] crayon_1.3.4 tidyr_0.8.1 pbivnorm_0.6.0 pkgconfig_2.0.2 MASS_7.3-50 Matrix_1.2-14 prettyunits_1.0.2 [50] assertthat_0.2.0 minqa_1.2.4 mitml_0.3-7 R6_2.2.2 rpart_4.1-13 nnet_7.3-12 nlme_3.1-137
[57] compiler_3.5.1