Giter VIP home page Giter VIP logo

credit-loan-risk-calculation's Introduction

This project calculates the capital requirement for given mortgage loans by a bank according to both the standard approach and F-IRB approach established by the Basel committee.

Link

Standard approach

The standard approach is calculated simply by checking the loan to value (LTV) ratio and giving an according risk weight, with which the capital requirement is calculated.

F-IRB approach

This approach involves using formula for mortgage exposure made by the Basel committee. The most important part of the formula is probability of default (PD) which is calculated using the forecast of logistic regression.

Conclusion

As F-IRB is better at managing the risk which is brought by cyclic nature of economy, in this particular case where the percentage of defaulted loans (~19%) is so high, the F-IRB approach to calculating risk and the following capital requirement shows that capital requirement is much higher than the one calculated using the standard approach.
It could further be adjusted by changing the parameters of the logistic regression

Logistic regression

Data, cleaning, and preparing

  • There are 5442 observations and 16 features containing information about the credit history of the borrower as well as the information about the loan itself.
  • There are also 5212 empty cells. When an observation doesn't have mortgage value then it is dropped, otherwise, other empty cells get median or mean values depending which is lower (in every case the difference is negligible).
  • JOB column gets 6 dummy variables.
  • Few of the extreme outliers are dropped.
  • All of the columns get scaled using MinMaxScaler to values ranging from 0 to 1.
  • DEROG and DELINQ columns get maximum value for all observations having values above that particular value. As the complete majority of the values in these two features are less then 4 and 5 accordingly, any values above that get values 4 for DEROG and 5 for DELINQ. This is done to minimize the effect of those few outliers, especially considering that these features get scaled afterwards.
  • Similar to DEROG and DELINQ, DEBTINC gets value 100 if its original value is 100 and above.

Model building

Because the dataset does not contain many positive (defaulted) observations, resampling function is used (SMOTE).
Further, forward and backward stepwise resgression model selection is used.

Model evaluation

Coefficients:
const -1.2264
DELINQ 3.7080
DEROG 0.7345
NINQ 1.4585
CLAGE -4.6598
DEBTINC 6.1082
JOB_Office -0.5189
JOB_Sales 1.1965
YOJ -0.4465
VALUE -1.8367
JOB_ProfExe 0.0661
JOB_Self 0.5804

Odd ratios:
const 0.338274
DELINQ 43.616474
DEROG 2.170131
NINQ 4.069364
CLAGE 0.012491
DEBTINC 235.476192
JOB_Office 0.566841
JOB_Sales 2.731567
YOJ 0.646138
VALUE 0.200962
JOB_ProfExe 0.963847
JOB_Self 1.428451

Metrics: AUC_ROC score: 0.7244596920188633
Accuracy: 0.7628676470588235
Recall score: 0.6633663366336634

Confusion Matrix:
image

credit-loan-risk-calculation's People

Contributors

samodaas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.