Closed profandyfield closed 5 years ago
The problem is that the baseline.model
is having convergence problems. You can see the function works find when you don't request any incremental fit indices:
fitMeasures(fit, c("srmr", "rmsea"))
Not that it is relevant in your case, because as the other messages indicate, your pooled LRT is negative, thus set to zero, indicating perfect fit (any fit measures would indicate the same thing). I'm not sure that is the right choice, but research is lacking. You can set test = "D2"
to obtain a pooled test statistic that is not negative, and thus fit measures that are more informative
Back to your problem with CFI: The default baseline.model
is the independence model, which is incorrect for you because your hypothesized model has a more restrictive mean structure than the freely estimated means in the independence model (only constraints are that correlations == 0). So you should specify a baseline model in which the growth-indicator means are constrained to equality.
doi.org/10.1037/1082-989X.8.1.16
Furthermore, your hypothesized model includes an interaction between exogenous predictors, so that product term must be included in the baseline.model
for it to even possibly be nested within the hypothesized model. Since your hypotheses are not about the covariances among the exogenous predictors, I think a reasonable baseline.model
would simply constrain your estimated effects to zero. If you end up doing anything like constraining residual variances to equality, that would also need to happen in the baseline.model
for it to remain nested. If you want to check nesting, you can fit each model to the first imputation, then pass all models to the net()
function.
null_model <- 'i =~ 1*sat140 + 1*ks2_mat + 1*ks3_mat + 1*ks4_maths
# NO SLOPE, so means are constrained to equality via the intercept
# constrain regression slopes to zero
i ~ 0*wm_cent + 0*int_sdq_6 + 0*wm_cent:int_sdq_6 + 0*iq_cent + 0*emot_cent + 0*ses_cent + 0*cse_voc + 0*cse_olevel + 0*cse_alevel + 0*cse_degree + 0*sex + 0*life_evs_5
'
null_fit <- growth.mi(null_model, data = imps, missing = "fiml")
fitMeasures(fit, c("cfi", "rmsea"), baseline.model = null_fit, test = "D2") # works fine
Thanks - that's very helpful. I hadn't at all considered the issue of the baseline model.
andy
We are fitting a latent growth model using MI, which we have successfully fitted, but our code is now throwing the following error when we try to use fitmeasures to pool the imputed data sets:
Error in (function (object, h1 = NULL, test = c("D3", "D2"), omit.imps = c("no.conv", : No imputations meet "omit.imps" criteria.
I attach a minimal example than includes an RData file containing 10 imputed files (the full model we use 70, but to keep things manageable, here's 10) and some R code that loads the imputations and runs the code we're using.
We are working with the dev version of semTools. error_help.zip
Session Info:
`R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4
Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages: [1] stats graphics grDevices utils
[5] datasets methods base
other attached packages: [1] lmerTest_3.0-1 lme4_1.1-18-1
[3] Matrix_1.2-15 bindrcpp_0.2.2
[5] forcats_0.3.0 stringr_1.3.1
[7] dplyr_0.7.6 purrr_0.2.5
[9] readr_1.1.1 tidyr_0.8.1
[11] tibble_1.4.2 ggplot2_3.0.0
[13] tidyverse_1.2.1 summarytools_0.8.8 [15] sjlabelled_1.0.13 semPlot_1.1
[17] runjags_2.0.4-2 rjags_4-8
[19] coda_0.19-1 mice_3.3.0
[21] lattice_0.20-38 kableExtra_0.9.0
[23] here_0.1 haven_1.1.2
[25] gmodels_2.18.1 Amelia_1.7.5
[27] Rcpp_0.12.18 semTools_0.5-1.915 [29] lavaan_0.6-4.1372
loaded via a namespace (and not attached): [1] readxl_1.1.0 backports_1.1.2
[3] Hmisc_4.1-1 BDgraph_2.53
[5] plyr_1.8.4 igraph_1.2.2
[7] lazyeval_0.2.1 splines_3.5.2
[9] pryr_0.1.4 digest_0.6.15
[11] htmltools_0.3.6 matrixcalc_1.0-3
[13] gdata_2.18.0 magrittr_1.5
[15] checkmate_1.8.5 lisrelToR_0.1.4
[17] cluster_2.0.7-1 openxlsx_4.1.0
[19] sna_2.4 modelr_0.1.2
[21] matrixStats_0.54.0 jpeg_0.1-8
[23] sem_3.1-9 colorspace_1.3-2
[25] rvest_0.3.2 pan_1.6
[27] crayon_1.3.4 jsonlite_1.6
[29] RCurl_1.95-4.11 bindr_0.1.1
[31] survival_2.43-3 glue_1.2.0.9000
[33] gtable_0.2.0 mi_1.0
[35] ggm_2.3 jomo_2.6-3
[37] abind_1.4-5 rapportools_1.0
[39] scales_0.5.0 viridisLite_0.3.0
[41] xtable_1.8-2 htmlTable_1.12
[43] foreign_0.8-71 Formula_1.2-3
[45] stats4_3.5.2 prediction_0.3.6
[47] htmlwidgets_1.2 httr_1.4.0
[49] RColorBrewer_1.1-2 acepack_1.4.1
[51] pkgconfig_2.0.1 XML_3.98-1.16
[53] nnet_7.3-12 kutils_1.45
[55] utf8_1.1.4 labeling_0.3
[57] tidyselect_0.2.4 rlang_0.2.2
[59] reshape2_1.4.3 cellranger_1.1.0
[61] munsell_0.5.0 tools_3.5.2
[63] cli_1.0.0 statnet.common_4.1.4 [65] broom_0.5.0 fdrtool_1.2.15
[67] evaluate_0.10.1 arm_1.10-1
[69] yaml_2.2.0 knitr_1.20
[71] zip_1.0.0 pander_0.6.3
[73] mitml_0.3-6 glasso_1.10
[75] pbapply_1.3-4 nlme_3.1-137
[77] whisker_0.3-2 xml2_1.2.0
[79] compiler_3.5.2 rstudioapi_0.9.0
[81] png_0.1-7 huge_1.2.7
[83] pbivnorm_0.6.0 stringi_1.2.3
[85] highr_0.7 qgraph_1.5
[87] rockchalk_1.8.129 psych_1.8.4
[89] nloptr_1.0.4 pillar_1.2.3
[91] OpenMx_2.11.5 bitops_1.0-6
[93] data.table_1.11.4 corpcor_1.6.9
[95] R6_2.3.0 latticeExtra_0.6-28 [97] network_1.13.0.1 gridExtra_2.3
[99] codetools_0.2-15 boot_1.3-20
[101] MASS_7.3-51.1 gtools_3.8.1
[103] assertthat_0.2.0 rprojroot_1.3-2
[105] rjson_0.2.20 withr_2.1.2
[107] mnormt_1.5-5 parallel_3.5.2
[109] hms_0.4.2 grid_3.5.2
[111] rpart_4.1-13 minqa_1.2.4
[113] rmarkdown_1.10 snakecase_0.9.1
[115] carData_3.0-1 d3Network_0.5.2.1
[117] numDeriv_2016.8-1 lubridate_1.7.4
[119] base64enc_0.1-3 ellipse_0.4.1 `
Any help appreciated! Andy