## CLIENTNUM Attrition_Flag Customer_Age Gender
## Min. :708082083 Length:10127 Min. :26.00 Length:10127
## 1st Qu.:713036770 Class :character 1st Qu.:41.00 Class :character
## Median :717926358 Mode :character Median :46.00 Mode :character
## Mean :739177606 Mean :46.33
## 3rd Qu.:773143533 3rd Qu.:52.00
## Max. :828343083 Max. :73.00
## Dependent_count Education_Level Marital_Status Months_on_book
## Min. :0.000 Length:10127 Length:10127 Min. :13.00
## 1st Qu.:1.000 Class :character Class :character 1st Qu.:31.00
## Median :2.000 Mode :character Mode :character Median :36.00
## Mean :2.346 Mean :35.93
## 3rd Qu.:3.000 3rd Qu.:40.00
## Max. :5.000 Max. :56.00
## Total_Relationship_Count Months_Inactive_12_mon Contacts_Count_12_mon
## Min. :1.000 Min. :0.000 Min. :0.000
## 1st Qu.:3.000 1st Qu.:2.000 1st Qu.:2.000
## Median :4.000 Median :2.000 Median :2.000
## Mean :3.813 Mean :2.341 Mean :2.455
## 3rd Qu.:5.000 3rd Qu.:3.000 3rd Qu.:3.000
## Max. :6.000 Max. :6.000 Max. :6.000
## Credit_Limit Total_Revolving_Bal Avg_Open_To_Buy Total_Amt_Chng_Q4_Q1
## Min. : 1438 Min. : 0 Min. : 3 Min. :0.0000
## 1st Qu.: 2555 1st Qu.: 359 1st Qu.: 1324 1st Qu.:0.6310
## Median : 4549 Median :1276 Median : 3474 Median :0.7360
## Mean : 8632 Mean :1163 Mean : 7469 Mean :0.7599
## 3rd Qu.:11068 3rd Qu.:1784 3rd Qu.: 9859 3rd Qu.:0.8590
## Max. :34516 Max. :2517 Max. :34516 Max. :3.3970
## Total_Trans_Amt Total_Trans_Ct Total_Ct_Chng_Q4_Q1 Avg_Utilization_Ratio
## Min. : 510 Min. : 10.00 Min. :0.0000 Min. :0.0000
## 1st Qu.: 2156 1st Qu.: 45.00 1st Qu.:0.5820 1st Qu.:0.0230
## Median : 3899 Median : 67.00 Median :0.7020 Median :0.1760
## Mean : 4404 Mean : 64.86 Mean :0.7122 Mean :0.2749
## 3rd Qu.: 4741 3rd Qu.: 81.00 3rd Qu.:0.8180 3rd Qu.:0.5030
## Max. :18484 Max. :139.00 Max. :3.7140 Max. :0.9990
## Income_Category_num category gender random
## Min. :1.000 Blue :9436 F:5358 Min. :0.0000056
## 1st Qu.:1.000 Gold : 116 M:4769 1st Qu.:0.2525089
## Median :3.000 Platinum: 20 Median :0.5016194
## Mean :2.517 Silver : 555 Mean :0.5023248
## 3rd Qu.:4.000 3rd Qu.:0.7470072
## Max. :4.000 Max. :0.9998403
## Length Class Mode
## call 5 -none- call
## type 1 -none- character
## predicted 7092 factor numeric
## err.rate 1500 -none- numeric
## confusion 6 -none- numeric
## votes 14184 matrix numeric
## oob.times 7092 -none- numeric
## classes 2 -none- character
## importance 84 -none- numeric
## importanceSD 63 -none- numeric
## localImportance 0 -none- NULL
## proximity 0 -none- NULL
## ntree 1 -none- numeric
## mtry 1 -none- numeric
## forest 14 -none- list
## y 7092 factor numeric
## test 0 -none- NULL
## inbag 0 -none- NULL
## terms 3 terms call
## F M MeanDecreaseAccuracy
## CLIENTNUM 7.679832e-06 1.333327e-04 6.778123e-05
## Attrition_Flag 8.371777e-04 3.811598e-04 6.201778e-04
## Customer_Age 5.212504e-04 4.540929e-04 4.885742e-04
## Gender 4.365602e-01 4.302753e-01 4.334268e-01
## Dependent_count 2.221974e-04 1.557794e-04 1.906205e-04
## Education_Level 4.446188e-05 -2.422716e-05 1.171079e-05
## Marital_Status -8.399931e-05 -4.709447e-05 -6.664506e-05
## Months_on_book 1.399860e-04 2.870067e-04 2.109251e-04
## Total_Relationship_Count -2.167421e-05 2.686366e-04 1.179538e-04
## Months_Inactive_12_mon 6.364671e-05 -8.810994e-05 -8.809225e-06
## Contacts_Count_12_mon 1.429248e-04 -2.318454e-05 6.396599e-05
## Credit_Limit 9.707023e-03 5.960860e-03 7.931605e-03
## Total_Revolving_Bal 1.945295e-03 7.461970e-04 1.374096e-03
## Avg_Open_To_Buy 8.014606e-03 5.250204e-03 6.697451e-03
## Total_Amt_Chng_Q4_Q1 4.071804e-04 1.661245e-04 2.923338e-04
## Total_Trans_Amt 4.013895e-03 1.517835e-03 2.817033e-03
## Total_Trans_Ct 2.291935e-03 1.231418e-03 1.780932e-03
## Total_Ct_Chng_Q4_Q1 6.965964e-04 2.827197e-04 4.992159e-04
## Avg_Utilization_Ratio 3.725955e-03 4.646240e-03 4.167594e-03
## Income_Category_num 6.170379e-02 2.294890e-02 4.317259e-02
## category 1.159070e-03 -4.003628e-05 5.841923e-04
## MeanDecreaseGini
## CLIENTNUM 15.054802
## Attrition_Flag 5.012797
## Customer_Age 22.113059
## Gender 2419.786134
## Dependent_count 6.781050
## Education_Level 6.063436
## Marital_Status 4.264187
## Months_on_book 13.835814
## Total_Relationship_Count 5.623605
## Months_Inactive_12_mon 4.367662
## Contacts_Count_12_mon 6.178352
## Credit_Limit 159.333661
## Total_Revolving_Bal 14.005379
## Avg_Open_To_Buy 130.466162
## Total_Amt_Chng_Q4_Q1 15.412481
## Total_Trans_Amt 39.435299
## Total_Trans_Ct 21.933018
## Total_Ct_Chng_Q4_Q1 15.276820
## Avg_Utilization_Ratio 54.584855
## Income_Category_num 572.678314
## category 6.112345
## F M class.error
## F 3705 0 0
## M 0 3387 0
##
##
## Cell Contents
## |-------------------------|
## | N |
## | Chi-square contribution |
## | N / Row Total |
## | N / Col Total |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 3035
##
##
## | val$gender
## val$predicted_rf | F | M | Row Total |
## -----------------|-----------|-----------|-----------|
## F | 1653 | 0 | 1653 |
## | 629.300 | 752.700 | |
## | 1.000 | 0.000 | 0.545 |
## | 1.000 | 0.000 | |
## | 0.545 | 0.000 | |
## -----------------|-----------|-----------|-----------|
## M | 0 | 1382 | 1382 |
## | 752.700 | 900.300 | |
## | 0.000 | 1.000 | 0.455 |
## | 0.000 | 1.000 | |
## | 0.000 | 0.455 | |
## -----------------|-----------|-----------|-----------|
## Column Total | 1653 | 1382 | 3035 |
## | 0.545 | 0.455 | |
## -----------------|-----------|-----------|-----------|
##
##
The data used is from a CSV file named “CreditCardData”.
The number of observations in the dataset is 10,127.
The target prediction from this random forest is to see the trends in customer attrition amongst opposite genders (M and F).
All 18 variables outside of “Gender,” “Income_Category,” and “Card_Category” are predictors.
The data is split into training and validation sets using a random split: 70% of the data is used for training. 30% of the data is used for validation.
The Random Forest algorithm is employed for classification.
The importance of variables is assessed using the randomForest package. The importance score generated by the algorithm was 84.
Based on the confusion matrix from running the crosstable, the model accuracy was roughly 50.25%.
Given the assumptions, The financial impact would depend on the associated value of the balances of each of the customers who were predicted accurately. Customers who make more money and hold more money in accounts with this bank will not be swayed much by the perk of not having to pay a $100 fee. For people on the opposite end of the spectrum, the assumed factors could make a big impact on the decisions they make regarding remaining with this bank.