Exercise

# Making binary predictions

Naturally, we want to know how well our model works. Did it predict acceptance for the students who were actually accepted to medical school? Did it predict rejections for the student who were not admitted? These types of predictions are called *in-sample*. One common way to evaluate models with a binary response is with a confusion matrix. [Yes, that is actually what it is called!]

However, note that while our response variable is binary, our fitted values are probabilities. Thus, we have to round them somehow into binary predictions. While the probabilities convey more information, we might ultimately have to make a decision, and so this rounding is common in practice. There are many different ways to round, but for simplicity we will predict admission if the fitted probability is greater than 0.5, and rejection otherwise.

First, we'll use `augment()`

to make the predictions, and then `mutate()`

and `round()`

to convert these probabilities into binary decisions. Then we will form the confusion matrix using the `table()`

function. `table()`

will compute a 2-way table when given a data frame with two categorical variables, so we will first use `select()`

to grab only those variables.

You will find that this model made only 15 mistakes on these 55 observations, so it is nearly 73% accurate.

Instructions

**100 XP**

The model object `mod`

is already in your worskpace.

- Create a data frame with the actual observations, and their fitted probabilities, and add a new column,
`Acceptance_hat`

, with the*binary*decision by rounding the fitted probabilities. - Compute the confusion matrix between the actual and predicted acceptance.