20 Logistic Regression - Classification Tables

For each of the following logistic regression models A. Classify each college in the dataset as private or public B. Construct a two-way table that displays the results of our classifications C. Compute the CR, FPR, and FNR.

Sample code (won’t run)

preds = predict.glm(glmmod, type = "response")
class = ifelse(preds >= 0.5, "Private_Pred", "Public_Pred")
res = data.frame(Actual = colleges$Type, Classification = class)
xtabs(~Classification+Actual,data=res)
  1. Model 1: Predict the probability of being a private college using student/faculty ratio
# mod1 is from lesson 19
preds = predict.glm( mod1 , type = "response")
class = ifelse(preds >= 0.5, "Private_Pred", "Public_Pred")
res = data.frame(Actual = colleges$Type, Classification = class)
xtabs(~Classification+Actual,data=res)
  1. Model 2: Use both student/faculty ratio and ACTQ3 to model the probability of being a private college.
# mod3_reduced is from lesson 19
preds = predict.glm( mod3_reduced , type = "response")
class = ifelse(preds >= 0.5, "Private_Pred", "Public_Pred")
res = data.frame(Actual = colleges$Type, Classification = class)
xtabs(~Classification+Actual,data=res)
  1. Model 3: Consider a model that uses ACTQ3, student/faculty ratio, percent top 10%, and graduation rate to model the probability of being a private college.