nma.run: Run NMA model

View source: R/nma.run.R

nma.runR Documentation

Run NMA model

Description

Takes bugs code from an object produced by nma.model and runs model using jags.

Usage

nma.run(
  model,
  monitor = "DEFAULT",
  DIC = TRUE,
  n.adapt = 1000,
  n.burnin = floor(n.iter/2),
  n.iter,
  thin = 1,
  n.chains = 3,
  inits = "DEFAULT"
)

Arguments

model

A BUGSnetModel object produced by running nma.model.

monitor

A vector of all variables that you would like to monitor. Default is "DEFAULT" which will monitor the relative treatment effects d as well as sigma when a random effects model is used and the regression coefficients beta when meta-regression is used.

DIC

Default is TRUE and nodes required to calculate the DIC and other fit statistics are monitored. Otherwise you may set it to FALSE.

n.adapt

Number of adaptations for the mcmc chains.

n.burnin

Number of burnin iterations for the mcmc chains.

n.iter

Number of iterations for the mcmc chains.

thin

Thinning factor for the mcmc chains. Default is 1.

n.chains

Number of mcmc chains. Default is 3.

inits

Specifies initial values and random number generator options for each chain. The "DEFAULT" option uses the R random seed to set the JAGS random seeds. Non-default options are passed directly to jags.model. In order to use the JAGS default initialization, set inits to NULL. See jags.model for more info.

Value

nma.run returns an object of class BUGSnetRun which is a list containing the following components:

samples - The MCMC samples produced by running the BUGS model.

model - The BUGSnetModel object obtained from nma.model which was used to run jags.

scale - The scale of the outcome, based on the chosen family and link function.

trt.key - Treatments mapped to numbers, used to run BUGS code.

family - Family that was used for the NMA model (e.g normal, binomial, poisson)

link - Link function that was used for the NMA model (e.g normal, binomial, poisson)

See Also

nma.model, nma.fit, nma.league, nma.rank, nma.forest, nma.regplot, nma.trace, jags.model

Examples

data(diabetes.sim)

diabetes.slr <- data.prep(
  arm.data = diabetes.sim, 
  varname.t = "Treatment", 
  varname.s = "Study"
)

#Random effects, consistency model.
#Binomial family, cloglog link. This implies that the scale will be the Hazard Ratio.
diabetes.re.c <- nma.model(
  data = diabetes.slr,
  outcome = "diabetes", 
  N = "n",
  reference = "Placebo",
  family = "binomial",
  link = "cloglog",
  effects = "random",
  type = "consistency",
  time = "followup"
)
 
diabetes.re.c.res <- nma.run(
  model = diabetes.re.c,
  n.adapt = 100,
  n.burnin = 0,
  n.iter = 100
)

audrey-b/BUGSnet documentation built on Feb. 2, 2025, 5:10 p.m.