I've managed to build a logistic model, yet when I've tried to find its accuracy (i.e. sensitivity and specificity) I got this error: sensitivity.default(test$FL_CLI_USES_BANK_APP_M, predicted, threshold = 0.5): inputs must be factors
.
If anyone has any ideas where I have made a mistake please let me know, the code is below plus I'm attaching a screenshot. Thanks in advance.
smp_size <- floor(0.75 * nrow(GBAC_NOPASS))
train_ind <- sample(seq_len(nrow(GBAC_NOPASS)), size = smp_size)
train <- GBAC_NOPASS[train_ind, ]
test <- GBAC_NOPASS[-train_ind, ]
logitMod <-glm(FL_CLI_USES_BANK_APP_M~ CD_GENDER + QT_AGE +FL_CLI_HAS_ACCT_MANAGER + FL_DIGITAL_STATEMENT+CD_NPS_3M + FL_DOES_ECOMMERCE_M+ FL_IS_ETRAVEL_M+ FL_IS_REGULAR_SAVER_M+ FL_USES_REVOLUT_M+ FL_USES_MBWAY_M+FL_USES_ESCOOTER_M+ FL_IS_ESHOPPER_M+ QT_CARDS_M+QT_CURRENT_ACCT_M+ QT_OPER_BRANCH_3M+ QT_OPER_CALLCENTER_3M+ QT_OPER_ATM_3M+ QT_OPER_DIGITAL_3M+ QT_OPER_OTHERS_3M+ FL_CLI_USES_BANK_WEB_M+ QT_TRANSACTIONS_WEB_3M , data=train, family=binomial)
summary(logitMod)
test$FL_CLI_USES_BANK_APP_M <- predict(logitMod, newdata = test, type = "response")
predicted <- predict(logitMod, newdata=test)
sensitivity(test$FL_CLI_USES_BANK_APP_M, predicted, threshold = 0.5)