getjagsdata: Prepares data for JAGS

Description Usage Arguments Value Examples

View source: R/prepare.functions.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
getjagsdata(
  data.ab,
  class = FALSE,
  likelihood = "binomial",
  link = "logit",
  level = "agent",
  fun = NULL,
  nodesplit = NULL,
  knots = 3
)

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

  • 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.

class

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

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.

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

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

nodesplit

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

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Using the triptans headache dataset
network <- mbnma.network(HF2PPITT)

jagsdat <- getjagsdata(network$data.ab, likelihood="binomial", link="logit")


# Get JAGS data with class
df <- HF2PPITT
df$class <- ifelse(df$agent=="placebo", "placebo", "active")
netclass <- mbnma.network(df)

jagsdat <- getjagsdata(netclass$data.ab, class=TRUE)


# Get JAGS data at the treatment level for Network Meta-Analysis
network <- mbnma.network(HF2PPITT)

jagsdat <- getjagsdata(network$data.ab, level="treatment")

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