Exercise

# Odds scale

For most people, the idea that we could estimate the probability of being admitted to medical school based on undergraduate GPA is fairly intuitive. However, thinking about how the probability changes as a function of GPA is complicated by the non-linear logistic curve. By translating the response from the probability scale to the odds scale, we make the right hand side of our equation easier to understand.

If the probability of getting accepted is \(y\), then the odds are \(y / (1-y)\). Expressions of probabilities in terms of odds are common in many situations, perhaps most notably gambling.

Here we are plotting \(y/(1-y)\) as a function of \(x\), where that function is
$$
odds(\hat{y}) = \frac{\hat{y}}{1-\hat{y}} = \exp{( \hat{\beta}_0 + \hat{\beta}_1 \cdot x ) }
$$
Note that the left hand side is the expected *odds* of being accepted to medical school. The right hand side is now a familiar exponential function of \(x\).

The `MedGPA_binned`

data frame contains the data for each GPA bin, while the `MedGPA_plus`

data frame records the original observations after being `augment()`

-ed by `mod`

.

Instructions

**100 XP**

- Add a variable called
`odds`

to`MedGPA_binned`

that records the odds of being accepted to medical school for each bin. - Create a scatterplot called
`data_space`

for`odds`

as a function of`mean_GPA`

using the binned data in`MedGPA_binned`

. Connect the points with`geom_line()`

. - Add a variable called
`odds_hat`

to`MedGPA_plus`

that records the predicted odds of being accepted for each observation. - Use
`geom_line()`

to illustrate the model through the fitted values. Note that you should be plotting the \(\widehat{odds}\)'s.