getnmadata: Prepares NMA data for JAGS

getnmadataR Documentation

Prepares NMA data for JAGS

Description

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

Usage

getnmadata(data.ab, link = "identity", sdscale = FALSE)

Arguments

data.ab

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

  • studyID Study identifiers

  • time Numeric data indicating follow-up times

  • y Numeric data indicating the aggregate response for a given observation (e.g. mean)

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

  • treatment Treatment identifiers (can be numeric, factor or character)

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

  • n An optional column indicating the number of participants used to calculate the response at a given observation (required if modelling using Standardised Mean Differences)

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

link

Can take either "identity" (the default), "log" (for modelling Ratios of Means \insertCitefriedrich2011MBNMAtime) or "smd" (for modelling Standardised Mean Differences - although this also corresponds to an identity link function).

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").

Value

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

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

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

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

  • NS The total number of studies in the dataset

  • NT The total number of treatments in the dataset

  • treat A matrix of treatment codes within each study

Examples

# Using the alogliptin dataset
network <- mb.network(alog_pcfb)

# Construct a dataset with the latest time point in each study
data.ab <- get.latest.time(network)$data.ab
getnmadata(data.ab)


MBNMAtime documentation built on Oct. 14, 2023, 5:08 p.m.