cace.meta.c {BayesCACE}R Documentation

Bayesian hierarchical models for CACE meta-analysis with complete compliance data


This function performs the Bayesian hierarchical model method for meta-analysis when the dataset has complete compliance information for all studies, as described in Section 2.2, "the Bayesian hierarchical model", of the package manuscript.


  param = c("CACE", "u1out", "v1out", "s1out", "b1out", "pic", "pin", "pia"),
  random.effects = list(),
  re.values = list(),
  model.code = "",
  digits = 3,
  n.adapt = 1000,
  n.iter = 1e+05,
  n.burnin = floor(n.iter/2),
  n.chains = 3,
  n.thin = max(1, floor((n.iter - n.burnin)/1e+05)),
  conv.diag = FALSE,
  mcmc.samples = FALSE,
  study.specific = FALSE



an input dataset with the same structure as the example data epidural_c, containing multiple rows referring to multiple studies in a meta-analysis.


a character string vector indicating the parameters to be tracked and estimated. By default the following parameters (see details) are included: \theta^{\mathrm{CACE}} (CACE), E(u_{i1}) (u1out), E(v_{i1}) (v1out), E(s_{i1}) (s1out), E(b_{i1}) (b1out), \pi_a (pia), \pi_n (pin), and \pi_c=1-\pi_a-\pi_n (pic). Users can modify the string vector to only include parameters of interest besides \theta^{\mathrm{CACE}}.


a list of logical values indicating whether random effects are included in the model. The list should contain the assignment for these parameters only: delta.n (\delta_{in}), delta.a (\delta_{ia}), delta.u (\delta_{iu}), delta.v (\delta_{iv}), delta.s (\delta_{is}), delta.b (\delta_{ib}), cor. The list should be in the form of list(delta.a = FALSE, cor = FALSE, ...). By default, this is an empty list, and all parameters are default to TRUE. Parameters that are not listed in the list are assumed to be TRUE. Note that \rho (cor) can only be included when both \delta_{in} (delta.n) and \delta_{ia} (delta.a) are set to TRUE. Otherwise, a warning occurs and the model continues running by forcing delta.n = TRUE and delta.a = TRUE.


a list of parameter values for the random effects. It should contain the assignment for these parameters only: alpha.n.m and alpha.n.s, which refer to the mean and standard deviation used in the normal distribution estimation of alpha.n, as well as alpha.a.m, alpha.a.s, alpha.s.m, alpha.s.s, alpha.b.m, alpha.b.s, alpha.u.m, alpha.u.s, alpha.v.m, alpha.v.s. It also contains the shape and rate parameters of the gamma distributions of the standard deviation variable of delta.n, delta.a, delta.u, delta.v delta.s, delta.b. The shape parameters are named as tau.n.h and tau.a.h, for example, and the rate parameters are named as tau.n.r and tau.a.r. You do not need to specify the shape and rate parameters if the corresponding random effect is set to FALSE in random.effects, since they will not be used anyways. By default, re.values is an empty list, and all the mean are set to 0, and alpha.n.s = alpha.a.s = 0.16, and alpha.s.s = alpha.b.s = alpha.u.s = alpha.v.s = 0.25, and the shape and rate parameters are default to 2.


a string representation of the model code; each line should be separated. Default to constructing model code using the model.meta.c function with the parameters that are inputted to this function. This parameter is only necessary if user wishes to make functional changes to the model code, such as changing the probability distributions of the parameters. Default to empty string.


number of digits. Default to 3.


adapt value. Default to 1000.


number of iterations. Default to 100000.


number of burn-in iterations. Default to n.iter/2.


number of chains. Default to 3.


thinning rate, must be a positive integer.

Default to max(1,floor((n.iter-n.burnin)/100000)).


whether or not to show convergence diagnostics. Default to FALSE.


whether to include JAGS samples in the final output. Default to FALSE.


a logical value indicating whether to calculate the study-specific \theta^{\mathrm{CACE}}_i. If TRUE, the model will first check the logical status of arguments delta.u and delta.v. If both are FALSE, meaning that neither response rate u_{i1} or v_{i1} is modeled with a random effect, then the study-specific \theta^{\mathrm{CACE}}_i is the same across studies. The function gives a warning and continues by making study.specific = FALSE. Otherwise, the study-specific \theta^{\mathrm{CACE}}_i are estimated and saved as the parameter cacei.


It returns a model object whose attribute type is cace.Bayes


Zhou J, Hodges JS, Suri MFK, Chu H (2019). “A Bayesian hierarchical model estimating CACE in meta-analysis of randomized clinical trials with noncompliance.” Biometrics, 75(3), 978–987.

Lunn D, Jackson C, Best N, Thomas A, Spiegelhalter D (2012). The BUGS book: A practical introduction to Bayesian analysis. CRC press.

Zeger SL, Liang K, Albert PS (1988). “Models for longitudinal data: a generalized estimating equation approach.” Biometrics, 1049–1060.

See Also, cace.meta.ic


data("epidural_c", package = "BayesCACE")
out.meta.c <- cace.meta.c(data = epidural_c, conv.diag = TRUE, 
mcmc.samples = TRUE, study.specific = TRUE)
# By calling the object smry from the output list out.meta.c, posterior estimates 
# (posterior mean, standard deviation, posterior median, 95\% credible interval, and 
# time-series standard error) are displayed.

[Package BayesCACE version 1.2.3 Index]