create_INLA_dat converts datasets in the one-study-per-row format to one-arm-per-row format , then adds indicator (dummy) variables for the basic contrasts, heterogeneity random effects and design-specific inconsistency random effects and for correlated multi-arm trials.

create_INLA_dat(dat = dat, armVars = c(treatment = "t", responders = "r",
  sampleSize = "n"), covariate = "cov", design = "des", nArmsVar = "na")

Arguments

dat

Data in one-study-per-row format.

armVars

Vector of per-arm variables The name of each component will be the column name in the resulting dataset.

covariate

Optional. Vector of study-specific covariate

design

Optional. Vector of study-specific design. We refer design for the set of treatments in each trial.

nArmsVar

Variable holding the number of arms for each study.

Value

A data frame with the generated coloumns.

Details

The resulting data.frame can be used as data argument in nma_inla.

See also

gemtc::mtc.data.studyrow

Examples

data('Smokdat') ## Create the dataset suitable for INLA SmokdatINLA <- create_INLA_dat(dat = Smokdat, armVars = c('treatment' = 't', 'responders' = 'r' ,'sampleSize' = 'n'), nArmsVar = 'na') ## Check that the data are correct print(SmokdatINLA)
#> study treatment responders sampleSize na baseline mu d12 d13 d14 g het inc #> 1 1 1 9 140 3 1 1 0 0 0 NA NA NA #> 2 1 3 23 140 3 1 1 0 1 0 1 1 1 #> 3 1 4 10 138 3 1 1 0 0 1 2 1 1 #> 4 2 2 11 78 3 2 2 0 0 0 NA NA NA #> 5 2 3 12 85 3 2 2 -1 1 0 1 2 2 #> 6 2 4 29 170 3 2 2 -1 0 1 2 2 2 #> 7 3 1 75 731 2 1 3 0 0 0 NA NA NA #> 8 3 3 363 714 2 1 3 0 1 0 1 3 3 #> 9 4 1 2 106 2 1 4 0 0 0 NA NA NA #> 10 4 3 9 205 2 1 4 0 1 0 1 4 3 #> 11 5 1 58 549 2 1 5 0 0 0 NA NA NA #> 12 5 3 237 1561 2 1 5 0 1 0 1 5 3 #> 13 6 1 0 33 2 1 6 0 0 0 NA NA NA #> 14 6 3 9 48 2 1 6 0 1 0 1 6 3 #> 15 7 1 3 100 2 1 7 0 0 0 NA NA NA #> 16 7 3 31 98 2 1 7 0 1 0 1 7 3 #> 17 8 1 1 31 2 1 8 0 0 0 NA NA NA #> 18 8 3 26 95 2 1 8 0 1 0 1 8 3 #> 19 9 1 6 39 2 1 9 0 0 0 NA NA NA #> 20 9 3 17 77 2 1 9 0 1 0 1 9 3 #> 21 10 1 79 702 2 1 10 0 0 0 NA NA NA #> 22 10 2 77 694 2 1 10 1 0 0 1 10 4 #> 23 11 1 18 671 2 1 11 0 0 0 NA NA NA #> 24 11 2 21 535 2 1 11 1 0 0 1 11 4 #> 25 12 1 64 642 2 1 12 0 0 0 NA NA NA #> 26 12 3 107 761 2 1 12 0 1 0 1 12 3 #> 27 13 1 5 62 2 1 13 0 0 0 NA NA NA #> 28 13 3 8 90 2 1 13 0 1 0 1 13 3 #> 29 14 1 20 234 2 1 14 0 0 0 NA NA NA #> 30 14 3 34 237 2 1 14 0 1 0 1 14 3 #> 31 15 1 0 20 2 1 15 0 0 0 NA NA NA #> 32 15 4 9 20 2 1 15 0 0 1 1 15 5 #> 33 16 1 8 116 2 1 16 0 0 0 NA NA NA #> 34 16 2 19 146 2 1 16 1 0 0 1 16 4 #> 35 17 1 95 1107 2 1 17 0 0 0 NA NA NA #> 36 17 3 143 1031 2 1 17 0 1 0 1 17 3 #> 37 18 1 15 187 2 1 18 0 0 0 NA NA NA #> 38 18 3 35 504 2 1 18 0 1 0 1 18 3 #> 39 19 1 78 584 2 1 19 0 0 0 NA NA NA #> 40 19 3 73 675 2 1 19 0 1 0 1 19 3 #> 41 20 1 69 1177 2 1 20 0 0 0 NA NA NA #> 42 20 3 54 888 2 1 20 0 1 0 1 20 3 #> 43 21 2 20 49 2 2 21 0 0 0 NA NA NA #> 44 21 3 16 43 2 2 21 -1 1 0 1 21 6 #> 45 22 2 7 66 2 2 22 0 0 0 NA NA NA #> 46 22 4 32 127 2 2 22 -1 0 1 1 22 7 #> 47 23 3 12 76 2 3 23 0 0 0 NA NA NA #> 48 23 4 20 74 2 3 23 0 -1 1 1 23 8 #> 49 24 3 9 55 2 3 24 0 0 0 NA NA NA #> 50 24 4 3 26 2 3 24 0 -1 1 1 24 8