find_matching_a1_1b: Find beta-1 shape parameters matching the conditional...

Description Usage Arguments Value Examples

View source: R/ROC.R

Description

Based on https://journals.sagepub.com/doi/abs/10.1177/0272989X15582210. Fits a Beta(a, 1) distribuiton on positive examples and an Beta(1, b) distribution on negative examples.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
find_matching_a1_1b(
  modelPredictions,
  yValues,
  ...,
  yTarget = TRUE,
  step_size = 0.001
)

find_ROC_matching_ab1(
  modelPredictions,
  yValues,
  ...,
  yTarget = TRUE,
  step_size = 0.001
)

Arguments

modelPredictions

numeric predictions (not empty), ordered (either increasing or decreasing)

yValues

truth values (not empty, same length as model predictions)

...

force later arguments to bind by name.

yTarget

value considered to be positive.

step_size

size of steps in curve drawing

Value

beta curve shape parameters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
d <- rbind(
  data.frame(x = rbeta(1000, shape1 = 6, shape2 = 4), y = TRUE),
  data.frame(x = rbeta(1000, shape1 = 2, shape2 = 5), y = FALSE)
)
find_ROC_matching_ab1(modelPredictions = d$x, yValues = d$y)
# should be near
# shape1_pos shape2_pos shape1_neg shape2_neg          a          b
#   3.985017   1.000000   1.000000   1.746613   3.985017   1.746613
#
# # How to land what you want as variables
# unpack[a, b] <-
#    find_matching_a1_1b(modelPredictions = d$x, yValues = d$y)

sigr documentation built on June 12, 2021, 9:07 a.m.