I am conducting a meta-analysis using the proportion of accuracy on a specific test (0-1: mean of test scores / max test score) as effect sizes by using the Brms package in R. I would like to know how to obtain the predictions that are bounded between 0 and 1.
I started with the code something like this:
fit <- brm(proportion|se(SE) ~ task + predictor2 + (1|study/id),
data = df,
family = gaussian)
SE
is SE for proportion, calculated based on the SD for test scores divided by the maximum test score. task
is a categorical variable referring to a type of task. predictor2
is a numerical variable that potentially relates to accuracy.
However, I soon realized that when I obtained the median of the predictions for different task types with prediction()
, the predicted values sometimes go outside of 0 and 1 for some combinations of task
and predictor2
. Similarly, the prediction interval includes values outside 0-1.
newdata <-
data.frame(type = c("A",
"B",
"C",
"D",
"E"),
SE = rep(SE_median, 5),
predictor2 = rep(0,5))
predict(res.immediate.meaning.recall, newdata = newdata,
re_formula = NULL,
probs = c(.2,.8),
sample_new_levels = "uncertainty",
allow_new_levels = TRUE,
summary = T,
robust = T) %>%
round(3)
I tried to specify the Beta distribution for a response variable. However, I got an error saying
Error: Argument ‘se’ is not supported for family 'beta(logit)’
Is there any way that I can specify the beta distribution (or other alternative distribution) for this response variable?
If not, how could I deal with this issue and obtain more accurate predictions and prediction intervals?
Thank you very much for your help.
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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] bayestestR_0.13.0 tidybayes_3.0.2 brms_2.18.0 Rcpp_1.0.10
[5] ggpubr_0.6.0 kableExtra_1.3.4 sjPlot_2.8.12 extrafont_0.19
[9] MuMIn_1.47.1 pipeR_0.6.1.3 clubSandwich_0.5.8 forcats_1.0.0
[13] stringr_1.5.0 dplyr_1.1.0 purrr_1.0.1 readr_2.1.3
[17] tidyr_1.3.0 tibble_3.1.8 tidyverse_1.3.2 ggrepel_0.9.2
[21] ggplot2_3.4.0 metafor_3.8-1 metadat_1.2-0 Matrix_1.5-3
[25] readxl_1.4.1
loaded via a namespace (and not attached):
[1] backports_1.4.1 systemfonts_1.0.4 plyr_1.8.8 igraph_1.3.5
[5] svUnit_1.0.6 splines_4.2.2 crosstalk_1.2.0 TH.data_1.1-1
[9] rstantools_2.2.0 inline_0.3.19 digest_0.6.31 htmltools_0.5.4
[13] fansi_1.0.4 magrittr_2.0.3 checkmate_2.1.0 googlesheets4_1.0.1
[17] tzdb_0.3.0 modelr_0.1.10 RcppParallel_5.1.6 matrixStats_0.63.0
[21] xts_0.12.2 sandwich_3.0-2 extrafontdb_1.0 svglite_2.1.1
[25] timechange_0.2.0 prettyunits_1.1.1 colorspace_2.1-0 rvest_1.0.3
[29] ggdist_3.2.1 haven_2.5.1 xfun_0.37 callr_3.7.3
[33] crayon_1.5.2 jsonlite_1.8.4 lme4_1.1-31 survival_3.5-0
[37] zoo_1.8-11 glue_1.6.2 gtable_0.3.1 gargle_1.3.0
[41] emmeans_1.8.4-1 webshot_0.5.4 sjstats_0.18.2 sjmisc_2.8.9
[45] distributional_0.3.1 car_3.1-1 pkgbuild_1.4.0 Rttf2pt1_1.3.12
[49] rstan_2.21.8 abind_1.4-5 scales_1.2.1 mvtnorm_1.1-3
[53] DBI_1.1.3 rstatix_0.7.2 ggeffects_1.1.5 miniUI_0.1.1.1
[57] viridisLite_0.4.1 xtable_1.8-4 performance_0.10.2 HDInterval_0.2.4
[61] DT_0.27 stats4_4.2.2 StanHeaders_2.21.0-7 htmlwidgets_1.6.1
[65] datawizard_0.6.5 httr_1.4.4 threejs_0.3.3 arrayhelpers_1.1-0
[69] posterior_1.3.1 ellipsis_0.3.2 pkgconfig_2.0.3 loo_2.5.1
[73] farver_2.1.1 dbplyr_2.3.0 utf8_1.2.3 reshape2_1.4.4
[77] later_1.3.0 tidyselect_1.2.0 labeling_0.4.2 rlang_1.0.6
[81] munsell_0.5.0 cellranger_1.1.0 tools_4.2.2 cli_3.6.0
[85] generics_0.1.3 sjlabelled_1.2.0 broom_1.0.3 mathjaxr_1.6-0
[89] evaluate_0.20 fastmap_1.1.0 processx_3.8.0 knitr_1.42
[93] fs_1.6.0 nlme_3.1-162 mime_0.12 xml2_1.3.3
[97] shinythemes_1.2.0 compiler_4.2.2 bayesplot_1.10.0 rstudioapi_0.14
[101] ggsignif_0.6.4 reprex_2.0.2 stringi_1.7.12 ps_1.7.2
[105] Brobdingnag_1.2-9 lattice_0.20-45 markdown_1.5 nloptr_2.0.3
[109] shinyjs_2.1.0 tensorA_0.36.2 vctrs_0.5.2 pillar_1.8.1
[113] lifecycle_1.0.3 bridgesampling_1.1-2 estimability_1.4.1 insight_0.19.0
[117] httpuv_1.6.8 R6_2.5.1 promises_1.2.0.1 gridExtra_2.3
[121] codetools_0.2-19 gtools_3.9.4 colourpicker_1.2.0 boot_1.3-28.1
[125] MASS_7.3-58.2 assertthat_0.2.1 withr_2.5.0 shinystan_2.6.0
[129] multcomp_1.4-20 parallel_4.2.2 hms_1.1.2 grid_4.2.2
[133] coda_0.19-4 minqa_1.2.5 rmarkdown_2.20 carData_3.0-5
[137] googledrive_2.0.0 base64enc_0.1-3 shiny_1.7.4 lubridate_1.9.1
[141] dygraphs_1.1.1.6