Calculate the test classification error rates for the following cut-offs of the estimated probability

Hi everyone,

I have managed to get a logistic regression in RStudio, but I am having difficulties calculating test classification error rates for the following cut-offs given some estimated probability. Any help would be appreciated.

Since it mentions test classification error rates, I am assuming this is for the test data only. This is what I have tried so far:

glm_dir (this is my logistic regression name that I have estimated)

test is my test data

test_pred <- factor(ifelse(predict(glm_dir, newdata = test, type = "response") <= 0.4, "Down", "Up"))

Sorry for double posting, but I don't think I can edit my post.

So far, this is what I've tried new.

predicted <- factor(ifelse(predict(glm_dir, newdata = test, type = "response") < 0.4, "Down", "Up"))

glm_dir is my logistic regression, test is my testing data and 0.4 is the given probability. Am I doing this right to find the classification error rate?

You can follow along in this example.
Logistic Regression Essentials in R - Articles - STHDA

I'm starting to slowly understand, but still struggling. Would this be correct so far of what I got?

Crime is my data set name. Highcrime is my variable. P=0.6 is my following cut-offs of the estimated probability. 85 is my year.

Training <- Crime$highcrime %>%
createDataPartition(p = 0.6, list = FALSE)

train.data <- Crime[Crime$highcrime <= 85, ]
test.data <- Crime[Crime$highcrime > 85, ]

glm_dir <- glm(highcrime ~ variable1 + all other variables, data = train.data, family = "Binomial") LOGISTIC REG

Hey man. I had a problem that was really similar. Contact me on discord: Erlend#4931. I'll help you out =)