bmeta_analyze {metapack} | R Documentation |
bmeta_analyze supersedes the previous two functions: bayes_parobs, bayes_nmr
Description
All other worker functions are superseded by this function, so that users can forget about the implementation details and focus on modeling. Meta-analytic data can be either aggregate or individual participant data (IPD). Aggregate data implies that the response consists of estimated effect sizes and their corresponding standard errors, whereas IPD is raw data. Data sets to be used for metapack should be formatted as follows:
Outcome | SD | DesignM1 | DesignM2 | Trial indicator (k ) | Treatment indicator (t ) | n |
y_{13} | S_{13} | x_{13} | w_{13} | 1 | 3 | 1000 |
y_{10} | S_{10} | x_{10} | w_{10} | 1 | 0 | 545 |
y_{20} | S_{20} | x_{20} | w_{20} | 2 | 0 | 1200 |
The first treatment indicator is intentionally selected to be 3, a number greater than 1, to indicate that this data format works for both meta-regression and network meta-regression. Meta-regression refers to when trials included have 2 treatments (i.e., t = 0, 1
for all k
), and the treatments are compared head to head. On the other hand, network meta-regression includes more than two treatments, where each trial can have a different set of treatments, allowing indirect comparison between treatments that are not compared head to head as long as consistency holds (see Higgins et al. (2012) for consistency).
bmeta_analyze()
and bmeta_analyse()
are synonyms.
Usage
bmeta_analyze(
formula,
data,
prior = list(),
mcmc = list(),
control = list(),
init = list()
)
bmeta_analyse(
formula,
data,
prior = list(),
mcmc = list(),
control = list(),
init = list()
)
Arguments
formula |
an object of class Formula: a symbolic description of the meta-analytic model to fit. For aggregate models, the vector of arm sample sizes must be provided using the function |
data |
a data frame, list, or environment (or an object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in |
prior |
an optional object that contains the hyperparameter values for the model. To see the complete list of hyperparameters for a specific model, refer to the corresponding worker function's help page, e.g.,
For network meta-analysis,
|
mcmc |
an optional object containing MCMC specification. |
control |
an optional object that contains the control tuning parameters for the Metropolis-Hastings algorithm. Similar to
|
init |
(Optional) a list of initial values for the parameters to be sampled. The following is the list of available parameters for meta-analysis and network meta-analysis.
The dimensions of the initial values must be conformable for matrix operations. If dimensions don't agree, |
Details
bmeta_analyze
currently subsumes two worker functions: bayes_parobs
and bayes_nmr
. bmeta_analyze
offers a formula interface.
All formulas are parsed using Formula. Formulas for bmeta_analyze
are constrained to have a strict structure: one or two LHS, and two or three RHS. That is, lhs_1 ~ rhs_1 | rhs2 | rhs3
or lhs_1 | lhs_2 ~ rhs_1 | rhs2 | rhs3
(see Examples for more). The tilde (~
) separates the LHS's and RHS's, each side further separated into parts by vertical bars (|
).
The meaning of each part is syntactically determined by its location inside the formula, like an English sentence. Therefore, all parts must come in the exact order as prescribed for bmeta_analyze
to correctly configure your model.
The first LHS, the responses, is required for all models.
The second LHS is only required for aggregate models, corresponding to the standard deviations of the responses.
The first RHS corresponds to fixed-effects covariates.
The second RHS corresponds to the variables in either the random-effects matrix (
w_{tk}' * \gamma_{k}
') for multivariate meta-analysis or modeling the variances (\log\tau_{tk}
=z_{tk}' * \phi
) for univariate network meta-analysis.The third RHS corresponds to the treatment and trial indicators, and optionally the grouping variable if it exists. The order must be
treat + trial + group
, ortreat + trial
if no grouping exists. Variables here must be supplied in the exact order described; otherwise, model will not be correctly identified.
Internally, bmeta_analyze
looks for three things: multivariate/univariate, meta-analyis/network meta-analysis, and aggregate/IPD.
multivariate/univariate: the dimension of the response is explicit in the formula, and determines univariate versus multivariate.
meta-analysis/network meta-analysis: the number of levels (
nlevels
) of treatments determines this. Iftreat
is not already a factor variable, it is coerced to one.aggregate/IPD:
bmeta_analyze
looks forns()
in the first RHS. Aggregate models must provide the arm sample sizes using the functionns()
(e.g., ifn
is the sample sizes,y1 + y2 | sd1 + sd2 ~ x1 + x2 + ns(n))
). If there is nons()
, IPD is assumed. Currently, IPD models are a work in progress and not supported yet.
Currently, only univariate/multivariate
+ meta-analysis
and univariate
+ network meta-analysis
are allowed. More models will be added in the future.
Value
bmeta_analyze
returns a classed object of bsynthesis
for Bayesian synthesis
Author(s)
Daeyoung Lim, daeyoung.lim@uconn.edu
References
Yao, H., Kim, S., Chen, M. H., Ibrahim, J. G., Shah, A. K., & Lin, J. (2015). Bayesian inference for multivariate meta-regression with a partially observed within-study sample covariance matrix. Journal of the American Statistical Association, 110(510), 528-544.
Li, H., Chen, M. H., Ibrahim, J. G., Kim, S., Shah, A. K., Lin, J., & Tershakovec, A. M. (2019). Bayesian inference for network meta-regression using multivariate random effects with applications to cholesterol lowering drugs. Biostatistics, 20(3), 499-516.
Li, H., Lim, D., Chen, M. H., Ibrahim, J. G., Kim, S., Shah, A. K., & Lin, J. (2021). Bayesian network meta-regression hierarchical models using heavy-tailed multivariate random effects with covariate-dependent variances. Statistics in Medicine.
See Also
bayes_parobs
for multivariate meta-analysis, and bayes_nmr
for univariate network meta-analysis.
Examples
set.seed(2797542)
data("cholesterol")
f_1 <- 'pldlc + phdlc + ptg | sdldl + sdhdl + sdtg ~ 0 + bldlc + bhdlc + btg +
age + durat + white + male + dm + ns(n) | treat | treat + trial + onstat'
out_1 <- bmeta_analyze(as.formula(f_1), data = cholesterol,
prior = list(model="NoRecovery"),
mcmc = list(ndiscard = 3, nskip = 1, nkeep = 1),
control=list(scale_x = TRUE, verbose=FALSE))
set.seed(2797542)
data("TNM")
TNM$group <- factor(match(TNM$treat, c("PBO", "R"), nomatch = 0))
f_2 <- 'ptg | sdtg ~
0 + bldlc + bhdlc + btg + age + white + male + bmi +
potencymed + potencyhigh + durat + ns(n) |
scale(bldlc) + scale(btg) + group | treat + trial'
out_2 <- bmeta_analyze(as.formula(f_2), data = TNM,
mcmc = list(ndiscard = 1, nskip = 1, nkeep = 1),
control=list(scale_x = TRUE, verbose=FALSE))