Skip to contents

Generate binary data (LFC model)

Usage

draw_data_lfc(
  n = 100,
  prev = c(0.5, 0.5),
  random = FALSE,
  m = 10,
  se = 0.8,
  sp = 0.8,
  B = round(m/2),
  L = 1,
  Rse = diag(rep(1, m)),
  Rsp = diag(rep(1, m)),
  modnames = paste0("model", 1:m),
  ...
)

Arguments

n

(numeric)
integer, total sample size

prev

(numeric)
disease and healthy prevalence (length 2, adds up to 1)

random

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

m

(numeric)
integer, number of models

se

(numeric)
sensitivity (length 1)

sp

(numeric)
specificity (length 1)

B

(numeric)
integer, between 1 and m, specifies how many sensitivity values are projected to 1

L

(numeric)
worst alternative is computed under side condition Acc <= L (default value L=1 corresponds to true LFC where values are projected to 1)

Rse

(matrix)
correlation matrix for empirical sensitivities (m x m)

Rsp

(maxtrix)
correlation matrix for empirical specificities (m x m)

modnames

(modnames)
character, model names (length m)

...

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