RoBMA.reg | R Documentation |
RoBMA
is used to estimate a robust Bayesian
meta-regression. The interface allows a complete customization of
the ensemble with different prior (or list of prior) distributions
for each component.
RoBMA.reg(
formula,
data,
test_predictors = TRUE,
study_names = NULL,
study_ids = NULL,
transformation = if (any(colnames(data) != "y")) "fishers_z" else "none",
prior_scale = if (any(colnames(data) != "y")) "cohens_d" else "none",
standardize_predictors = TRUE,
effect_direction = "positive",
priors = NULL,
model_type = NULL,
rescale_priors = 1,
priors_effect = set_default_priors("effect", rescale = rescale_priors),
priors_heterogeneity = set_default_priors("heterogeneity", rescale = rescale_priors),
priors_bias = set_default_priors("bias", rescale = rescale_priors),
priors_effect_null = set_default_priors("effect", null = TRUE),
priors_heterogeneity_null = set_default_priors("heterogeneity", null = TRUE),
priors_bias_null = set_default_priors("bias", null = TRUE),
priors_hierarchical = set_default_priors("hierarchical"),
priors_hierarchical_null = set_default_priors("hierarchical", null = TRUE),
prior_covariates = set_default_priors("covariates", rescale = rescale_priors),
prior_covariates_null = set_default_priors("covariates", null = TRUE),
prior_factors = set_default_priors("factors", rescale = rescale_priors),
prior_factors_null = set_default_priors("factors", null = TRUE),
algorithm = "bridge",
chains = 3,
sample = 5000,
burnin = 2000,
adapt = 500,
thin = 1,
parallel = FALSE,
autofit = TRUE,
autofit_control = set_autofit_control(),
convergence_checks = set_convergence_checks(),
save = "all",
seed = NULL,
silent = TRUE,
...
)
formula |
a formula for the meta-regression model |
data |
a data.frame containing the data for the meta-regression. Note that the
column names have to correspond to the effect sizes ( |
test_predictors |
vector of predictor names to test for the presence
of moderation (i.e., assigned both the null and alternative prior distributions).
Defaults to |
study_names |
an optional argument with the names of the studies |
study_ids |
an optional argument specifying dependency between the
studies (for using a multilevel model). Defaults to |
transformation |
transformation to be applied to the supplied
effect sizes before fitting the individual models. Defaults to
|
prior_scale |
an effect size scale used to define priors. Defaults to |
standardize_predictors |
whether continuous predictors should be standardized prior to
estimating the model. Defaults to |
effect_direction |
the expected direction of the effect. Correctly specifying
the expected direction of the effect is crucial for one-sided selection models,
as they specify cut-offs using one-sided p-values. Defaults to |
priors |
named list of prior distributions for each predictor
(with names corresponding to the predictors). It allows users to
specify both the null and alternative hypothesis prior distributions
for each predictor by assigning the corresponding element of the named
list with another named list (with |
model_type |
string specifying the RoBMA ensemble. Defaults to |
rescale_priors |
a re-scaling factor for the prior distributions. The re-scaling
factor allows to adjust the width of all default priors simultaneously. Defaults to |
priors_effect |
list of prior distributions for the effect size ( |
priors_heterogeneity |
list of prior distributions for the heterogeneity |
priors_bias |
list of prior distributions for the publication bias adjustment
component that will be treated as belonging to the alternative hypothesis.
Defaults to |
priors_effect_null |
list of prior distributions for the effect size ( |
priors_heterogeneity_null |
list of prior distributions for the heterogeneity |
priors_bias_null |
list of prior weight functions for the |
priors_hierarchical |
list of prior distributions for the correlation of random effects
( |
priors_hierarchical_null |
list of prior distributions for the correlation of random effects
( |
prior_covariates |
a prior distributions for the regression parameter
of continuous covariates on the effect size under the alternative hypothesis
(unless set explicitly in |
prior_covariates_null |
a prior distributions for the regression parameter
of continuous covariates on the effect size under the null hypothesis
(unless set explicitly in |
prior_factors |
a prior distributions for the regression parameter
of categorical covariates on the effect size under the alternative hypothesis
(unless set explicitly in |
prior_factors_null |
a prior distributions for the regression parameter
of categorical covariates on the effect size under the null hypothesis
(unless set explicitly in |
algorithm |
a string specifying the algorithm used for the model averaging. Defaults to |
chains |
a number of chains of the MCMC algorithm. |
sample |
a number of sampling iterations of the MCMC algorithm.
Defaults to |
burnin |
a number of burnin iterations of the MCMC algorithm.
Defaults to |
adapt |
a number of adaptation iterations of the MCMC algorithm.
Defaults to |
thin |
a thinning of the chains of the MCMC algorithm. Defaults to
|
parallel |
whether the individual models should be fitted in parallel.
Defaults to |
autofit |
whether the model should be fitted until the convergence
criteria (specified in |
autofit_control |
allows to pass autofit control settings with the
|
convergence_checks |
automatic convergence checks to assess the fitted
models, passed with |
save |
whether all models posterior distributions should be kept
after obtaining a model-averaged result. Defaults to |
seed |
a seed to be set before model fitting, marginal likelihood
computation, and posterior mixing for reproducibility of results. Defaults
to |
silent |
whether all print messages regarding the fitting process
should be suppressed. Defaults to |
... |
additional arguments. |
The vignette("/MetaRegression", package = "RoBMA")
vignette describes how to use RoBMA.reg()
function to fit Bayesian meta-regression ensembles. See
\insertCitebartos2023robust;textualRoBMA for more details about the methodology and
RoBMA()
for more details about the function options. By default, the function standardizes
continuous predictors. As such, the output should be interpreted as standardized meta-regression
coefficients.
The RoBMA.reg function first generates models from a combination of the provided priors for each of the model parameters. Then, the individual models are fitted using autorun.jags function. A marginal likelihood is computed using bridge_sampler function. The individual models are then combined into an ensemble using the posterior model probabilities using BayesTools package.
Generic summary.RoBMA()
, print.RoBMA()
, and plot.RoBMA()
functions are
provided to facilitate manipulation with the ensemble. A visual check of the
individual model diagnostics can be obtained using the diagnostics()
function.
The fitted model can be further updated or modified by update.RoBMA()
function.
Estimated marginal means can be computed by marginal_summary()
function and
visualized by the marginal_plot()
function.
RoBMA.reg
returns an object of class 'RoBMA.reg'.
RoBMA()
summary.RoBMA()
, update.RoBMA()
, check_setup.reg()
## Not run:
# using the example data from Andrews et al. (2021) and reproducing the example from
# Bartos et al. (2024) with measure and age covariate.
# note the the Andrews2021 data.frame columns identify the effect size "r" and
# the standard error "se" of the effect size that are used to estimate the model
fit_RoBMA <- RoBMA.reg(~ measure + age, data = Andrews2021, parallel = TRUE, seed = 1)
# summarize the results
summary(fit_RoBMA, output_scale = "r")
# compute effect size estimates for each group
marginal_summary(fit_RoBMA, output_scale = "r")
# visualize the effect size estimates for each group
marginal_plot(fit_RoBMA, parameter = "measure", output_scale = "r", lwd = 2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.