Fits random- and fixed-effects meta-anayses and performs Bayesian model averaging for H1 (d != 0) vs. H0 (d = 0).
meta_bma(y, SE, labels, data, d = prior("norm", c(mean = 0, sd = 0.3)),
tau = prior("invgamma", c(shape = 1, scale = 0.15)),
rscale_contin = 1/2, rscale_discrete = sqrt(2)/2, centering = TRUE,
prior = c(1, 1, 1, 1), logml = "integrate", summarize = "stan",
ci = 0.95, rel.tol = .Machine$double.eps^0.3, logml_iter = 5000,
silent_stan = TRUE, ...)
effect size per study. Can be provided as (1) a numeric vector, (2)
the quoted or unquoted name of the variable in data
, or (3) a
formula
to include discrete or continuous moderator
variables.
standard error of effect size for each study. Can be a numeric
vector or the quoted or unquoted name of the variable in data
optional: character values with study labels. Can be a
character vector or the quoted or unquoted name of the variable in
data
data frame containing the variables for effect size y
,
standard error SE
, labels
, and moderators per study.
prior
distribution on the average effect size \(d\). The
prior probability density function is defined via prior
.
prior
distribution on the between-study heterogeneity
\(\tau\) (i.e., the standard deviation of the study effect sizes
dstudy
in a random-effects meta-analysis. A (nonnegative) prior
probability density function is defined via prior
.
scale parameter of the JZS prior for the continuous covariates.
scale parameter of the JZS prior for discrete moderators.
whether continuous moderators are centered.
prior probabilities over models (possibly unnormalized) in the
order c(fixed_H0, fixed_H1, random_H0, random_H1)
. For instance, if
we expect fixed effects to be two times as likely as random effects and H0
and H1 to be equally likely: prior = c(2,2,1,1)
.
how to estimate the log-marginal likelihood: either by numerical
integration ("integrate"
) or by bridge sampling using MCMC/Stan
samples ("stan"
). To obtain high precision with logml="stan"
,
many MCMC samples are required (e.g., iter=10000, warmup=1000
).
how to estimate parameter summaries (mean, median, SD,
etc.): Either by numerical integration (summarize = "integrate"
) or
based on MCMC/Stan samples (summarize = "stan"
).
probability for the credibility/highest-density intervals.
relative tolerance used for numerical integration using
integrate
. Use rel.tol=.Machine$double.eps
for
maximal precision (however, this might be slow).
number of iterations from the posterior of d and tau
for computing the marginal likelihood for the random-effects model with bridge sampling.
Note that the argument iter=2000
controls the number of iterations
for parameter estimation of the random effects.
whether to suppress the Stan progress bar.
further arguments passed to rstan::sampling
(see
stanmodel-method-sampling
). For instance:
warmup=500
, chains=4
, control=list(adapt_delta=.95)
).
Bayesian model averaging for four meta-analysis models: Fixed- vs. random-effects and H0 (\(d=0\)) vs. H1 (e.g., \(d>0\)).
By default, the log-marginal likelihood is computed by numerical integration. This is relatively fast and gives precise, reproducible results. However, for extreme priors or data, this might be robust. Hence, as an alternative, the log-marginal likelihood can be estimated using MCMC/Stan samples and bridge sampling.
Note that the same two options are available to obtain summary statistics of the posterior distributions of the average effect size \(d\) and the heterogeneity parameter \(tau\).
Gronau, Q. F., Erp, S. V., Heck, D. W., Cesario, J., Jonas, K. J., & Wagenmakers, E.-J. (2017). A Bayesian model-averaged meta-analysis of the power pose effect with informed and default priors: the case of felt power. Comprehensive Results in Social Psychology, 2(1), 123-138. https://doi.org/10.1080/23743603.2017.1326760
# NOT RUN {
# Note: The following example optimizes speed (for CRAN checks).
# The settings are not suitable for actual data analysis!
data(towels)
set.seed(123)
mb <- meta_bma(logOR, SE, study, towels,
d = prior("norm", c(mean=0, sd=.3), lower=0),
tau = prior("invgamma", c(shape = 1, scale = 0.15)),
rel.tol = .Machine$double.eps^.15, iter=1000)
mb
plot_posterior(mb, "d")
# }
Run the code above in your browser using DataCamp Workspace