ipdnma.model.onestage {bipd}R Documentation

Make an one-stage individual patient data network meta-analysis object containing data, priors, and a JAGS model code


This function sets up data and JAGS code that is needed to run one-stage IPD-NMA models in JAGS.


  y = NULL,
  study = NULL,
  treat = NULL,
  X = NULL,
  response = "normal",
  type = "random",
  shrinkage = "none",
  scale = TRUE,
  mean.alpha = 0,
  prec.alpha = 0.001,
  mean.beta = 0,
  prec.beta = 0.001,
  mean.gamma = 0,
  prec.gamma = 0.001,
  mean.delta = 0,
  prec.delta = 0.001,
  hy.prior = list("dhnorm", 0, 1),
  lambda.prior = NULL,
  p.ind = NULL,
  g = NULL,
  hy.prior.eta = NULL



outcome of the study. Can be continuous or binary.


vector indicating which study the patient belongs to. Please change the study names into numbers (i.e. 1, 2, 3, etc)


vector indicating which treatment the patient was assigned to. Since this is a network meta-analysis and there would be more than 2 treatments, careful naming of treatment is needed. This vector needs to be a sequence from 1:NT where NT is the total number of treatments. Treatment that is assigned 1 would be the baseline treatment.


matrix of covariate values for each patient. Dimension would be number of patients x number of covariates.


specification of the outcome type. Must specify either "normal" or "binomial".


assumption on the treatment effect: either "random" for random effects model or "fixed" for fixed effects model. Default is "random".


shrinkage method applied to the effect modifiers. "none" correspond to no shrinkage. "laplace" corresponds to a adaptive shrinkage with a Laplacian prior (ie often known as Bayesian LASSO). "SSVS" corresponds to the Stochastic Search Variable Selection method. SSVS is not strictly a shrinkage method, but pulls the estimated coefficient toward zero through variable selection in each iteration of the MCMC. See O'hara et al (2009) for more details.


indicator for scaling the covariates by the overall average; default is TRUE.


prior mean for the study intercept


prior precision for the study intercept


prior mean for the regression coefficients of the main effects of the covariates; main effects are assumed to have common effect.


prior precision for the regression coefficients of the main effects of the covariates


prior mean for the effect modifiers. This parameter is not used if penalization is placed on effect modifiers.


prior precision for the effect modifiers. This parameter is not used if penalization is placed on effect modifiers.


prior mean for the average treatment effect


prior precision for the average treatment effect


prior for the heterogeneity parameter. Supports uniform, gamma, and half normal for normal and binomial response It should be a list of length 3, where first element should be the distribution (one of dunif, dgamma, dhnorm) and the next two are the parameters associated with the distribution. For example, list("dunif", 0, 5) gives uniform prior with lower bound 0 and upper bound 5 for the heterogeneity parameter.


(only for shrinkage = "laplace") two options for laplace shrinkage. We can put a gamma prior on the lambda (i.e. list("dgamma",2,0.1)) or put a uniform prior on the inverse of lambda (i.e. list("dunif",0,5))


(only for shrinkage = "SSVS") prior probability of including each of the effect modifiers. Length should be same as the total length of the covariates.


(only for shrinkage = "SSVS") multiplier for the precision of spike. Default is g = 1000.


(only for shrinkage = "SSVS") standard deviation of the slab prior. Currently only support uniform distribution. Default is list("dunif", 0, 5)



data organized in a list so that it can be used when running code in JAGS


JAGS code that is used to run the model. Use cat(code) to see the code in a readable format


JAGS code in a function. This is used when running model in parallel


mean used in scaling covariates


standard deviation used in scaling covariates


Dias S, Sutton AJ, Ades AE, et al. A Generalized Linear Modeling Framework for Pairwise and Network Meta-analysis of Randomized Controlled Trials. Medical Decision Making. 2013;33(5):607-617. doi: 10.1177/0272989X12458724

O'Hara RB, Sillanpaa MJ. A review of Bayesian variable selection methods: what, how and which. Bayesian Anal. 2009;4(1):85-117. doi: 10.1214/09-BA403

Seo M, White IR, Furukawa TA, et al. Comparing methods for estimating patient-specific treatment effects in individual patient data meta-analysis. Stat Med. 2021;40(6):1553-1573. doi: 10.1002/sim.8859


ds <- generate_ipdnma_example(type = "continuous")
ipd <- with(ds, ipdnma.model.onestage(y = y, study = studyid, treat = treat, X = cbind(z1, z2), 
response = "normal", shrinkage = "none"))

samples <- ipd.run(ipd)
treatment.effect(ipd, samples, newpatient= c(1,0.5))

[Package bipd version 0.3 Index]