I want to find a threshold value so I can classify which observation is classified to be sucess or not. But I am a confused about how to use the package for logistic regression. For example my glm model is
library(vcd)
library(ggplot2)
library(dplyr)
library(MLmetrics)
library(pROC)
d=read.delim("http://dnett.github.io/S510/Disease.txt")
d$disease=factor(d$disease)
d$ses=factor(d$ses)
d$sector=factor(d$sector)
model=glm(disease~age+sector, family=binomial(link=logit), data=d)
Where success is defined as disease = 1. Here we have sector as a categorical variable. When we want to produce a confusion matrix then we have to find the threshold value.
pred = factor(ifelse(model$fitted.values<0.5,0,1)) #here i choose 0.5 as the threshold value
confussionMat=confusionMatrix(pred_d$disease)
So my question is, how can we find the threshold value with OptimalCutPoints package in R for my GLM model. In that package, I want to use Sensitivity Equal to Specitifity method. But I don't get how it works for GLM model. Thank you