BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Supervised Learning in R: Classification

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Build a recency, frequency, and money (RFM) model
rfm_model <- ___

# Summarize the RFM model to see how the parameters were coded


# Compute predicted probabilities for the RFM model
rfm_prob <- ___

# Plot the ROC curve and find AUC for the new model
library(pROC)
ROC <- ___
plot(___, col = "red")
auc(___)
Kodu Düzenle ve Çalıştır