nma.model.shared: Create Bugs Model with Shared Parameters

View source: R/nma.model.shared.R

nma.model.sharedR Documentation

Create Bugs Model with Shared Parameters

Description

Creates BUGS code which can be run through nma.run(). Handles a combination of arm-level and contrast-level data.

Usage

nma.model.shared(
  data_arm = NULL,
  data_contrast = NULL,
  outcome,
  differences,
  N = NULL,
  sd.a = NULL,
  se.diffs = NULL,
  var.arm1 = NULL,
  reference,
  type = "consistency",
  time = NULL,
  family = NULL,
  link = NULL,
  effects,
  prior.mu = "DEFAULT",
  prior.d = "DEFAULT",
  prior.sigma = "DEFAULT"
)

Arguments

data_arm

A BUGSnetData object containing the data from arm-based trials produced by data.prep()

data_contrast

A BUGSnetData object containing the data from contrast-based trials produced by data.prep()

outcome

A string indicating the name of your outcome variable for arm-based studies.

differences

A string indicating the name of the differences (outcome) for contrast-based studies

N

A string indicating the name of the variable containing the number of participants in each arm for arm-based data

sd.a

A string (only required for continuous outcomes with arm-level data) indicating variable name of the standard deviation of the outcome. Standard errors should be converted to standard deviation by multiplying by the square root of the sample size prior to using this function.

se.diffs

A string indicating the variable name of the standard errors of the differences in data_contrast.

var.arm1

A string (only required for contrast-based continuous data in networks with multi-arm trials) indicating the variable name of the variance of the treatment in arm 1 in each study

reference

A string for the treatment that will be seen as the 'referent' comparator and labeled as treatment 1 in the BUGS code. This is often a placebo or control drug of some kind.

type

If type="inconsistency", an inconsistency model will be built. By default, type="consistency" and a consistency model is built. will be built.

time

A string (only required for binomial-cloglog or poisson-log models) indicating the name of variable indicating person-time followup (e.g person years) or study followup time.

family

A string indicating the family of the distribution of the outcome for arm-based trials. Options are: "binomial", "normal", "poisson"

link

The link function for the nma model for arm-based models. Options are "logit" (binomial family), "log" (binomial family), "cloglog" (poisson family), "identity" (normal family).

effects

A string indicating the type of treatment effect relative to baseline. Options are "fixed" or "random".

prior.mu

A string of BUGS code that defines priors on the baseline treatment effects. By default, independent normal priors are used with mean 0 and standard deviation 15u, where u is the largest maximum likelihood estimator in single trials \insertCite@see @gemtcBUGSnet.

prior.d

A string of BUGS code that defines define priors on relative treatment effects. By default, independent normal priors are used with mean 0 and standard deviation 15u, where u is the largest maximum likelihood estimator in single trials \insertCite@see @gemtcBUGSnet.

prior.sigma

A string of BUGS code that defines the prior on the variance of relative treatment effects. By default, a uniform distribution with range 0 to u is used, where u is the largest maximum likelihood estimator in single trials \insertCite@see @gemtcBUGSnet.

Value

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

bugs - A long character string containing BUGS code that will be run in jags.

data - The data used in the BUGS code.

scale - The scale of the outcome, based on the chosen family and link function examples are "Risk Ratio" (relative risk), "Odds Ratio", "Mean Difference", "Hazard Ratio"

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

...

References

\insertRef

gemtcBUGSnet

\insertRef

TSD3BUGSnet

See Also

data.prep, nma.run

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"
)
       
#Fixed effects, consistency model.
#Binomial family, cloglog link. This implies that the scale will be the Hazard Ratio.
diabetes.fe.c <- nma.model(
  data = diabetes.slr,
  outcome = "diabetes", 
  N = "n",
  reference = "Placebo",
  family = "binomial",
  link = "cloglog",
  effects = "fixed",
  type = "consistency",
  time = "followup"
)

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