【发布时间】:2022-10-22 14:27:50
【问题描述】:
我正在尝试使用 RStudio 中的 svylme 包对复杂的调查数据执行多级模型,但是在估计空模型时,会出现以下错误:
Error: cannot allocate vector of size 18.1 Gb
我已经使用gc() 函数清除了不需要的对象并清除了地址空间。
我尝试使用 memory.limit() 和 memory.size() 但出现相同的错误:
Warning message:
'memory.limit()' is no longer supported
Warning message:
'memory.size()' is no longer supported
这是我的会话信息:
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
locale:
[1] LC_COLLATE=Spanish_Spain.utf8 LC_CTYPE=Spanish_Spain.utf8 LC_MONETARY=Spanish_Spain.utf8
[4] LC_NUMERIC=C LC_TIME=Spanish_Spain.utf8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] svylme_1.1 jtools_2.2.0 survey_4.1-1 survival_3.3-1 Matrix_1.4-1 dplyr_1.0.9
[7] haven_2.5.0
loaded via a namespace (and not attached):
[1] nlme_3.1-157 fs_1.5.2 usethis_2.1.5 devtools_2.4.3 RColorBrewer_1.1-3
[6] rprojroot_2.0.3 tools_4.2.0 backports_1.4.1 utf8_1.2.2 R6_2.5.1
[11] rpart_4.1.16 Hmisc_4.7-0 DBI_1.1.3 colorspace_2.0-3 nnet_7.3-17
[16] withr_2.5.0 tidyselect_1.1.2 gridExtra_2.3 prettyunits_1.1.1 processx_3.5.3
[21] curl_4.3.2 compiler_4.2.0 cli_3.3.0 gt_0.6.0 htmlTable_2.4.0
[26] mice_3.14.0 desc_1.4.1 scales_1.2.0 checkmate_2.1.0 callr_3.7.0
[31] stringr_1.4.0 digest_0.6.29 minqa_1.2.4 foreign_0.8-82 base64enc_0.1-3
[36] jpeg_0.1-9 pkgconfig_2.0.3 htmltools_0.5.2 lme4_1.1-29 sessioninfo_1.2.2
[41] fastmap_1.1.0 htmlwidgets_1.5.4 rlang_1.0.2 rstudioapi_0.13 generics_0.1.2
[46] gtools_3.9.2.1 magrittr_2.0.3 Formula_1.2-4 Rcpp_1.0.8.3 munsell_0.5.0
[51] fansi_1.0.3 lifecycle_1.0.1 weights_1.0.4 stringi_1.7.6 gtsummary_1.6.0
[56] MASS_7.3-56 brio_1.1.3 pkgbuild_1.3.1 gdata_2.18.0.1 forcats_0.5.1
[61] crayon_1.5.1 lattice_0.20-45 splines_4.2.0 pander_0.6.5 hms_1.1.1
[66] knitr_1.39 ps_1.7.0 pillar_1.7.0 boot_1.3-28 pkgload_1.3.0
[71] glue_1.6.2 mitools_2.4 latticeExtra_0.6-29 data.table_1.14.2 broom.helpers_1.7.0
[76] remotes_2.4.2 nloptr_2.0.3 png_0.1-7 vctrs_0.4.1 testthat_3.1.4
[81] gtable_0.3.0 purrr_0.3.4 tidyr_1.2.0 cachem_1.0.6 ggplot2_3.3.6
[86] xfun_0.31 broom_0.8.0 tibble_3.1.7 memoise_2.0.1 cluster_2.1.3
[91] ellipsis_0.3.2
关于如何解决它的任何想法?
PD:我使用的是 16 GB RAM i7。
我已经搜索了可能的解决方案,就像this other question 中提出的那样,但我还没有发现任何适合我的特殊情况的解决方案。
【问题讨论】:
-
你的数据有多大?你想精确拟合什么样的模型?如果 R 试图分配 18GB 而你只有 16GB,那是行不通的。如果你想用 R 来拟合那个模型,你将需要一台更大的计算机。
标签: r memory-limit multilevel-analysis memory-size