Objective

Predict Customer Attrition using the CreditCardData, using the classification algorithim from the rpart package.

Data Prep

Created a new binary variable, Attrition_Flag by classifying observations that are predicted to stay = 0 and observations that are predicted to leave = 1.

Split the data (10127 observations), into training and validation datasets (70%/30% , 7046/3081).

Tree

Two Interpretations From the Tree

1. Most Likely Attired Customers:

- Total_Revolving_Bal < 610

- Total_Ct_Chng_Q4_Q1 < 0.65

2. Customers to most likely Stay:

- Total_Trans_Amt >= 5365

Variable Importance

Total_Trans_Ct is the best predictor for Attrition, while Dependent_count is the worst.

Model Accuracy

This model predicts Attrited customers 75.5% of the time

This model misses its attrited customers 3.6% of the time

## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## | Chi-square contribution |
## |           N / Row Total |
## |           N / Col Total |
## |         N / Table Total |
## |-------------------------|
## 
##  
## Total Observations in Table:  2990 
## 
##  
##                                | validation_tree$Attrition_Flag_predicted 
## validation_tree$Attrition_Flag | Attrited Customer | Existing Customer |         Row Total | 
## -------------------------------|-------------------|-------------------|-------------------|
##              Attrited Customer |               364 |               118 |               482 | 
##                                |          1155.572 |           206.873 |                   | 
##                                |             0.755 |             0.245 |             0.161 | 
##                                |             0.802 |             0.047 |                   | 
##                                |             0.122 |             0.039 |                   | 
## -------------------------------|-------------------|-------------------|-------------------|
##              Existing Customer |                90 |              2418 |              2508 | 
##                                |           222.084 |            39.758 |                   | 
##                                |             0.036 |             0.964 |             0.839 | 
##                                |             0.198 |             0.953 |                   | 
##                                |             0.030 |             0.809 |                   | 
## -------------------------------|-------------------|-------------------|-------------------|
##                   Column Total |               454 |              2536 |              2990 | 
##                                |             0.152 |             0.848 |                   | 
## -------------------------------|-------------------|-------------------|-------------------|
## 
##  
## Statistics for All Table Factors
## 
## 
## Pearson's Chi-squared test 
## ------------------------------------------------------------
## Chi^2 =  1624.287     d.f. =  1     p =  0 
## 
## Pearson's Chi-squared test with Yates' continuity correction 
## ------------------------------------------------------------
## Chi^2 =  1618.706     d.f. =  1     p =  0 
## 
##