mbnma.write: Write MBNMA dose-response model JAGS code

Description Usage Arguments Details Value Examples

View source: R/write.functions.R

Description

Writes JAGS code for a Bayesian time-course model for model-based network meta-analysis (MBNMA).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
mbnma.write(
  fun = "linear",
  beta.1 = "rel",
  beta.2 = NULL,
  beta.3 = NULL,
  beta.4 = NULL,
  method = "common",
  knots = 3,
  cor = TRUE,
  cor.prior = "wishart",
  var.scale = NULL,
  class.effect = list(),
  UME = FALSE,
  user.fun = NULL,
  likelihood = "binomial",
  link = NULL
)

Arguments

fun

A character vector specifying a functional form to be assigned to the dose-response. Options are given in details.

beta.1

Refers to dose-parameter(s) specified within the dose-response function(s). Can take either "rel", "common", "random", or be assigned a numeric value (see details).

beta.2

Refers to dose-parameter(s) specified within the dose-response function(s). Can take either "rel", "common", "random", or be assigned a numeric value (see details).

beta.3

Refers to dose-parameter(s) specified within the dose-response function(s). Can take either "rel", "common", "random", or be assigned a numeric value (see details).

beta.4

Refers to dose-parameter(s) specified within the dose-response function(s). Can take either "rel", "common", "random", or be assigned a numeric value (see details).

method

Can take either "common" or "random" to indicate whether relative effects should be modelled with between-study heterogeneity or not (see details).

knots

The number/location of knots if a restricted cubic spline dose-response function is fitted (fun="rcs"). If a single number is given it indicates the number of knots (they will be equally spaced across the range of doses). If a numeric vector is given it indicates the location of the knots. Minimum number of knots is 3.

cor

A boolean object that indicates whether correlation should be modelled between relative effect dose-response parameters (TRUE) or not (FALSE). This is automatically set to FALSE if class effects are modelled or if multiple dose-response functions are fitted.

cor.prior

NOT CURRENTLY IN USE - indicates the prior distribution to use for the correlation/covariance between relative effects. Must be kept as "wishart"

var.scale

A numeric vector indicating the relative scale of variances between correlated dose-response parameters when relative effects are modelled on more than one dose-response parameter and cor=TRUE (see details). Each element of the vector refers to the relative scale of each of the dose-response parameters that is modelled using relative effects.

class.effect

A list of named strings that determines which dose-response parameters to model with a class effect and what that effect should be ("common" or "random"). Element names should match dose-response parameter names (which will therefore depend on whether or not a wrapper function has been used for mbnma.run()). For example: list("beta.2"="fixed", "beta.3"="random") when using mbnma.run() or list("ed50"="fixed", "hill"="random") when using mbnma.emax.hill().

UME

A boolean object to indicate whether to fit an Unrelated Mean Effects model that does not assume consistency and so can be used to test if the consistency assumption is valid.

user.fun

A formula specifying any relationship including dose and one/several of: beta.1, beta.2, beta.3, beta.4.

likelihood

A string indicating the likelihood to use in the model. Can take either "binomial", "normal" or "poisson". If left as NULL the likelihood will be inferred from the data.

link

A string indicating the link function to use in the model. Can take any link function defined within JAGS (e.g. "logit", "log", "probit", "cloglog") or be assigned the value "identity" for and identity link function. If left as NULL the link function will be automatically assigned based on the likelihood.

Details

When relative effects are modelled on more than one dose-response parameter and cor = TRUE, correlation between the dose-response parameters is automatically estimated using a vague Wishart prior. This prior can be made slightly more informative by specifying the relative scale of variances between the dose-response parameters using var.scale. cor will automatically be set to FALSE if class effects are modelled or if a model is fitted with multiple dose-response functions.

Value

A single long character string containing the JAGS model generated based on the arguments passed to the function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Write model code for a model with an exponential dose-response function,
# relative effects modelled on the rate of growth/decay (beta.1) with a random
# effects model
model <- mbnma.write(fun="exponential",
             beta.1="rel",
             method="random",
             likelihood="binomial",
             link="logit"
             )
cat(model)

# Write model code for a model with an Emax dose-response function,
# relative effects modelled on Emax (beta.1) with a random effects model,
# a single parameter estimated for ED50 (beta.2) with a common effects model
model <- mbnma.write(fun="emax",
             beta.1="rel",
             beta.2="common",
             likelihood="normal",
             link="identity"
             )
cat(model)

# Write model code for a model with an Emax dose-response function,
# relative effects modelled on Emax (beta.1) and ED50 (beta.2).
# Class effects modelled on ED50 with common effects
model <- mbnma.write(fun="emax",
             beta.1="rel",
             beta.2="rel",
             likelihood="normal",
             link="identity",
             class.effect=list("beta.2"="common")
             )
cat(model)

# Write model code for a model with an Emax dose-response function,
# relative effects modelled on Emax (beta.1) and ED50 (beta.2) with a
# random effects model that automatically models a correlation between
# both parameters.
model <- mbnma.write(fun="emax",
             beta.1="rel",
             beta.2="rel",
             method="random",
             likelihood="normal",
             link="identity",
             )
cat(model)

MBNMAdose documentation built on Sept. 13, 2020, 5:08 p.m.