Exercise 15: Credit Approval Decisions Coded (Pg. 365)
Use logistic regression to classify the new data in the Excel file Credit Approval Decisions Coded using only credit score and years of credit history as input variables.
train <- read.csv("./data/credit_approval_decisions_coded.csv")
train
test <- read.csv("./data/credit_approval_decisions_coded_new.csv")
test
logitMod <- glm(Decision ~ Credit.Score + Years.of.Credit.History, data=train, family=binomial(link="logit"))
probs <- plogis(predict(logitMod, test))
Decision <- ifelse(probs > 0.5, 1, 0)
Decision
## 1 2 3 4 5 6
## 1 0 0 0 0 1
cbind(test, Decision)