Skip to contents

Generate binary data (ROC model)

Usage

draw_data_roc(
  n = 100,
  prev = c(0.5, 0.5),
  random = FALSE,
  m = 10,
  auc = seq(0.85, 0.95, length.out = 5),
  rho = c(0.25, 0.25),
  dist = c("normal", "exponential"),
  e = 10,
  k = 100,
  delta = 0,
  modnames = paste0("model", 1:m),
  corrplot = FALSE,
  ...
)

Arguments

n

(numeric)
total sample size

prev

(numeric)
disease and healthy prevalence (adds up to 1)

random

(logical)
random sampling (TRUE) or fixed prevalence (FALSE)

m

(numeric)
integer, number of models

auc

(numeric)
vector of AUCs of biomarkers

rho

(numeric)
vector (length 2) of correlations between biomarkers

dist

(character)
either "normal" or "exponential" specifying the subgroup biomarker distributions

e

(numeric)
emulates better (worse) model selection quality with higher (lower) values of e

k

(numeric)
technical parameter which adjusts grid size

delta

(numeric)
specify importance of sensitivity and specificity (default 0)

modnames

(character)
model names (length m)

corrplot

(logical)
if TRUE do not return data but instead plot correlation matrices for final binary data (default: FALSE)

...

(any)
further arguments (currently unused)

Value

(list)
list of matrices including generated binary datasets (1: correct prediction, 0: incorrect prediction) for each subgroup (specificity, sensitivity)

Examples

data <- draw_data_roc()
head(data)
#> $specificity
#>       model1 model2 model3 model4 model5 model6 model7 model8 model9 model10
#>  [1,]      0      1      1      1      1      0      0      1      1       1
#>  [2,]      1      1      1      1      1      1      1      1      1       1
#>  [3,]      1      1      1      1      1      1      1      1      1       1
#>  [4,]      1      1      1      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,]      0      0      1      1      1      0      0      0      0       0
#>  [8,]      1      1      1      1      1      0      0      0      0       0
#>  [9,]      0      1      1      1      1      1      1      1      1       1
#> [10,]      0      1      1      1      1      1      1      1      1       1
#> [11,]      1      1      1      1      1      1      1      1      1       1
#> [12,]      1      1      1      1      1      1      1      1      1       1
#> [13,]      0      1      1      1      1      1      1      1      1       1
#> [14,]      0      1      1      1      1      1      1      1      1       1
#> [15,]      0      1      1      1      1      1      1      1      1       1
#> [16,]      1      1      1      1      1      1      1      1      1       1
#> [17,]      1      1      1      1      1      0      0      1      1       1
#> [18,]      1      1      1      1      1      1      1      1      1       1
#> [19,]      0      1      1      1      1      1      1      1      1       1
#> [20,]      0      1      1      1      1      1      1      1      1       1
#> [21,]      0      1      1      1      1      0      0      0      0       0
#> [22,]      1      1      1      1      1      0      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,]      0      1      1      1      1      1      1      1      1       1
#> [26,]      1      1      1      1      1      0      0      0      0       0
#> [27,]      0      1      1      1      1      1      1      1      1       1
#> [28,]      0      1      1      1      1      1      1      1      1       1
#> [29,]      0      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      1      1      1      0      1      1      1       1
#> [33,]      0      1      1      1      1      0      1      1      1       1
#> [34,]      0      0      0      1      1      0      1      1      1       1
#> [35,]      0      1      1      1      1      1      1      1      1       1
#> [36,]      0      1      1      1      1      1      1      1      1       1
#> [37,]      0      0      0      1      1      0      0      0      0       0
#> [38,]      0      1      1      1      1      1      1      1      1       1
#> [39,]      0      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      0      0      0      0       0
#> [43,]      1      1      1      1      1      0      1      1      1       1
#> [44,]      1      1      1      1      1      0      0      1      1       1
#> [45,]      0      1      1      1      1      0      0      0      0       0
#> [46,]      1      1      1      1      1      1      1      1      1       1
#> [47,]      0      1      1      1      1      1      1      1      1       1
#> [48,]      1      1      1      1      1      1      1      1      1       1
#> [49,]      0      1      1      1      1      1      1      1      1       1
#> [50,]      1      1      1      1      1      0      0      0      0       0
#> 
#> $sensitivity
#>       model1 model2 model3 model4 model5 model6 model7 model8 model9 model10
#>  [1,]      1      1      1      1      1      1      1      1      1       1
#>  [2,]      1      1      1      1      1      1      1      1      1       1
#>  [3,]      0      1      1      1      1      1      1      1      0       0
#>  [4,]      1      0      0      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      1      1      1      1      1      1      1      1       1
#>  [8,]      0      1      1      1      1      1      1      1      1       1
#>  [9,]      1      1      1      1      1      1      1      1      1       1
#> [10,]      1      0      0      0      0      1      1      1      1       1
#> [11,]      1      1      1      1      1      1      1      1      1       1
#> [12,]      1      0      0      0      0      1      1      1      1       1
#> [13,]      1      0      0      0      0      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,]      1      1      1      1      1      1      1      1      1       1
#> [17,]      1      1      1      1      1      1      1      1      1       1
#> [18,]      1      1      1      0      0      1      1      1      1       1
#> [19,]      1      1      1      0      0      0      0      0      0       0
#> [20,]      1      1      1      1      1      1      1      1      1       1
#> [21,]      1      1      1      1      1      1      1      1      1       1
#> [22,]      0      1      0      0      0      1      1      1      1       1
#> [23,]      1      1      1      1      1      1      1      1      1       1
#> [24,]      1      0      0      0      0      1      1      1      1       1
#> [25,]      1      1      1      1      1      1      1      1      1       1
#> [26,]      1      1      1      1      1      1      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,]      1      1      1      1      1      1      1      1      1       1
#> [30,]      0      0      0      0      0      1      1      1      1       1
#> [31,]      1      1      1      0      0      1      1      1      1       1
#> [32,]      1      1      1      1      1      1      1      1      1       1
#> [33,]      0      1      1      1      1      0      0      0      0       0
#> [34,]      1      1      1      1      1      1      1      1      1       1
#> [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      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,]      0      0      0      0      0      1      1      1      1       1
#> [44,]      0      1      1      0      0      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      1      1      1      1      1      1      1       1
#> [49,]      1      1      1      1      1      1      1      1      1       1
#> [50,]      1      1      1      1      1      1      1      1      1       1
#>