Unable to find a threshold that achieve certain sensitivity

#1
I am asked to find a threshold that can achieve 80% sensitivity. However, I am unable to find a reasonable one from my logistic regression model. Can anyone show me where the problem is please?

Code:
coords(roc1,x= 0.8,input="sensitivity")
threshold specificity sensitivity
NA 0.5648283 0.8000000


Code:
pred4<-predict(Model$BestModel,newdata=Data,type="response")
class.pred4<-1*(pred4>0.1)
T4<-table(Data$y,class.pred4)
T4
Sen4<-T4[2,2]/sum(T4[2,])
Sen4

class.pred4
0 1
0 4290 1331
1 249 512

0.6727989
 
Last edited:

hlsmith

Not a robit
#2
So for clarification, you are ask to find the predicted probability value generated from a logistic regression model that would accurately classify those with the outcome as having the outcome, correct? How big is the dataset? Can you just sort your model output by predicted probability and eyeball if it is possible. I have some old code that can execute your talk - I will see if I can find it tomorrow - if I have time. It just needs a loop and then you can plot all of the values for sensitivity for all of the predicted probabilities.

You are using R code right?
 
#3
I am not sure if I interpret your interpretation correctly. Let me rephrase. I am asked to use my regression model to predict at least 80% of true positive rate (sensitivity). However, I am unable to find a decent one because using my model, I have to lower my threshold as low as 0.068 in order to achieve 0.858 sensitivity. Therefore, I am wondering if it is the problem of my data, or the problem of my codes.

Code:
class.pred4<-1*(pred4>0.068)
T4<-table(Cleaned$y,class.pred4)
T4
>   class.pred4
       0    1
  0 2339 3282
  1  108  653
Sen4<-T4[2,2]/sum(T4[2,])
Sen4
>[1] 0.8580815
For the data I am having, it is an unbalanced one, with y=yes only 11% while y=no for 89%.