Converts MBNMA data frame to a list for use in JAGS model

getjagsdata(
  data.ab,
  class = FALSE,
  sdscale = FALSE,
  regress = NULL,
  regress.effect = "common",
  likelihood = check.likelink(data.ab)$likelihood,
  link = check.likelink(data.ab)$link,
  level = "agent",
  fun = NULL,
  nodesplit = NULL
)

Arguments

data.ab

A data frame of arm-level data in "long" format containing the columns:

  • studyID Study identifiers

  • dose Numeric data indicating the dose (must take positive values)

  • agent Agent identifiers (can be numeric, factor or character)

  • y Numeric data indicating the aggregate response for a continuous outcome. Required for continuous data.

  • se Numeric data indicating the standard error for a given observation. Required for continuous data.

  • r Numeric data indicating the number of responders within a study arm. Required for binomial or poisson data.

  • n Numeric data indicating the total number of participants within a study arm. Required for binomial data or when modelling Standardised Mean Differences

  • E Numeric data indicating the total exposure time for participants within a study arm. Required for poisson data.

  • class An optional column indicating a particular class code. Agents with the same identifier must also have the same class code.

  • standsd An optional column of numeric data indicating reference SDs used to standardise treatment effects when modelling using Standardised Mean Differences (SMD).

class

A boolean object indicating whether or not data.ab contains information on different classes of treatments

sdscale

Logical object to indicate whether to write a model that specifies a reference SD for standardising when modelling using Standardised Mean Differences. Specifying sdscale=TRUE will therefore only modify the model if link function is set to SMD (link="smd").

regress

A formula of effect modifiers (variables that interact with the treatment effect) to incorporate using Network Meta-Regression (E.g. ~ Population + Age). All variables in the formula are modelled as interacting with the treatment effect (i.e. prognostic variables cannot be included in this way). Effects modifiers must be named variables in network$data.ab and must be identical within a study. Factor and character effect modifiers will be converted to a series of named dummy variables.

regress.effect

Indicates whether effect modification should be assumed to be "common" (assumed to be equal versus Placebo throughout the network), "random" (assumed to be exchangeable versus Placebo throughout the network), "agent" (assumed to be equal versus Placebo within each agent), or "class" (assumed to be equal versus Placebo within each class).

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.

level

Can take either "agent" to indicate that data should be at the agent- level (for MBNMA) or "treatment" to indicate that data should be at the treatment- level (for NMA)

fun

An object of class("dosefun") that specifies a functional form to be assigned to the dose-response. See Details.

nodesplit

A numeric vector of length 2 containing treatment codes on which to perform an MBNMA nodesplit (see mbnma.nodesplit).

Value

A named list of numbers, vector, matrices and arrays to be sent to JAGS. List elements are:

  • If likelihood="normal":

    • y An array of mean responses for each arm within each study

    • se An array of standard errors for each arm within each study

  • If likelihood="binomial":

    • r An array of the number of responses/count for each each arm within each study

    • n An array of the number of participants for each arm within each study

  • If likelihood="poisson":

    • r An array of the number of responses/count for each each arm within each study

    • E An array of the total exposure time for each arm within each study

  • dose A matrix of doses for each arm within each study (if level="agent")

  • narm A numeric vector with the number of arms per study

  • NS The total number of studies in the dataset

  • Nagent The total number of agents in the dataset (if level="agent")

  • agent A matrix of agent codes within each study (if level="agent")

  • NT The total number of treatment in the dataset (if level="treatment")

  • treatment A matrix of treatment codes within each study (if level="treatment")

  • Nclass Optional. The total number of classes in the dataset

  • class Optional. A matrix of class codes within each study

  • classkey Optional. A vector of class codes that correspond to agent codes. Same length as the number of agent codes.

  • split.ind Optional. A matrix indicating whether a specific arm contributes evidence to a nodesplit comparison.

Examples

# Using the triptans headache dataset
network <- mbnma.network(triptans)
#> Values for `agent` with dose = 0 have been recoded to `Placebo`
#> agent is being recoded to enforce sequential numbering
jagsdat <- getjagsdata(network$data.ab, likelihood="binomial", link="logit")


# Get JAGS data with class
netclass <- mbnma.network(osteopain)
#> Values for `agent` with dose = 0 have been recoded to `Placebo`
#> agent is being recoded to enforce sequential numbering
#> Values for `class` with dose = 0 have been recoded to `Placebo`
#> class is being recoded to enforce sequential numbering
jagsdat <- getjagsdata(netclass$data.ab, class=TRUE)


# Get JAGS data at the treatment level for split Network Meta-Analysis
network <- mbnma.network(triptans)
#> Values for `agent` with dose = 0 have been recoded to `Placebo`
#> agent is being recoded to enforce sequential numbering
jagsdat <- getjagsdata(network$data.ab, level="treatment")