Predict attrition using the CreditCard data from the AER
package, using the classification algorithm from the rpart
package.
attrition by classifying
observations with an Attritioned User as 0, and with an
Existing customer as 1.Interesting how balance is perceived by many as a predictor for attrition. However, the data shows that it is not a good predictor
Using the validation data, it is observed that the model is able to:
##
##
## Cell Contents
## |-------------------------|
## | N |
## | Chi-square contribution |
## | N / Row Total |
## | N / Col Total |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 2990
##
##
## | validation_tree$atrittion_predicted
## validation_tree$atrittion_predicted | Attrited Customer | Existing Customer | Row Total |
## ------------------------------------|-------------------|-------------------|-------------------|
## Attrited Customer | 454 | 0 | 454 |
## | 2150.935 | 385.065 | |
## | 1.000 | 0.000 | 0.152 |
## | 1.000 | 0.000 | |
## | 0.152 | 0.000 | |
## ------------------------------------|-------------------|-------------------|-------------------|
## Existing Customer | 0 | 2536 | 2536 |
## | 385.065 | 68.935 | |
## | 0.000 | 1.000 | 0.848 |
## | 0.000 | 1.000 | |
## | 0.000 | 0.848 | |
## ------------------------------------|-------------------|-------------------|-------------------|
## Column Total | 454 | 2536 | 2990 |
## | 0.152 | 0.848 | |
## ------------------------------------|-------------------|-------------------|-------------------|
##
##
## Statistics for All Table Factors
##
##
## Pearson's Chi-squared test
## ------------------------------------------------------------
## Chi^2 = 2990 d.f. = 1 p = 0
##
## Pearson's Chi-squared test with Yates' continuity correction
## ------------------------------------------------------------
## Chi^2 = 2982.24 d.f. = 1 p = 0
##
##