nma.model: Create Bugs Model for Arm-Level Data

View source: R/nma.model.R

nma.modelR Documentation

Create Bugs Model for Arm-Level Data

Description

Creates BUGS code which can be ran through nma.run().

Usage

nma.model(
  data = NULL,
  outcome,
  N = NULL,
  sd = NULL,
  reference,
  type = "consistency",
  time = NULL,
  family = NULL,
  link = NULL,
  effects,
  prior.mu = "DEFAULT",
  prior.d = "DEFAULT",
  prior.sigma = "DEFAULT",
  prior.beta = NULL,
  covariate = NULL
)

Arguments

data

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

outcome

A string indicating the name of your outcome variable.

N

A string indicating the name of the variable containing the number of participants in each arm.

sd

A string (only required for continuous outcomes) 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.

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. Options are: "binomial", "normal", "poisson".

link

The link function for the nma model. Options are "logit" (binomial family), "log" (binomial or poisson family), "cloglog" (binomial 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 standard deviation 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.

prior.beta

Optional string that defines the prior on the meta-regression coefficients. Options are "UNRELATED", "EXCHANGEABLE", "EQUAL" \insertCite@TSD3BUGSnet or a string of BUGS code.

covariate

Optional string indicating the name of the variable in your data set that you would like to adjust for via meta regression. By default, covariate=NULL and no covariate adjustment is applied. If the specified covariate is numeric then it will be centered for the analysis. If it is a character or factor then it will be treated as categorical. Currently only categorical variables with fewer than 3 levels are supported.

Details

For meta-regression, the prespecified prior choices for the regression coefficients \beta_{(1,2)},…,\beta_{(1,K)} are:

Unrelated:

iid t(0, u^2, 1)

Exchangeable:

iid N(b, \gamma^2), b ~ t(0, u^2, 1), \gamma ~ U(0,u)

Equal:

\beta_2=...=\beta_T=B, B ~ t(0, u^2, 1)

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.