# NOT RUN {
# run examples only if the needed packages are available
if (all(unlist(lapply(
c("metaplus", "metafor", "metaBMA"), # needed packages
require,
character.only = TRUE,
quietly = TRUE,
warn.conflicts = FALSE
)))) {
# note that the `print` calls below are not necessary for you to write
# they are in the documentation so that the website renders them
# setup
set.seed(123)
library(statsExpressions)
options(tibble.width = Inf, pillar.bold = TRUE, pillar.neg = TRUE)
# renaming to what `statsExpressions` expects
df <- dplyr::rename(mag, estimate = yi, std.error = sei)
# ----------------------- parametric ---------------------------------------
print(meta_analysis(data = df))
# ----------------------- random -----------------------------------------
print(meta_analysis(
data = df,
type = "random",
random = "normal"
))
# ----------------------- Bayes Factor -----------------------------------
meta_analysis(
data = df,
type = "bayes",
# additional arguments given to `metaBMA`
iter = 5000,
summarize = "integrate",
control = list(adapt_delta = 0.99, max_treedepth = 15)
)
}
# }
Run the code above in your browser using DataLab