metafor rma.mv:与 random = list(~1 |id1, ~1 | id2) 没有收敛,但与 random = list(~ id1|id2)
metafor rma.mv: no convergence with random = list(~1 |id1, ~1 | id2) but with random = list(~ id1|id2)
我在 R 中使用 metafor 包,非常有趣的是,我发现对于相同的数据集,与 list(~1|id1, ~1| 相比,~id1|id2 公式似乎给出更少的 "no convergence" 结果。 id2).谁能解释其背后的原因?提前致谢!
这是重现问题的测试数据:
# Case 1 - different results on convergence
df <- data.frame(bac = c("a","b","c"), id2 = c("A","B","B"), id1 = c("d","e","f"), ES = c(0.5603294, -1.8397608, -1.7491630), SE=c(2.368467, 1.240960, 1.287030))
rma.mv(yi=ES, V=(SE)^2,data=df,
random = list( ~ id1|id2),
control = list(maxiter = 500))
rma.mv(yi=ES, V=(SE)^2,data=df, random = list(~1|id1, ~1|id2), control = list(maxiter = 500))
# Case 2: exact the same results
df2 <- data.frame(id1= c("a","b","c","d"),id2=c("c1","c1","c2","c3"), Tech= c("a1","a2","a1","a1"),ES=c(-1.5,-3,1.5,3),SE=c(.2,.4,.2,.4))
rma.mv(ES, SE^2, random = ~ id1|id2, data=df2)
rma.mv(ES, SE^2, random = list(~ 1|id1,~ 1|id2), data=df2)
我的会话信息
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
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.6/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] ggplot2_3.2.1 matlib_0.9.2 magrittr_1.5 plyr_1.8.5 data.table_1.12.8
[6] metafor_2.1-0 Matrix_1.2-18 RNeo4j_1.7.0
loaded via a namespace (and not attached):
[1] rgl_0.100.50 Rcpp_1.0.3 lattice_0.20-38 assertthat_0.2.1
[5] digest_0.6.23 mime_0.9 R6_2.4.1 cellranger_1.1.0
[9] httr_1.4.1 pillar_1.4.3 rlang_0.4.4 lazyeval_0.2.2
[13] curl_4.3 readxl_1.3.1 rstudioapi_0.10 miniUI_0.1.1.1
[17] car_3.0-6 webshot_0.5.2 foreign_0.8-75 htmlwidgets_1.5.1
[21] munsell_0.5.0 shiny_1.4.0 compiler_3.6.1 httpuv_1.5.2
[25] xfun_0.12 pkgconfig_2.0.3 htmltools_0.4.0 tidyselect_1.0.0
[29] tibble_2.1.3 rio_0.5.16 withr_2.1.2 crayon_1.3.4
[33] dplyr_0.8.4 later_1.0.0 MASS_7.3-51.5 grid_3.6.1
[37] nlme_3.1-143 jsonlite_1.6.1 xtable_1.8-4 gtable_0.3.0
[41] lifecycle_0.1.0 scales_1.1.0 zip_2.0.4 stringi_1.4.5
[45] carData_3.0-3 promises_1.1.0 vctrs_0.2.2 openxlsx_4.1.4
[49] tools_3.6.1 forcats_0.4.0 manipulateWidget_0.10.1 glue_1.3.1
[53] purrr_0.3.3 hms_0.5.3 crosstalk_1.0.0 abind_1.4-5
[57] fastmap_1.0.1 colorspace_1.4-1 knitr_1.28 haven_2.2.0
用如此小的数据集拟合这些模型是毫无意义的,但总的来说,没有任何特别的原因可以解释为什么它在一种情况下有效而在另一种情况下无效。实现收敛,尤其是。使用如此小的数据集,很难并且可能使用一种模型规范比另一种模型规范更好。第一种情况,你可以通过切换优化器让它收敛;例如:
rma.mv(yi=ES, V=(SE)^2, data=df, random = list(~1|id1, ~1|id2), control = list(optimizer="optim", optmethod="Nelder-Mead"))
此外,如果您正在尝试提高实现收敛的情况的数量,那么如果模型选项指定了 tau2 的起始值,这会有所帮助
我在 R 中使用 metafor 包,非常有趣的是,我发现对于相同的数据集,与 list(~1|id1, ~1| 相比,~id1|id2 公式似乎给出更少的 "no convergence" 结果。 id2).谁能解释其背后的原因?提前致谢!
这是重现问题的测试数据:
# Case 1 - different results on convergence
df <- data.frame(bac = c("a","b","c"), id2 = c("A","B","B"), id1 = c("d","e","f"), ES = c(0.5603294, -1.8397608, -1.7491630), SE=c(2.368467, 1.240960, 1.287030))
rma.mv(yi=ES, V=(SE)^2,data=df,
random = list( ~ id1|id2),
control = list(maxiter = 500))
rma.mv(yi=ES, V=(SE)^2,data=df, random = list(~1|id1, ~1|id2), control = list(maxiter = 500))
# Case 2: exact the same results
df2 <- data.frame(id1= c("a","b","c","d"),id2=c("c1","c1","c2","c3"), Tech= c("a1","a2","a1","a1"),ES=c(-1.5,-3,1.5,3),SE=c(.2,.4,.2,.4))
rma.mv(ES, SE^2, random = ~ id1|id2, data=df2)
rma.mv(ES, SE^2, random = list(~ 1|id1,~ 1|id2), data=df2)
我的会话信息
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
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.6/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] ggplot2_3.2.1 matlib_0.9.2 magrittr_1.5 plyr_1.8.5 data.table_1.12.8
[6] metafor_2.1-0 Matrix_1.2-18 RNeo4j_1.7.0
loaded via a namespace (and not attached):
[1] rgl_0.100.50 Rcpp_1.0.3 lattice_0.20-38 assertthat_0.2.1
[5] digest_0.6.23 mime_0.9 R6_2.4.1 cellranger_1.1.0
[9] httr_1.4.1 pillar_1.4.3 rlang_0.4.4 lazyeval_0.2.2
[13] curl_4.3 readxl_1.3.1 rstudioapi_0.10 miniUI_0.1.1.1
[17] car_3.0-6 webshot_0.5.2 foreign_0.8-75 htmlwidgets_1.5.1
[21] munsell_0.5.0 shiny_1.4.0 compiler_3.6.1 httpuv_1.5.2
[25] xfun_0.12 pkgconfig_2.0.3 htmltools_0.4.0 tidyselect_1.0.0
[29] tibble_2.1.3 rio_0.5.16 withr_2.1.2 crayon_1.3.4
[33] dplyr_0.8.4 later_1.0.0 MASS_7.3-51.5 grid_3.6.1
[37] nlme_3.1-143 jsonlite_1.6.1 xtable_1.8-4 gtable_0.3.0
[41] lifecycle_0.1.0 scales_1.1.0 zip_2.0.4 stringi_1.4.5
[45] carData_3.0-3 promises_1.1.0 vctrs_0.2.2 openxlsx_4.1.4
[49] tools_3.6.1 forcats_0.4.0 manipulateWidget_0.10.1 glue_1.3.1
[53] purrr_0.3.3 hms_0.5.3 crosstalk_1.0.0 abind_1.4-5
[57] fastmap_1.0.1 colorspace_1.4-1 knitr_1.28 haven_2.2.0
用如此小的数据集拟合这些模型是毫无意义的,但总的来说,没有任何特别的原因可以解释为什么它在一种情况下有效而在另一种情况下无效。实现收敛,尤其是。使用如此小的数据集,很难并且可能使用一种模型规范比另一种模型规范更好。第一种情况,你可以通过切换优化器让它收敛;例如:
rma.mv(yi=ES, V=(SE)^2, data=df, random = list(~1|id1, ~1|id2), control = list(optimizer="optim", optmethod="Nelder-Mead"))
此外,如果您正在尝试提高实现收敛的情况的数量,那么如果模型选项指定了 tau2 的起始值,这会有所帮助