bayes_parobs: Fit Bayesian Inference for Meta-Regression

View source: R/bayes_parobs.R

bayes_parobsR 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 Σ_{kt} are diagonal matrices with zero covariances. M2 indicates that Σ_{kt} are all equivalent but allowed to be full symmetric positive definite. M3 is where Σ_{kt} are allowed to differ across treatments, i.e., Σ_{kt}=Σ_t. M4 assumes thata the correlation matrix, ρ, is identical for all trials/treatments, but the variances are allowed to vary. Finally, M5 assumes a hierarchical model where (Σ_{kt} | Σ) follows an inverse-Wishart distribution with fixed degrees of freedom and scale matrix Σ. Σ 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 (k,t), or each arm of every trial.

fmodel

the model number. The possible values for fmodel are 1 to 5, each indicating a different prior specification for Σ_{kt}. It will default to M1, fmodel=1 if not specified at function call. See the following model descriptions. The objects enclosed in parentheses at the end of every bullet point are the hyperparameters associated with each model.

  • fmodel=1 - Σ_{kt} = diag(σ_{kt,11}^2,…,σ_{kt,JJ}^2) where σ_{kt,jj}^2 \sim IG(a_0,b_0) and IG(a,b) is the inverse-gamma distribution. This specification is useful if the user does not care about the correlation recovery. (c0, dj0, a0, b0, Omega0)

  • fmodel=2 - Σ_{kt}=Σ for every combination of `(k,t)` and Sig^{-1} ~ Wish(s0, Sigma0). This specification assumes that the user has prior knowledge that the correlation structure does not change across the arms included. (c0, dj0, s0, Omega0, Sigma0)

  • fmodel=3 - Σ_{kt}=Σ_t and Σ_t^{-1}\sim Wish_{s_0}(Σ_0). This is a relaxed version of fmodel=2, allowing the correlation structure to differ across trials but forcing it to stay identical within a trial. (c0, dj0, s0, Omega0, Sigma0)

  • fmodel=4 - Σ_{kt}=δ_{kt} ρ δ_{kt} where δ_{kt}=diag(Σ_{kt,11}^{1/2},…,Σ_{kt,JJ}^{1/2}), and ρ is the correlation matrix. This specification allows the variances to vary across arms but requires that the correlations be the same. This is due to the lack of correlation information in the data, which would in turn lead to the nonidentifiability of the correlations if they were allowed to vary. However, this still is an ambitious model which permits maximal degrees of freedom in terms of variance and correlation estimation. (c0, dj0, a0, b0, Omega0)

  • fmodel=5 - The fifth model is hierarchical and thus may require more data than the others: (Σ_{kt}^{-1}\mid Σ)\sim Wish_{ν_0}((ν_0-J-1)^{-1}Σ^{-1}) and Σ \sim Wish_{d_0}(Σ_0). Σ_{kt} encodes the within-treatment-arm variation while Σ captures the between-treatment-arm variation. The hierarchical structure allows the "borrowing of strength" across treatment arms. (c0, dj0, d0, nu0, Sigma0, Omega0)

prior

(Optional) a list of hyperparameters. Despite theta in every model, each fmodel, along with the group argument, requires a different set of hyperparameters. See fmodel for the model specifications.

mcmc

(Optional) a list for MCMC specification. ndiscard is the number of burn-in iterations. nskip configures the thinning of the MCMC. For instance, if nskip=5, bayes_parobs will save the posterior sample every 5 iterations. nkeep is the size of the posterior sample. The total number of iterations will be ndiscard + nskip * nkeep.

control

(Optional) a list of tuning parameters for the Metropolis-Hastings algorithm. Rho, R, and delta are sampled through either localized Metropolis algorithm or delayed rejection robust adaptive Metropolis algorithm. *_stepsize with the asterisk replaced with one of the names above specifies the stepsize for determining the sample evaluation points in the localized Metropolis algorithm. sample_Rho can be set to FALSE to suppress the sampling of Rho for fmodel=4. When sample_Rho is FALSE, ρ will be fixed using the value given by the init argument, which defaults to 0.5 I+0.511' where 1 is the vector of ones.

init

(Optional) a list of initial values for the parameters to be sampled: theta, gamR, Omega, and Rho. The initial value for Rho will be effective only if fmodel=4.

Treat_order

(Optional) a vector of unique treatments to be used for renumbering the Treat vector. The first element will be assigned treatment zero, potentially indicating placebo. If not provided, the numbering will default to an alphabetical/numerical order.

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 u_{kt}. If not provided, bayes_parobs will assume that there is no grouping and set u_{kt}=0 for all (k,t).

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. group_order will take effect only if group is provided by the user.

scale_x

(Optional) a logical variable indicating whether XCovariate should be scaled/standardized. The effect of setting this to TRUE is not limited to merely standardizing XCovariate. The following generic functions will scale the posterior sample of theta back to its original unit: plot, fitted, summary, and print.

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 on scale_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 on Treat_order, it may differ from the vector provided at function call.

  • Trial - the renumbered trial indicators. Depending on Trial_order, it may differ from the vector provided at function call.

  • group - the renumbered grouping indicators in the function call. Depending on group_order, it may differ from the vector provided at function call. If group was missing at function call, bayes_parobs will assign NULL for group.

  • TrtLabels - the vector of treatment labels corresponding to the renumbered Treat. This is equivalent to Treat_order if it was given at function call.

  • TrialLabels - the vector of trial labels corresponding to the renumbered Trial. This is equivalent to Trial_order if it was given at function call.

  • GroupLabels - the vector of group labels corresponding to the renumbered group. This is equivalent to group_order if it was given at function call. If group was missing at function call, bayes_parobs will assign NULL for GroupLabels.

  • K - the total number of trials.

  • T - the total number of treatments.

  • fmodel - the model number as described here.

  • scale_x - a Boolean indicating whether XCovariate 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)

metapack documentation built on May 31, 2022, 1:05 a.m.