R/create_INLA_dat_pair.R
create_INLA_dat_pair.Rd
create_INLA_dat_pair
creates two dataframes, one to use in
a contrast based and the other in an arm-based pairwise meta-analysis.
create_INLA_dat_pair(ntrt, nctrl, ptrt, pctrl, cov = NULL)
ntrt | Number of subjects in treatment arm |
---|---|
nctrl | Number of subjects in control arm |
ptrt | Number of events in treatment arm |
pctrl | Number of events in treatment arm |
cov | Optional argument to include a covariate in the model |
A list of two dataframe objects
The resulting data.frame can be used as data argument in
meta_inla
.
data('TBdat') ## Create the dataset suitable for INLA TBdatINLA <- create_INLA_dat_pair(TBdat$TRT, TBdat$CON, TBdat$TRTTB, TBdat$CONTB) ## Check that the data are correct print(TBdatINLA)#> $data.cont #> d Y prec het #> 1 1 -0.93869414 2.800140 1 #> 2 1 -1.66619073 4.804634 2 #> 3 1 -1.38629436 2.307268 3 #> 4 1 -1.45644355 49.226133 4 #> 5 1 -0.21914109 19.248620 5 #> 6 1 -0.95812204 100.956405 6 #> 7 1 -1.63377584 4.405099 7 #> 8 1 0.01202060 249.565630 8 #> 9 1 -0.47174604 17.550903 9 #> 10 1 -1.40121014 13.258779 10 #> 11 1 -0.34084965 79.839466 11 #> 12 1 0.44663468 1.872091 12 #> 13 1 -0.01734187 13.959634 13 #> #> $data.arm #> Y sampleSize d het mu #> 1 11 139 0 NA 1 #> 2 4 123 1 1 1 #> 3 29 303 0 NA 2 #> 4 6 306 1 2 2 #> 5 11 220 0 NA 3 #> 6 3 231 1 3 3 #> 7 248 12867 0 NA 4 #> 8 62 13598 1 4 4 #> 9 47 5808 0 NA 5 #> 10 33 5069 1 5 5 #> 11 372 1451 0 NA 6 #> 12 180 1541 1 6 6 #> 13 10 629 0 NA 7 #> 14 8 2545 1 7 7 #> 15 499 88391 0 NA 8 #> 16 505 88391 1 8 8 #> 17 45 7277 0 NA 9 #> 18 29 7499 1 9 9 #> 19 65 1665 0 NA 10 #> 20 17 1716 1 10 10 #> 21 141 27338 0 NA 11 #> 22 186 50634 1 11 11 #> 23 3 2341 0 NA 12 #> 24 5 2498 1 12 12 #> 25 29 17854 0 NA 13 #> 26 27 16913 1 13 13 #>