在玩 tidybayes 包时(我从小插图中模拟的代码复制了数据:http://mjskay.github.io/tidybayes/articles/tidybayes.html ),我继续偶然发现错误:错误:全部使用 spread_draws 函数(或 tidybayes 中的任何其他函数,就此而言)时,列表元素必须是列表本身。这是来自小插图的模拟数据:
library(tidyverse)
library(tidybayes)
library(brms)
set.seed(5)
n = 10
n_condition = 5
ABC =
tibble(
condition = rep(c("A","B","C","D","E"), n),
response = rnorm(n * 5, c(0,1,2,1,-1), 0.5)
)
这是拟合模型的代码:
m = brm(
response ~ (1|condition),
data = ABC,
prior = c(
prior(normal(0, 1), class = Intercept),
prior(student_t(3, 0, 1), class = sd),
prior(student_t(3, 0, 1), class = sigma)
),
control = list(adapt_delta = .99)
)
但是,即使在尝试使用 get_variables 函数时,我也会遇到与上述相同的错误。有没有其他人遇到过类似的问题或能够解决这个问题?
这是会话信息。
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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] tidybayes_3.0.1 see_0.6.7 bayestestR_0.11.0 semTools_0.5-5
[5] lavaan_0.6-9 HDInterval_0.2.2 brms_2.15.0 Rcpp_1.0.6
[9] ggsignif_0.6.2 reshape2_1.4.4 ggsci_2.9 psych_2.0.12
[13] jtools_2.1.3 magrittr_2.0.1 extrafont_0.17 ggthemes_4.2.4
[17] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.4 purrr_0.3.4
[21] tidyr_1.1.2 tibble_3.0.6 tidyverse_1.3.0 gridExtra_2.3
[25] ggpubr_0.4.0 ggplot2_3.3.5 readr_1.4.0
loaded via a namespace (and not attached):
[1] utf8_1.1.4 tidyselect_1.1.0 lme4_1.1-26
[4] htmlwidgets_1.5.3 grid_4.0.3 munsell_0.5.0
[7] codetools_0.2-18 statmod_1.4.35 DT_0.18
[10] miniUI_0.1.1.1 withr_2.4.1 Brobdingnag_1.2-6
[13] colorspace_2.0-0 knitr_1.31 rstudioapi_0.13
[16] stats4_4.0.3 Rttf2pt1_1.3.9 bayesplot_1.8.1
[19] labeling_0.4.2 emmeans_1.5.4 rstan_2.21.2
[22] mnormt_2.0.2 farver_2.0.3 datawizard_0.2.0.1
[25] bridgesampling_1.1-2 coda_0.19-4 vctrs_0.3.6
[28] generics_0.1.0 TH.data_1.0-10 xfun_0.25
[31] R6_2.5.0 markdown_1.1 gamm4_0.2-6
[34] projpred_2.0.2 assertthat_0.2.1 promises_1.2.0.1
[37] scales_1.1.1 multcomp_1.4-16 debugme_1.1.0
[40] gtable_0.3.0 processx_3.5.2 sandwich_3.0-0
[43] rlang_0.4.10 splines_4.0.3 rstatix_0.7.0
[46] extrafontdb_1.0 checkmate_2.0.0 broom_0.7.7
[49] inline_0.3.17 yaml_2.2.1 abind_1.4-5
[52] modelr_0.1.8 threejs_0.3.3 crosstalk_1.1.1
[55] backports_1.2.1 httpuv_1.5.5 rsconnect_0.8.18
[58] tensorA_0.36.2 tools_4.0.3 ellipsis_0.3.1
[61] posterior_1.0.1 ggridges_0.5.3 plyr_1.8.6
[64] base64enc_0.1-3 ps_1.5.0 prettyunits_1.1.1
[67] zoo_1.8-8 haven_2.3.1 fs_1.5.0
[70] data.table_1.14.0 ggdist_3.0.0 openxlsx_4.2.3
[73] colourpicker_1.1.0 reprex_1.0.0 tmvnsim_1.0-2
[76] mvtnorm_1.1-1 matrixStats_0.58.0 hms_1.0.0
[79] shinyjs_2.0.0 mime_0.10 evaluate_0.14
[82] arrayhelpers_1.1-0 xtable_1.8-4 shinystan_2.5.0
[85] rio_0.5.16 readxl_1.3.1 rstantools_2.1.1
[88] compiler_4.0.3 V8_3.4.2 crayon_1.4.1
[91] minqa_1.2.4 StanHeaders_2.21.0-7 htmltools_0.5.1.1
[94] mgcv_1.8-34 later_1.1.0.1 RcppParallel_5.1.4
[97] lubridate_1.7.10 DBI_1.1.1 dbplyr_2.1.0
[100] MASS_7.3-54 boot_1.3-27 Matrix_1.3-2
[103] car_3.0-10 cli_2.5.0 parallel_4.0.3
[106] insight_0.14.4 igraph_1.2.6 pkgconfig_2.0.3
[109] foreign_0.8-81 xml2_1.3.2 svUnit_1.0.6
[112] dygraphs_1.1.1.6 pbivnorm_0.6.0 estimability_1.3
[115] rvest_1.0.0 distributional_0.2.2 callr_3.7.0
[118] digest_0.6.27 rmarkdown_2.10 cellranger_1.1.0
[121] curl_4.3 shiny_1.6.0 gtools_3.8.2
[124] nloptr_1.2.2.2 lifecycle_1.0.0 nlme_3.1-152
[127] jsonlite_1.7.2 carData_3.0-4 fansi_0.4.2
[130] pillar_1.5.0 lattice_0.20-41 loo_2.4.1
[133] fastmap_1.1.0 httr_1.4.2 pkgbuild_1.2.0
[136] survival_3.2-11 glue_1.4.2 xts_0.12.1
[139] zip_2.1.1 shinythemes_1.2.0 pander_0.6.3
[142] stringi_1.5.3
如果您需要任何其他信息,或者如果我监督提供了某些信息,请告诉我!
非常感谢您的帮助,一切顺利。