Prepares NMA data for JAGS
getnmadata.RdConverts data frame to a list for use in JAGS NMA model
Arguments
- data.ab
A data frame of arm-level data in "long" format containing the columns:
studyIDStudy identifierstimeNumeric data indicating follow-up timesyNumeric data indicating the aggregate response for a given observation (e.g. mean)seNumeric data indicating the standard error for a given observationtreatmentTreatment identifiers (can be numeric, factor or character)classAn optional column indicating a particular class identifier. Observations with the same treatment identifier must also have the same class identifier.nAn optional column indicating the number of participants used to calculate the response at a given observation (required if modelling using Standardised Mean Differences)standsdAn 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 friedrich2011MBNMAtime) 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=TRUEwill 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:
yAn array of mean responses for each observation in each arm within each studyseAn array of standard errors for each observation in each arm within each studynarmA numeric vector with the number of arms per studyNSThe total number of studies in the datasetNTThe total number of treatments in the datasettreatA matrix of treatment codes within each study
Examples
# Using the alogliptin dataset
network <- mb.network(alog_pcfb)
#> Reference treatment is `placebo`
#> Studies reporting change from baseline automatically identified from the data
# Construct a dataset with the latest time point in each study
data.ab <- get.latest.time(network)$data.ab
getnmadata(data.ab)
#> $narm
#> [1] 6 5 4 3 3 3 3 3 3 3 3 3 2 2
#>
#> $NS
#> [1] 14
#>
#> $studyID
#> [1] 11 1 3 2 4 5 6 7 8 9 10 14 12 13
#>
#> $NT
#> [1] 6
#>
#> $y
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] -0.01 -0.19 -0.54 -0.56 -0.44 -0.51
#> [2,] 0.06 -0.51 -0.70 -0.76 -0.82 NA
#> [3,] -0.33 -0.48 -0.66 -0.77 NA NA
#> [4,] -0.02 -0.56 -0.59 NA NA NA
#> [5,] -0.19 -0.66 -0.80 NA NA NA
#> [6,] 0.01 -0.38 -0.52 NA NA NA
#> [7,] -0.10 -0.61 -0.59 NA NA NA
#> [8,] -0.19 -0.91 -0.97 NA NA NA
#> [9,] -0.13 -0.63 -0.71 NA NA NA
#> [10,] 0.34 -0.60 -0.66 NA NA NA
#> [11,] 0.04 -0.96 -0.91 NA NA NA
#> [12,] 0.21 -0.54 -0.64 NA NA NA
#> [13,] -0.67 -0.69 NA NA NA NA
#> [14,] -0.78 -0.92 NA NA NA NA
#>
#> $se
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.13430944 0.12035661 0.12189965 0.11627553 0.12352384 0.119097
#> [2,] 0.05311623 0.07650598 0.06219210 0.06187984 0.05287913 NA
#> [3,] 0.07622222 0.09923275 0.07808110 0.08346834 NA NA
#> [4,] 0.09400000 0.06500000 0.06600000 NA NA NA
#> [5,] 0.08100000 0.05600000 0.05600000 NA NA NA
#> [6,] 0.08400000 0.05800000 0.05800000 NA NA NA
#> [7,] 0.07600000 0.05300000 0.05400000 NA NA NA
#> [8,] 0.05128776 0.04176295 0.04891748 NA NA NA
#> [9,] 0.07700000 0.07600000 0.07800000 NA NA NA
#> [10,] 0.06010509 0.05491252 0.05491252 NA NA NA
#> [11,] 0.05347391 0.06308933 0.05400422 NA NA NA
#> [12,] 0.06400000 0.05838404 0.05001042 NA NA NA
#> [13,] 0.04742520 0.04874593 NA NA NA NA
#> [14,] 0.08194019 0.07608902 NA NA NA NA
#>
#> $treat
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 1 2 3 4 5 6
#> [2,] 1 2 3 4 5 NA
#> [3,] 2 3 4 5 NA NA
#> [4,] 1 3 4 NA NA NA
#> [5,] 1 3 4 NA NA NA
#> [6,] 1 3 4 NA NA NA
#> [7,] 1 3 4 NA NA NA
#> [8,] 1 3 4 NA NA NA
#> [9,] 1 3 4 NA NA NA
#> [10,] 1 3 4 NA NA NA
#> [11,] 1 3 4 NA NA NA
#> [12,] 1 3 4 NA NA NA
#> [13,] 3 4 NA NA NA NA
#> [14,] 3 4 NA NA NA NA
#>