Exercise

# Building a more sophisticated model

One of the best predictors of future giving is a history of recent, frequent, and large gifts. In marketing terms, this is known as R/F/M:

- Recency
- Frequency
- Money

Donors that haven't given both recently and frequently may be especially likely to give again; in other words, the *combined* impact of recency and frequency may be greater than the sum of the separate effects.

Because these predictors together have a greater impact on the dependent variable, their joint effect must be modeled as an interaction. The `donors`

dataset has been loaded for you.

Instructions

**100 XP**

- Create a logistic regression model of
`donated`

as a function of`money`

plus the interaction of`recency`

and`frequency`

. Use`*`

to add the interaction term. - Examine the model's
`summary()`

to confirm the interaction effect was added. - Save the model's predicted probabilities as
`rfm_prob`

. Use the`predict()`

function, and remember to set the`type`

argument. - Plot a ROC curve by using the function
`roc()`

. Remember, this function takes the column of outcomes and the vector of predictions. - Compute the AUC for the new model with the function
`auc()`

and compare performance to the simpler model.