I'm trying to find optimal cutoff points using cutpointr
https://r.meteo.uni.wroc.pl/web/packages/cutpointr/vignettes/cutpointr.html
In the vignette they use a suicide (YES, NO) variable that indicates if the person had previous suicide attempts.
The function requires that variable, but I don't have it, so I included a variable Live with no values:
my data
library(cutpointr)
library(readxl)
dat <- read_xlsx("C:/findcutoff/mydata.xlsx")
dat$Live <- as.factor(dat$Live)
cp <- cutpointr(dat, Test, Live, method = maximize_metric, metric = sum_sens_spec)
But this is not working
Error in cutpointr_internal(x, class, subgroup, method, metric, pos_class, :
NAs found but na.rm = FALSE
So I added "YES" and "NO" values to the Live variable
and this time it worked, I got a cutoff = 42
But if I change the "YES" and "NO" values to others, then I get other cutoff, so this means that the cutpointr function depends on the Live variable which I have invented..
Please can anybody clarify this? I'm totally confused..