bayes_nmr {metapack} | R Documentation |
Fit Bayesian Network Meta-Regression Models
Description
This is a function the fits the model introduced in Bayesian Network Meta-Regression Models Using Heavy-Tailed Multivariate Random Effects with Covariate-Dependent Variances. The first seven arguments are required except ZCovariate
. If not provided, ZCovariate
will be assigned a vector of ones, rep(1, length(Outcome))
. ZCovariate
is the centerpiece of the modeling of variances and the heavy-tailed random effects distribution.
Usage
bayes_nmr(
Outcome,
SD,
XCovariate,
ZCovariate,
Treat,
Trial,
Npt,
prior = list(),
mcmc = list(),
control = list(),
init = list(),
Treat_order = NULL,
Trial_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. |
ZCovariate |
the aggregate covariates associated with the variance of the random effects. |
Treat |
the treatment identifiers for trial arm. This is equivalent to the arm labels in each study. The elements within will be coerced to consecutive integers |
Trial |
the study/trial identifiers. The elements within will be coerced to consecutive integers. |
Npt |
the number of observations/participants for a unique |
prior |
(Optional) a list of hyperparameters. The hyperparameters include |
mcmc |
(Optional) a list of MCMC specification. |
control |
(Optional) a list of 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 unique trials. The first element will be assigned trial 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 value indicating whether to print the progress bar during the MCMC sampling. |
Value
bayes_nmr
returns an object of class "bayesnmr"
. 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_nmr
.
An object of class bayesnmr
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. -
ZCovariate
- the aggregate design matrix for random effects.bayes_nmr
will assignrep(1, length(Outcome))
if it was not provided at function call. -
Trial
- the renumbered trial indicators. Depending onTrial_order
, it may differ from the vector provided at function call. -
Treat
- the renumbered treatment indicators. Depending onTreat_order
, it may differ from the vector provided at function call. -
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. -
K
- the total number of trials. -
nT
- the total number of treatments. -
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
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
bmeta_analyze
for using the Formula
interface
Examples
library(metapack)
data(TNM)
groupInfo <- list(c("PBO"), c("R"))
nz <- length(groupInfo)
ns <- nrow(TNM)
XCovariate <- model.matrix(~ 0 + bldlc + bhdlc + btg + age +
white + male + bmi + potencymed + potencyhigh + durat, data = TNM)
XCovariate <- scale(XCovariate, center = TRUE, scale = FALSE)
ZCovariate <- matrix(0, ns, nz)
for (j in 1:length(groupInfo)) {
for (i in 1:ns) {
if (TNM$treat[i] %in% groupInfo[[j]]) {
ZCovariate[i, j] <- 1
}
}
}
addz <- scale(cbind(TNM$bldlc, TNM$btg), center=TRUE, scale=TRUE)
ZCovariate <- cbind(1, ZCovariate, addz)
theta_init <- c(0.05113, -1.38866, 1.09817, -0.85855, -1.12056, -1.14133,
-0.22435, 3.63453, -2.09322, 1.07858, 0.80566, -40.76753,
-45.07127, -28.27232, -44.14054, -28.13203, -19.19989,
-47.21824, -51.31234, -48.46266, -47.71443)
set.seed(2797542)
fit <- bayes_nmr(TNM$ptg, TNM$sdtg, XCovariate, ZCovariate, TNM$treat,
TNM$trial, TNM$n, prior = list(c01 = 1.0e05, c02 = 4, df = 3),
mcmc = list(ndiscard = 1, nskip = 1, nkeep = 1),
init = list(theta = theta_init),
Treat_order = c("PBO", "S", "A", "L", "R", "P", "E", "SE",
"AE", "LE", "PE"),
scale_x = TRUE, verbose = FALSE)