Load package

// Introduction is being prepared… //

# Make some data
set.seed(1)
(x_ <- rnorm(10))
#>  [1] -0.6264538  0.1836433 -0.8356286  1.5952808  0.3295078 -0.8204684
#>  [7]  0.4874291  0.7383247  0.5757814 -0.3053884
(gr_ <- gl(n = 2, k = 5, length = 10, labels = c("H","S")))
#>  [1] H H H H H S S S S S
#> Levels: H S
# Explore the functions
roc_analysis(x_, gr_)
#> $info
#>  var_name n_total n_neg n_pos neg_label pos_label median_neg median_pos below
#>                10     5     5         H         S  0.1836433  0.4874291     H
#>     cutoff above
#>  0.4084684     S
#> 
#> $optimal
#>  cutoff tp fn fp tn sens spec  ppv   npv bac youden kappa auc median_neg
#>   0.408  3  2  1  4  0.6  0.8 0.75 0.667 0.7    0.4   0.4 0.6      0.184
#>  median_pos
#>       0.487
#> 
#> *The optimal cut-off value selected by: max BAC
#> 
#> $all_results
#>     cutoff  tp  fn  fp  tn sens spec  ppv  npv  bac youden
#> 1      Inf   0   5   0   5 0.00 1.00  NaN 0.50 0.50   0.00
#> 2     1.17   0   5   1   4 0.00 0.80 0.00 0.44 0.40  -0.20
#> 3    0.657   1   4   1   4 0.20 0.80 0.50 0.50 0.50   0.00
#> 4    0.532   2   3   1   4 0.40 0.80 0.67 0.57 0.60   0.20
#> ...    ... ... ... ... ...  ...  ...  ...  ...  ...    ...
#> 8   -0.466   4   1   3   2 0.80 0.40 0.57 0.67 0.60   0.20
#> 9   -0.723   4   1   4   1 0.80 0.20 0.50 0.50 0.50   0.00
#> 10  -0.828   5   0   4   1 1.00 0.20 0.56 1.00 0.60   0.20
#> 11    -Inf   5   0   5   0 1.00 0.00 0.50  NaN 0.50   0.00
#>                                                           
#> 
#> attr(,"class")
#> [1] "roc_result_list" "list"