Skip to contents

Generate binary data

Usage

draw_data(
  n = 200,
  prev = c(0.5, 0.5),
  random = FALSE,
  m = 10,
  method = c("roc", "lfc", "pr"),
  pars = list(),
  ...
)

Arguments

n

(numeric)
integer, overall sample size

prev

(numeric)
vector of class prevalences (adding up to 1)

random

(logical)
random sampling (TRUE) or fixed group sample sizes (FALSE)

m

(numeric)
integer, number of models

method

(character)
either "roc", "lfc" (multiple subgroups) or "prob" (no subgroups)

pars

(list)
containing further named parameters passed to draw_data_roc, draw_data_lfc

...

(any)
further named parameters passed

Value

(matrix)
generated binary data (possibly stratified for subgroups)

Examples

draw_data()
#> $specificity
#>       model1 model2 model3 model4 model5 model6 model7 model8 model9 model10
#>  [1,]      0      1      1      1      1      1      1      1      1       1
#>  [2,]      1      1      1      0      0      1      1      1      1       1
#>  [3,]      0      0      1      1      1      1      1      1      1       1
#>  [4,]      1      1      1      0      0      1      1      1      1       1
#>  [5,]      1      1      1      0      0      1      1      1      1       1
#>  [6,]      1      1      1      1      1      1      1      1      1       1
#>  [7,]      0      0      0      1      1      1      1      1      1       1
#>  [8,]      1      1      1      1      1      1      1      1      1       1
#>  [9,]      1      1      1      1      1      1      1      1      1       1
#> [10,]      0      1      1      1      1      0      0      0      0       0
#> [11,]      0      0      1      0      1      1      1      1      1       1
#> [12,]      1      1      1      1      1      1      1      1      1       1
#> [13,]      1      1      1      1      1      1      1      1      1       1
#> [14,]      1      1      1      1      1      1      1      1      1       1
#> [15,]      1      1      1      1      1      1      1      1      1       1
#> [16,]      0      1      1      1      1      1      1      1      1       1
#> [17,]      1      1      1      1      1      1      1      1      1       1
#> [18,]      1      1      1      1      1      1      1      1      1       1
#> [19,]      1      1      1      1      1      1      1      1      1       1
#> [20,]      1      1      1      1      1      1      1      1      1       1
#> [21,]      1      1      1      1      1      1      1      1      1       1
#> [22,]      1      1      1      1      1      1      1      1      1       1
#> [23,]      0      1      1      0      0      1      1      1      1       1
#> [24,]      0      0      1      0      0      1      1      1      1       1
#> [25,]      1      1      1      1      1      1      1      1      1       1
#> [26,]      0      1      1      1      1      0      1      1      1       1
#> [27,]      1      1      1      1      1      1      1      1      1       1
#> [28,]      1      1      1      1      1      1      1      1      1       1
#> [29,]      0      0      1      0      1      0      0      0      1       1
#> [30,]      0      0      1      1      1      1      1      1      1       1
#> [31,]      1      1      1      1      1      1      1      1      1       1
#> [32,]      0      0      0      1      1      0      0      0      0       0
#> [33,]      1      1      1      1      1      1      1      1      1       1
#> [34,]      0      0      1      1      1      1      1      1      1       1
#> [35,]      0      1      0      1      1      1      1      1      1       1
#> [36,]      0      0      1      0      0      1      1      1      1       1
#> [37,]      0      0      0      1      1      1      1      1      1       1
#> [38,]      1      1      1      1      1      1      1      1      1       1
#> [39,]      1      1      1      1      1      1      1      1      1       1
#> [40,]      1      1      1      1      1      1      1      1      1       1
#> [41,]      1      1      1      1      1      1      1      1      1       1
#> [42,]      1      1      1      1      1      1      1      1      1       1
#> [43,]      1      1      1      1      1      0      1      1      1       1
#> [44,]      0      0      1      1      1      1      1      1      1       1
#> [45,]      1      1      1      1      1      0      0      0      0       0
#> [46,]      0      0      1      1      1      1      1      1      1       1
#> [47,]      1      1      1      1      1      1      1      1      1       1
#> [48,]      1      1      1      0      0      1      1      1      1       1
#> [49,]      1      1      0      1      1      0      0      0      0       0
#> [50,]      1      1      1      1      1      1      1      1      1       1
#> 
#> $sensitivity
#>       model1 model2 model3 model4 model5 model6 model7 model8 model9 model10
#>  [1,]      1      1      1      0      0      1      0      0      0       0
#>  [2,]      1      1      1      1      1      1      1      1      1       1
#>  [3,]      0      0      1      1      0      1      1      1      1       0
#>  [4,]      1      1      0      1      1      1      1      1      1       1
#>  [5,]      1      1      1      1      1      1      1      1      1       1
#>  [6,]      1      1      1      1      1      1      1      1      1       1
#>  [7,]      1      1      1      1      1      1      1      1      1       1
#>  [8,]      1      1      1      1      1      1      1      1      1       1
#>  [9,]      1      1      1      1      1      1      1      0      0       0
#> [10,]      1      1      0      1      1      1      1      1      1       1
#> [11,]      1      1      0      1      1      1      1      1      1       1
#> [12,]      1      1      0      1      0      1      1      0      0       0
#> [13,]      1      1      1      1      1      1      1      1      1       1
#> [14,]      1      1      1      1      0      1      1      1      1       1
#> [15,]      1      1      1      1      1      0      0      0      0       0
#> [16,]      1      0      1      1      1      1      0      0      0       0
#> [17,]      1      1      0      0      0      0      0      0      0       0
#> [18,]      0      0      1      1      1      1      0      0      0       0
#> [19,]      1      1      1      1      0      1      1      1      1       1
#> [20,]      1      1      1      1      1      1      1      1      1       1
#> [21,]      1      1      0      1      1      1      1      1      1       1
#> [22,]      1      1      1      1      1      1      1      1      1       1
#> [23,]      1      1      1      1      1      1      1      1      1       1
#> [24,]      1      1      1      1      1      1      1      1      1       1
#> [25,]      1      1      1      1      0      1      1      1      1       1
#> [26,]      1      1      1      1      1      1      1      1      1       1
#> [27,]      1      1      1      0      0      0      0      0      0       0
#> [28,]      1      1      0      1      1      1      1      0      0       0
#> [29,]      1      1      1      1      1      1      1      1      1       1
#> [30,]      1      1      1      1      1      1      1      1      1       1
#> [31,]      1      1      1      1      1      1      1      1      1       1
#> [32,]      1      1      0      0      0      0      0      0      0       0
#> [33,]      1      1      1      1      1      1      1      1      1       1
#> [34,]      1      1      0      1      1      1      1      0      0       0
#> [35,]      1      1      1      1      1      1      1      1      1       1
#> [36,]      1      1      1      1      1      1      1      1      1       1
#> [37,]      1      1      1      0      0      1      1      1      1       1
#> [38,]      1      1      0      1      1      1      1      1      1       1
#> [39,]      1      1      1      1      1      1      1      1      1       1
#> [40,]      1      1      1      1      1      0      0      0      0       0
#> [41,]      1      1      1      1      1      1      1      1      1       1
#> [42,]      1      1      0      1      1      1      1      1      1       1
#> [43,]      1      1      1      1      0      1      1      1      1       1
#> [44,]      1      1      1      1      1      1      1      1      1       1
#> [45,]      1      1      1      1      1      1      1      1      1       1
#> [46,]      1      1      1      1      1      1      1      1      1       1
#> [47,]      1      1      1      1      1      1      1      1      1       1
#> [48,]      1      1      0      1      1      1      1      1      1       1
#> [49,]      1      0      0      0      0      1      1      1      1       1
#> [50,]      0      0      1      1      1      1      1      1      1       1
#> 
#> attr(,"info")
#>      model   auc    cutoff        se        sp
#> 1   model1 0.875 0.4252305 0.8852425 0.6646657
#> 2   model2 0.875 0.6848175 0.8269094 0.7532704
#> 3   model3 0.900 1.0741979 0.7698004 0.8586330
#> 4   model4 0.925 1.0309334 0.8425206 0.8487140
#> 5   model5 0.925 1.2905203 0.7719502 0.9015650
#> 6   model6 0.950 1.0309334 0.9023814 0.8487140
#> 7   model7 0.950 1.2039913 0.8691077 0.8857035
#> 8   model8 0.950 1.2905203 0.8498182 0.9015650
#> 9   model9 0.950 1.3337848 0.8394962 0.9088628
#> 10 model10 0.950 1.4203138 0.8174952 0.9222418