Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

error in metric measurement invariance analysis

36 views
Skip to first unread message

Nikola Ćirović

unread,
Feb 17, 2024, 7:53:00 AM2/17/24
to blavaan
Dear all, 
I am running a metric measurement invariance analysis and have run into an error message I don't understand. I am copying the code and error message below.

CODE:

factorBSI <- '
Somatization=~ BSI_2+BSI_7+ BSI_23+ BSI_29+ BSI_30+ BSI_33+ BSI_37
ObsessionCompulsion=~  BSI_5+ BSI_15+ BSI_26+ BSI_27+ BSI_32+ BSI_36
InterpersonalSensitivity=~  BSI_20+ BSI_21+ BSI_22+ BSI_42
Depression=~  BSI_9+BSI_16+ BSI_17+ BSI_18+ BSI_35+ BSI_50
Anxiety=~  BSI_1+ BSI_12+ BSI_19+ BSI_38+ BSI_45+  BSI_49
Hostility=~  BSI_6+ BSI_13+ BSI_40+ BSI_41 +BSI_46
PhobicAnxiety=~  BSI_8+ BSI_28+ BSI_31+ BSI_43+ BSI_47
ParanoidIdeation=~  BSI_4+ BSI_10+ BSI_24+ BSI_48 +BSI_51
Psychoticism=~  BSI_3+ BSI_14+ BSI_34+ BSI_44+ BSI_53

'
fit2 <- bcfa(factorBSI, data = P_study_items_prepared_for_analysisBezrecod,
             n.chains = 2,
             burnin = 10000,
             sample = 10000,
             inits = "prior",
             group = "Country", group.equal = "loadings")

Error message:

Error in eval(mc, parent.frame()) :
  Exception: model_stanmarg_namespace::model_stanmarg: v10[2][10] is 0, but must be greater than or equal to 1.000000 (in 'string', line 629, column 2 to column 38)
failed to create the sampler; sampling not done
Computing post-estimation metrics (including lvs if requested)...
Stan model 'stanmarg' does not contain samples.
Error in rowvec[samppar] <- which(grepl(stanvec[j], names(b.est)) & !(grepl("_c\\[",  :
  replacement has length zero

Kind regards, 
Nikola Ćirović

Ed Merkle

unread,
Feb 17, 2024, 3:34:32 PM2/17/24
to Nikola Ćirović, blavaan
Nikola,

Thanks for the report. The message seems to indicate that blavaan thought there were 10 latent variables even though you only specified 9. I haven't been able to reproduce it using the CRAN version of blavaan (0.5-3). If your packages are all updated, it might be helpful to see your sessionInfo() or your data (sent off-list).

Ed
--
You received this message because you are subscribed to the Google Groups "blavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blavaan+u...@googlegroups.com.

Nikola Ćirović

unread,
Feb 19, 2024, 12:59:18 PM2/19/24
to blavaan
Dear professor, 
I will share the sessionInfo as soom as I repeat the analysis.
Thank you!
Best, 
Nikola

Nikola Ćirović

unread,
Feb 20, 2024, 4:56:35 PM2/20/24
to blavaan
Dear professor Merkle, 
Here is the result of seessioninfo:

> sessionInfo() R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045) Matrix products: default Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C [5] LC_TIME=English_United States.utf8 time zone: Europe/Belgrade tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] blavaan_0.5-3 Rcpp_1.0.12 haven_2.5.4 semTools_0.5-6 lavaan_0.6-17 loaded via a namespace (and not attached): [1] RColorBrewer_1.1-3 rstudioapi_0.15.0 jsonlite_1.8.8 shape_1.4.6 magrittr_2.0.3 [6] jomo_2.7-6 nloptr_2.0.3 rmarkdown_2.25 vctrs_0.6.5 minqa_1.2.6 [11] heplots_1.6.2 CompQuadForm_1.4.3 base64enc_0.1-3 rstatix_0.7.2 forcats_1.0.0 [16] htmltools_0.5.7 polynom_1.4-1 plotrix_3.8-4 weights_1.0.4 broom_1.0.5 [21] Formula_1.2-5 mitml_0.4-5 parallelly_1.37.0 StanHeaders_2.32.5 htmlwidgets_1.6.4 [26] plyr_1.8.9 sandwich_3.1-0 zoo_1.8-12 igraph_2.0.1.1 lifecycle_1.0.4 [31] iterators_1.0.14 pkgconfig_2.0.3 Matrix_1.6-1.1 R6_2.5.1 fastmap_1.1.1 [36] future_1.33.1 digest_0.6.34 fdrtool_1.2.17 colorspace_2.1-0 GGally_2.2.1 [41] Hmisc_5.1-1 ellipse_0.5.0 ggpubr_0.6.0 fansi_1.0.6 nnls_1.5 [46] gdata_3.0.0 abind_1.4-5 IsingSampler_0.2.3 compiler_4.3.2 proxy_0.4-27 [51] doParallel_1.0.17 inline_0.3.19 glasso_1.11 htmlTable_2.4.2 backports_1.4.1 [56] carData_3.0-5 psych_2.4.1 ggstats_0.5.1 mgm_1.2-14 QuickJSR_1.1.3 [61] pkgbuild_1.4.3 R.utils_2.12.3 ggsignif_0.6.4 pan_1.9 MASS_7.3-60 [66] corpcor_1.6.10 loo_2.6.0 gtools_3.9.5 tools_4.3.2 pbivnorm_0.6.0 [71] foreign_0.8-85 future.apply_1.11.1 nnet_7.3-19 R.oo_1.26.0 glue_1.7.0 [76] quadprog_1.5-8 NetworkToolbox_1.4.2 nlme_3.1-163 grid_4.3.2 checkmate_2.3.1 [81] cluster_2.1.4 reshape2_1.4.4 generics_0.1.3 snow_0.4-4 gtable_0.3.4 [86] tzdb_0.4.0 R.methodsS3_1.8.2 class_7.3-22 tidyr_1.3.1 hms_1.1.3 [91] data.table_1.15.0 car_3.1-2 utf8_1.2.4 foreach_1.5.2 pillar_1.9.0 [96] stringr_1.5.1 splines_4.3.2 dplyr_1.1.4 smacof_2.1-5 networktools_1.5.1 [101] lattice_0.21-9 EGAnet_2.0.4 survival_3.5-7 tidyselect_1.2.0 bootnet_1.5.6 [106] pbapply_1.7-2 knitr_1.45 gridExtra_2.3 IsingFit_0.4 stats4_4.3.2 [111] xfun_0.42 qgraph_1.9.8 matrixStats_1.2.0 rstan_2.32.5 stringi_1.8.3 [116] statnet.common_4.9.0 boot_1.3-28.1 evaluate_0.23 codetools_0.2-19 nonnest2_0.5-6 [121] wordcloud_2.6 tibble_3.2.1 cli_3.6.2 RcppParallel_5.1.7 rpart_4.1.21 [126] munsell_0.5.0 candisc_0.8-6 network_1.18.2 globals_0.16.2 coda_0.19-4.1 [131] png_0.1-8 parallel_4.3.2 rstantools_2.4.0 readr_2.1.5 rgl_1.2.8 [136] ggplot2_3.4.4 jpeg_0.1-10 bayesplot_1.11.1 listenv_0.9.1 lme4_1.1-35.1 [141] glmnet_4.1-8 mvtnorm_1.2-4 scales_1.3.0 e1071_1.7-14 eigenmodel_1.11  
[146] purrr_1.0.2 tmvnsim_1.0-2 rlang_1.1.3 mnormt_2.1.1 mice_3.16.0  
 
Here is what I got when I typed in ="blavaan":


> sessionInfo(package="blavaan") R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045) Matrix products: default Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C [5] LC_TIME=English_United States.utf8 time zone: Europe/Belgrade tzcode source: internal attached base packages: character(0) other attached packages: [1] blavaan_0.5-3 loaded via a namespace (and not attached): [1] RColorBrewer_1.1-3 rstudioapi_0.15.0 jsonlite_1.8.8 shape_1.4.6 magrittr_2.0.3 [6] jomo_2.7-6 nloptr_2.0.3 rmarkdown_2.25 vctrs_0.6.5 minqa_1.2.6 [11] heplots_1.6.2 CompQuadForm_1.4.3 base64enc_0.1-3 rstatix_0.7.2 forcats_1.0.0 [16] htmltools_0.5.7 polynom_1.4-1 haven_2.5.4 plotrix_3.8-4 weights_1.0.4 [21] broom_1.0.5 Formula_1.2-5 mitml_0.4-5 parallelly_1.37.0 StanHeaders_2.32.5 [26] htmlwidgets_1.6.4 plyr_1.8.9 sandwich_3.1-0 zoo_1.8-12 igraph_2.0.1.1 [31] lifecycle_1.0.4 iterators_1.0.14 pkgconfig_2.0.3 Matrix_1.6-1.1 R6_2.5.1 [36] fastmap_1.1.1 future_1.33.1 digest_0.6.34 fdrtool_1.2.17 colorspace_2.1-0 [41] GGally_2.2.1 Hmisc_5.1-1 ellipse_0.5.0 ggpubr_0.6.0 fansi_1.0.6 [46] nnls_1.5 gdata_3.0.0 abind_1.4-5 IsingSampler_0.2.3 compiler_4.3.2 [51] proxy_0.4-27 doParallel_1.0.17 inline_0.3.19 glasso_1.11 htmlTable_2.4.2 [56] backports_1.4.1 carData_3.0-5 psych_2.4.1 ggstats_0.5.1 mgm_1.2-14 [61] QuickJSR_1.1.3 pkgbuild_1.4.3 R.utils_2.12.3 ggsignif_0.6.4 pan_1.9 [66] MASS_7.3-60 base_4.3.2 stats_4.3.2 corpcor_1.6.10 loo_2.6.0 [71] gtools_3.9.5 tools_4.3.2 pbivnorm_0.6.0 foreign_0.8-85 future.apply_1.11.1 [76] nnet_7.3-19 R.oo_1.26.0 glue_1.7.0 graphics_4.3.2 quadprog_1.5-8 [81] NetworkToolbox_1.4.2 nlme_3.1-163 grid_4.3.2 checkmate_2.3.1 cluster_2.1.4 [86] reshape2_1.4.4 generics_0.1.3 snow_0.4-4 gtable_0.3.4 tzdb_0.4.0 [91] R.methodsS3_1.8.2 class_7.3-22 tidyr_1.3.1 hms_1.1.3 data.table_1.15.0 [96] car_3.1-2 utf8_1.2.4 foreach_1.5.2 pillar_1.9.0 stringr_1.5.1 [101] splines_4.3.2 dplyr_1.1.4 smacof_2.1-5 networktools_1.5.1 lattice_0.21-9 [106] EGAnet_2.0.4 survival_3.5-7 tidyselect_1.2.0 bootnet_1.5.6 pbapply_1.7-2 [111] knitr_1.45 gridExtra_2.3 IsingFit_0.4 stats4_4.3.2 xfun_0.42 [116] datasets_4.3.2 qgraph_1.9.8 matrixStats_1.2.0 rstan_2.32.5 stringi_1.8.3 [121] statnet.common_4.9.0 boot_1.3-28.1 evaluate_0.23 codetools_0.2-19 nonnest2_0.5-6 [126] wordcloud_2.6 tibble_3.2.1 cli_3.6.2 semTools_0.5-6 RcppParallel_5.1.7 [131] rpart_4.1.21 munsell_0.5.0 lavaan_0.6-17 candisc_0.8-6 network_1.18.2 [136] Rcpp_1.0.12 globals_0.16.2 utils_4.3.2 coda_0.19-4.1 png_0.1-8 [141] parallel_4.3.2 rstantools_2.4.0 readr_2.1.5 rgl_1.2.8 ggplot2_3.4.4 [146] methods_4.3.2 jpeg_0.1-10 bayesplot_1.11.1 listenv_0.9.1 lme4_1.1-35.1 [151] glmnet_4.1-8 mvtnorm_1.2-4 scales_1.3.0 grDevices_4.3.2 e1071_1.7-14 [156] eigenmodel_1.11 purrr_1.0.2 tmvnsim_1.0-2 rlang_1.1.3 mnormt_2.1.1 [161] mice_3.16.0

Kind regards, Nikola

>

Nikola Ćirović

unread,
Feb 20, 2024, 4:59:12 PM2/20/24
to blavaan
Of note, the bcfa for configural invariance for the same model worked just fine I think (no error messages).
Reply all
Reply to author
Forward
0 new messages