Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Capstone Project | Project Notes 1

Submission date: 15th September 2019


Submitted by: Kamal Aggarwal

Introduction
The credit card industry of the banking domain has always been a major concern for the
banks in terms of identifying legitimate customers. There is a strong need for risk prediction
especially in the financial industry to help manage uncertainty. Banking operations are
something that we all come across in our daily lives. In the recent years the use of credit card
has become very popular as it is one of the most convenient payment options for everyone.
However, this convenience does come with its own risk for the banks. As the number of
customers using credit cards increase, more efforts need to be taken to consider managing the
risk involved in terms of delinquency. The overall objective of risk management is to utilize the
past behavioural information of the customers- financial, demographic, personal information,
and understand the patterns to make sound decisions for optimizing their profit.
The traditional approach to building a credit risk model, wherein the probability of
default is to be estimated, utilizes a Logistic Regression methodology which not only gives good
accuracy rate but also has easily interpretable results. But with the recent advancements in
machine learning techniques, it is a good time to explore other ways to build risk prediction
models. Credit risk here means the probability of a delay in the repayment of the credit granted.
We expect to address one main question: Are there other methods apart from Logistic
Regression that can perform well on this credit risk data to predict the defaulters.
This report contains two parts devoted to Exploratory Analysis and Prediction Models. I
have tried to touch on the most popular methods and algorithms in order to find the best model
which will help predict default and to answer the questions:
i. How does the probability of default payment vary by categories of different
demographic variables?
ii. Which variables are the strongest predictors of default payment?
Objective
This project aims at the case of customers’ default payments in Taiwan. We are expected to
calculate the probability of default for a customer and further use multiple models to compare
their predictive accuracy. From the perspective of risk management, the result of predictive
accuracy of the estimated probability of default will be more valuable than the binary result of
classification - credible or not credible clients.

Data Overview
Data Description:
The dataset contains information on default payments, demographic factors, credit data,

history of payment, and monthly bill statements of 30,000 credit card clients in Taiwan from
April 2005 to September 2005. We used the following 23 variables as explanatory variables:
X1: Amount of the given credit.
X2: Gender (1 = male; 2 = female).

X3: Education (1 = graduate school; 2 = university;3= high school; 4 = others).


X4: Marital status (1 = married; 2 = single; 3 = others).
X5: Age (year).

X6–X11: History of past payment. X6 = the repayment status in September, 2005; X7 = the
repayment status in August, 2005; . . .; X11 = the repayment status in April, 2005. The
measurement scale for the repayment status is: -1= pay duly; 1 = payment delay for one month;
2
= payment delay for two months; . . .; 8 = payment delay for eight months; 9 = payment delay for
nine months and above.

X12–X17: Amount of bill statement. X12 = amount of bill statement in September, 2005; X13 =
amount of bill statement in August, 2005; . . .; X17 = amount of bill statement in April, 2005.
X18–X23: Amount of previous payment. X18 = amount paid in September, 2005; X19 = amount
paid in August, 2005; . . .; X23 = amount paid in April, 2005

Importing Data
PD_Taiwan <-read.csv("D:/Bhpl_OneDrive/OneDrive - BHPL/kamalagg/PGPBABIO/Project.
Capstone/ Taiwan-Customer defaults.csv", header = TRUE)
Exploratory Data Analysis:

There are 25 columns, all numeric values. Our target attribute is 'default payment next month',
there are almost 4times cases of non-default versus default cases.
Average age of the applicants being 35.5 years, with a standard deviation of 9.2. The average value
of the amount of credit card limit is 167,484. The standard deviation is unusually large, max value
being 1M indicating more variance in the credit limit amount.
Females constitute higher proportion of credit card applicants (60%) and the education level of
the applicants are mostly graduate school and university. The marital status is either married or
single. Also, the correlation of the repayment status is decreasing between months with lowest
correlations between Sept-April.
## We observe undocumented values for repayment status variables: -2 and 0 in payment status.
Moreover, fraction of it is 86.5% so it is “NAs”. Due to this, there are several standard strategies
to deal with:

• Remove observations with NAs. After that we will have 4061 from 30000
observations. Obviously, the loss is too great.
• Delete variables.
• Replace NAs by major class. But our NA is a major class already. Additionally, it does not look
like NAs are random. So, this is a wrong approach in our case.
• Keep this data as an “NA classes”.
• The best decision at this stage of the research and we should keep this data “as is”.
• The more educated cardholders have the less chances to default. However, the situation
changes with the increasing of AGE parameter. With age, the impact of education to default
decreases.

Visual inspection of data (rows, columns, descriptive details)

• dim(PD_Taiwan) - There are 30000 rows and 25 columns meaning that there are there
are 25 variables each for 30000 datasets
• Attributes :
• attributes(PD_Taiwan)
• $`names`
• [1] "ID" "LIMIT_BAL" "SEX" "EDUCATION" "MARRIAGE" "AGE" "PAY_0" "PAY_2"
• [9] "PAY_3" "PAY_4" "PAY_5" "PAY_6" "BILL_AMT1" "BILL_AMT2" "BILL_AMT3" "BILL_AMT4"
• [17] "BILL_AMT5" "BILL_AMT6" "PAY_AMT1" "PAY_AMT2" "PAY_AMT3" "PAY_AMT4" "PAY_AMT5" "PAY_AMT6"
• [25] "default"

• $row.names
• [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
• [19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
• [37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
• [55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
• [73] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
• [91] 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
• [109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
• [127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
• [145] 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
• [163] 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
• [181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
• [199] 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
• [217] 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
• [235] 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
• [253] 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
• [271] 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
• [289] 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
• [307] 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
• [325] 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
• [343] 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
• [361] 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
• [379] 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
• [397] 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
• [415] 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
• [433] 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
• [451] 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
• [469] 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486
• [487] 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
• [505] 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
• [523] 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
• [541] 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
• [559] 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
• [577] 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
• [595] 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
• [613] 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630
• [631] 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648
• [649] 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666
• [667] 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684
• [685] 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702
• [703] 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
• [721] 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738
• [739] 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
• [757] 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774
• [775] 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792
• [793] 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810
• [811] 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
• [829] 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846
• [847] 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
• [865] 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
• [883] 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900
• [901] 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918
• [919] 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936
• [937] 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954
• [955] 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972
• [973] 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990
• [991] 991 992 993 994 995 996 997 998 999 1000
• [ reached getOption("max.print") -- omitted 29000 entries ]

• $class
• [1] "tbl_df" "tbl" "data.frame"
summary(PD_Taiwan)
ID LIMIT_BAL SEX EDUCATION MARRIAGE AGE
Min. : 1 Min. : 10000 Min. :1.000 Min. :0.000 Min. :0.000 Min. :21.00
1st Qu.: 7501 1st Qu.: 50000 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:28.00
Median :15000 Median : 140000 Median :2.000 Median :2.000 Median :2.000 Median :34.00
Mean 15000 Mean : 167484 Mean :1.604 Mean :1.853 Mean :1.552 Mean :35.49
3rd Qu.:22500 3rd Qu.: 240000 3rd Qu.:2.000 3rd Qu.:2.000 3rd Qu.:2.000 3rd Qu.:41.00
Max. :30000 Max. :1000000 Max. :2.000 Max. :6.000 Max. :3.000 Max. :79.00
PAY_0 PAY_2 PAY_3 PAY_4 PAY_5
Min. :-2.0000 Min. :-2.0000 Min. :-2.0000 Min. :-2.0000 Min. :-2.0000
1st Qu.:-1.0000 1st Qu.:-1.0000 1st Qu.:-1.0000 1st Qu.:-1.0000 1st Qu.:-1.0000
Median : 0.0000 Median : 0.0000 Median : 0.0000 Median : 0.0000 Median : 0.0000
Mean :-0.0167 Mean :-0.1338 Mean :-0.1662 Mean :-0.2207 Mean :-0.2662
3rd Qu.: 0.0000 3rd Qu.: 0.0000 3rd Qu.: 0.0000 3rd Qu.: 0.0000 3rd Qu.: 0.0000
Max. : 8.0000 Max. : 8.0000 Max. : 8.0000 Max. : 8.0000 Max. : 8.0000
PAY_6 BILL_AMT1 BILL_AMT2 BILL_AMT3 BILL_AMT4
Min. :-2.0000 Min. :-165580 Min. :-69777 Min. :-157264 Min. :-170000
1st Qu.:-1.0000 1st Qu.: 3559 1st Qu.: 2985 1st Qu.: 2666 1st Qu.: 2327
Median : 0.0000 Median : 22382 Median : 21200 Median : 20089 Median : 19052
Mean :-0.2911 Mean : 51223 Mean : 49179 Mean : 47013 Mean : 43263
3rd Qu.: 0.0000 3rd Qu.: 67091 3rd Qu.: 64006 3rd Qu.: 60165 3rd Qu.: 54506
Max. : 8.0000 Max. : 964511 Max. :983931 Max. :1664089 Max. : 891586
BILL_AMT5 BILL_AMT6 PAY_AMT1 PAY_AMT2 PAY_AMT3
Min. :-81334 Min. :-339603 Min. : 0 Min. : 0 Min. : 0
1st Qu.: 1763 1st Qu.: 1256 1st Qu.: 1000 1st Qu.: 833 1st Qu.: 390
Median : 18105 Median : 17071 Median : 2100 Median : 2009 Median : 1800
Mean : 40311 Mean : 38872 Mean : 5664 Mean : 5921 Mean : 5226
3rd Qu.: 50191 3rd Qu.: 49198 3rd Qu.: 5006 3rd Qu.: 5000 3rd Qu.: 4505
Max. :927171 Max. : 961664 Max. :873552 Max. :1684259 Max. :896040
PAY_AMT4 PAY_AMT5 PAY_AMT6 default
Min. : 0 Min. : 0.0 Min. : 0.0 0:23364
1st Qu.: 296 1st Qu.: 252.5 1st Qu.: 117.8 1: 6636
Median : 1500 Median : 1500.0 Median : 1500.0
Mean : 4826 Mean : 4799.4 Mean : 5215.5
3rd Qu.: 4013 3rd Qu.: 4031.5 3rd Qu.: 4000.0
Max. :621000 Max. :426529.0 Max. :528666.0

• No. of defaulters : -

default freq

1 0 23364

2 1 6636

• count according to gender. 1= Male, 2= Female

• count according to education. 1= Graduate School, 2= University, 3= High school, 4= others


• count according to marriage. 1= married, 2= single, 3= others

• Missing values – Nil missing value found

• Correlation Matrix
Multicolinerity

There is high level of linear correlations between the amount of bill statements in
different months
#install.packages('corrgram')
library(corrgram)
corrgram(PD_Taiwan_num, order = TRUE, lower.panel =
panel.ellipse, upper.panel = panel.pts, text.panel = panel.txt,
diag.panel = panel.minmax)

Summary
After exploratory analysis we already have a picture about predictors’ impact to
response variable:
• LIMIT_BAL: Amount of given credit in NT dollars (includes individual and
family/supplementary credit)
o Impact to default - The lower the amount of given credit limit of the
balance owing, the bigger the chances to default.
• SEX: Gender (1=male, 2=female)
o Impact to default- Male persons have more chances to default.
• EDUCATION: (1=graduate school, 2=university, 3=high school, 4=others)
o Impact to default - The better education the lower chances to default.
• MARRIAGE: Marital status (1=married, 2=single, 3=others)
o Impact to default - Married persons have more chances to default.
• AGE: Age in years
o Impact to default - The biggest chance of default is in the age group
under 25 and the smallest for 25 - 34 age group.
• PAY_0..6: Repayment status in September .. April, 2005 (-1=pay duly,
1=payment delay for one month, 2=payment delay for two months, …
8=payment delay for eight months, 9=payment delay for nine months and
above)
o Impact to default - Having a delay, even for 1 month in any of the
previous months, increases the chance of default.
• BILL_AMT1..6: Amount of bill statement in September .. April, 2005 (NT dollar)
o Impact to default -The smaller the difference between the amount owed
on the bill in September and April, the bigger the chances to default.
• PAY_AMT1..6: Amount of previous payment in September .. April, 2005 (NT
dollar)
o Impact to default - The smaller the payment amount, the bigger the
chance of default.

You might also like