Thie1e / cutpointr

Optimal cutpoints in R: determining and validating optimal cutpoints in binary classification
https://cran.r-project.org/package=cutpointr
85 stars 13 forks source link

Specify a customer cutpoint using oc_manual=avalue ignored? #53

Closed jwang-lilly closed 2 years ago

jwang-lilly commented 2 years ago

Hi Christian,

I wonder if oc_manual is used to specify a custom cutpoint. I ran the following code to provide my own cutpoint instead of letting the function find the optimal cutpoint. Not sure if oc_manual is used correctly but the output ignores my input. Please advise!

` data(suicide) opt_cut <- cutpointr(data = suicide, x = dsi, class = suicide, pos_class = 'yes', neg_class = 'no', direction = '>=', boot_stratify = TRUE, oc_manual = 2.5)

`

Thanks much @Thie1e

jwang-lilly commented 2 years ago

I found the answer as follows.

opt_cut <- cutpointr(data = suicide, x = dsi, class = suicide, pos_class = 'yes', neg_class = 'no', direction = '>=', boot_stratify = TRUE, method = oc_manual, cutpoint = 2.5)

Thie1e commented 2 years ago

Hi Jian,

yes, your solution is correct.

The first approach 'ignores' the oc_manual parameter, because is gets passed on to the metric function where it is then unused by sum_sens_spec when using the defaults.

Maybe we could issue a warning if parameters are supplied that are not being used by the metric function.