Exercise

# Probabilities

There are four main ways of expressing the prediction from a logistic regression model – we'll look at each of them over the next four exercises. Firstly, since the response variable is either "yes" or "no", you can make a prediction of the probability of a "yes". Here, you'll calculate and visualize these probabilities.

Three variables are available:

`mdl_churn_vs_relationship`

is the logistic regression model of`has_churned`

versus`time_since_first_purchase`

.`explanatory_data`

is a data frame of explanatory values.`plt_churn_vs_relationship`

is a scatter plot of`has_churned`

versus`time_since_first_purchase`

with a smooth glm line.

`dplyr`

is loaded.

Instructions 1/2

**undefined XP**

- Use the model,
`mdl_churn_vs_relationship`

, and the explanatory data,`explanatory_data`

, to predict the probability of churning. Assign the predictions to the`has_churned`

column of a data frame,`prediction_data`

.*Remember to set the prediction*.`type`