bayes_parobs {metapack} | R Documentation |
Fit Bayesian Inference for Meta-Regression
Description
This is a function for running the Markov chain Monte Carlo algorithm for the Bayesian inference for multivariate meta-regression with a partially observed within-study sample covariance matrix model. The first six arguments are required.
fmodel can be one of 5 numbers: 1, 2, 3, 4, and 5. The first model, fmodel = 1 denoted by M1, indicates that the \Sigma_{kt}
are diagonal matrices with zero covariances. M2 indicates that \Sigma_{kt}
are all equivalent but allowed to be full symmetric
positive definite. M3 is where \Sigma_{kt}
are allowed to differ across treatments, i.e., \Sigma_{kt}=\Sigma_t
.
M4 assumes thata the correlation matrix, \rho
, is identical for all trials/treatments, but the variances are allowed to vary.
Finally, M5 assumes a hierarchical model where (\Sigma_{kt} | \Sigma)
follows an inverse-Wishart distribution with fixed
degrees of freedom and scale matrix \Sigma
. \Sigma
then follows another inverse-Wishart distribution with fixed parameters.
Usage
bayes_parobs(
Outcome,
SD,
XCovariate,
WCovariate,
Treat,
Trial,
Npt,
fmodel = 1,
prior = list(),
mcmc = list(),
control = list(),
init = list(),
Treat_order = NULL,
Trial_order = NULL,
group = NULL,
group_order = NULL,
scale_x = FALSE,
verbose = FALSE
)
Arguments
Outcome |
the aggregate mean of the responses for each arm of every study. |
SD |
the standard deviation of the responses for each arm of every study. |
XCovariate |
the aggregate covariates for the fixed effects. |
WCovariate |
the aggregate covariates for the random effects. |
Treat |
the treatment identifiers. This is equivalent to the arm number of each study. The number of unique treatments must be equal across trials. The elements within will be coerced to consecutive integers. |
Trial |
the trial identifiers. This is equivalent to the arm labels in each study. The elements within will be coerced to consecutive integers |
Npt |
the number of observations/participants for a unique |
fmodel |
the model number. The possible values for
|
prior |
(Optional) a list of hyperparameters. Despite |
mcmc |
(Optional) a list for MCMC specification. |
control |
(Optional) a list of tuning parameters for the Metropolis-Hastings algorithm. |
init |
(Optional) a list of initial values for the parameters to be sampled: |
Treat_order |
(Optional) a vector of unique treatments to be used for renumbering the |
Trial_order |
(Optional) a vector of unique trials. The first element will be assigned zero. If not provided, the numbering will default to an alphabetical/numerical order. |
group |
(Optional) a vector containing binary variables for |
group_order |
(Optional) a vector of unique group labels. The first element will be assigned zero. If not provided, the numbering will default to an alphabetical/numerical order. |
scale_x |
(Optional) a logical variable indicating whether |
verbose |
(Optional) a logical variable indicating whether to print the progress bar during the MCMC sampling. |
Value
bayes_parobs
returns an object of class "bayesparobs"
. The functions summary
or print
are used to obtain and print a summary of the results. The generic accessor function fitted
extracts the posterior mean, posterior standard deviation, and the interval estimates of the value returned by bayes_parobs
.
An object of class bayesparobs
is a list containing the following components:
-
Outcome
- the aggregate response used in the function call. -
SD
- the standard deviation used in the function call. -
Npt
- the number of participants for(k,t)
used in the function call. -
XCovariate
- the aggregate design matrix for fixed effects used in the function call. Depending onscale_x
, this may differ from the matrix provided at function call. -
WCovariate
- the aggregate design matrix for random effects. -
Treat
- the renumbered treatment indicators. Depending onTreat_order
, it may differ from the vector provided at function call. -
Trial
- the renumbered trial indicators. Depending onTrial_order
, it may differ from the vector provided at function call. -
group
- the renumbered grouping indicators in the function call. Depending ongroup_order
, it may differ from the vector provided at function call. Ifgroup
was missing at function call,bayes_parobs
will assignNULL
forgroup
. -
TrtLabels
- the vector of treatment labels corresponding to the renumberedTreat
. This is equivalent toTreat_order
if it was given at function call. -
TrialLabels
- the vector of trial labels corresponding to the renumberedTrial
. This is equivalent toTrial_order
if it was given at function call. -
GroupLabels
- the vector of group labels corresponding to the renumberedgroup
. This is equivalent togroup_order
if it was given at function call. Ifgroup
was missing at function call,bayes_parobs
will assignNULL
forGroupLabels
. -
K
- the total number of trials. -
T
- the total number of treatments. -
fmodel
- the model number as described here. -
scale_x
- a Boolean indicating whetherXCovariate
has been scaled/standardized. -
prior
- the list of hyperparameters used in the function call. -
control
- the list of tuning parameters used for MCMC in the function call. -
mcmctime
- the elapsed time for the MCMC algorithm in the function call. This does not include all the other preprocessing and post-processing outside of MCMC. -
mcmc
- the list of MCMC specification used in the function call. -
mcmc.draws
- the list containing the MCMC draws. The posterior sample will be accessible here.
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.
See Also
bmeta_analyze
for using the Formula
interface
Examples
library(metapack)
data("cholesterol")
Outcome <- model.matrix(~ 0 + pldlc + phdlc + ptg, data = cholesterol)
SD <- model.matrix(~ 0 + sdldl + sdhdl + sdtg, data = cholesterol)
Trial <- cholesterol$trial
Treat <- cholesterol$treat
Npt <- cholesterol$n
XCovariate <- model.matrix(~ 0 + bldlc + bhdlc + btg + age + durat +
white + male + dm, data = cholesterol)
WCovariate <- model.matrix(~ treat, data = cholesterol)
fmodel <- 1
set.seed(2797542)
fit <- bayes_parobs(Outcome, SD, XCovariate, WCovariate, Treat, Trial,
Npt, fmodel, mcmc = list(ndiscard = 1, nskip = 1, nkeep = 1),
scale_x = TRUE, group = cholesterol$onstat, verbose = FALSE)