Learn R Programming

MBNMAdose (version 0.4.1)

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

Description

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

Usage

mbnma.write(
  fun = dloglin(),
  method = "common",
  cor = TRUE,
  cor.prior = "wishart",
  omega = NULL,
  om = list(rel = 5, abs = 10),
  class.effect = list(),
  UME = FALSE,
  likelihood = "binomial",
  link = NULL
)

Value

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

Arguments

fun

An object of class("dosefun") that specifies a functional form to be assigned to the dose-response. 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).

cor

A boolean object that indicates whether correlation should be modelled between relative effect dose-response parameters. 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"

omega

A scale matrix for the inverse-Wishart prior for the covariance matrix used to model the correlation between dose-response parameters (see Details for dose-response functions). omega must be a symmetric positive definite matrix with dimensions equal to the number of dose-response parameters modelled using relative effects ("rel"). If left as NULL (the default) a diagonal matrix with elements equal to 1 is used.

om

a list with two elements that report the maximum relative ("rel") and maximum absolute ("abs") efficacies on the link scale.

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. Note that assuming class effects on some dose-response parameters may be unreasonable if the range of doses differ substantially across agents within a class.

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.

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"), be assigned the value "identity" for an identity link function, or be assigned the value "smd" for modelling Standardised Mean Differences using an 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 omega. cor will automatically be set to FALSE if class effects are modelled.

Examples

Run this code
# Write model code for a model with an exponential dose-response function,
# with random treatment effects
model <- mbnma.write(fun=dexp(),
             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 with a random effects model,
# a single parameter estimated for ED50 with a common effects model
model <- mbnma.write(fun=demax(emax="rel", ed50="common"),
             likelihood="normal",
             link="identity"
             )
cat(model)

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

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

Run the code above in your browser using DataLab