Capstone Project - Credit Risk of LendingClub
LendingClub is one of the earliest and largest financial-technology companies that provides loans to client. As a person working in a financial institute, I would like to know more detailed business trending of LendingClub by analyzing its historical data of loans issued. I will then use machine learning models on predicting the credit risk of the loans.
I found dataset from Kaggle with more than 2.2 million samples and 151 features that contains loans issued by LendingClub from 2007 to 2018.
There are many cells with missing value from the original dataset. I droped features with more than 80% of missing value. I also dropped features that do not affect the data analysis nor machine learning, such as zip code and loan ID. Next, I dropped samples with more than 80% of missing value as well.
For numerical features, I filled in the median to the null values and for categorical features, I filled in with mode to the null values.
Most of my analysis will be focusing on loan interest and loan amount. Therefore, Before I do anything to the dataset, let’s take a look of the distribution of these two essential features.
As shown below, the loan interest is slightly right skewed with median of 12.62%. 25/75 range is from 9.49% - 15.99%. Average of loan interest is 13.09%.
Same as loan interest, distribution of loan amount is also right skewed with average of $15,047 and median of $12,900. 25/75 range is from $8,000 – $20,000.
Grade is an essential feature that effects the loan amount and interest. When looking into the loan interest rate by grade as below, I found that interest rate increases from A to G. We can also tell that grade E, F, and G are having a wider range which I think may be caused by the outliers because the minimum rate of each of these three grades is 6%. The lowest rate is grade A with 5.31% while the highest rate is grade G with 30.99%. Loans under grade G is more profitable with a higher range of interest rate. However, this also indicates that loans with grade G has higher risk.
Below box plot shows the loan amount range of each grade. Loans under grade E, F, and G are having higher ranges of loan amount which means that borrowers who get E, F, or G are having larger loan amount of each transaction.
However, even though grade E, F, and G are having higher interest rate with larger loan amount, when I count the amount of loans of each grade as below, we can tell that LendingClub is having more business with grade B and C instead of the ones with high interest rate, i.e. grade G, which makes it less risky.
How about the trend of LendingClub’s business through the years? Below graph shows loan amount of LendingClub by year. It grew steeply from 2012 to 2015 and after 2017 especially on the grade A, B, C, and D, the loans with lower interest. What seems unusual to me is between 2015 and 2017, business trend looks more flat than significate growth. This made curious about what happened to the company during this period of time. After doing research, I found a news published by New York Times in 2018 with subject line stating “LendingClub Founder, Ousted in 2016, Settles Fraud Charges”. I also found some other articles/news indicating that LendingClub facing jurisdiction in 2016 after CEO resigned. I assume that this impacted company’s reputation and further negatively affected company’s business for a few years.
All loans were issued with tenor of 36 or 60 months. 60.3% of the loan amounts are issued under the tenor of 36 months which is less risky.
Shorter tenor also lowers the interest rate when we look into the graph below. Grade A, which has the lowest interest rate range, has more loans with 36 months’ tenor while grade G has more loans under tenor of 60 months than 36 months.
Does home ownership affect a borrower’s interest rate and amount? After analyzing the data, the answer is no. Correlation coefficient between interest rate and home ownership is 0.073. Correlation between loan amount and home ownership is -0.18. Which indicates that whether a borrower owns a real estate property or not, it doesn’t affect the interest rate and amount.
Most of loans were used for debt consolidation and credit card. However, based on my analysis, loan purpose does not affect a borrower’s interest rate and loan amount. Correlation coefficient is 0.097 between interest rate and loan purpose and it’s -0.15 between loan amount and loan purpose.
Below table indicates the number of loans with different loan status. There are 40 default loans among the 2.2 million samples and 269,320 were charged off. Charged off loans are the debt that company is no longer expecting to collect the funds as borrower has become delinquent on payment.
I therefore converted charged off to default since both of these types of loans are considered as bad debt and will be booked as reserve amount in company’s accounting record. After converting, we can tell that 80% of loans are fully paid and 20% are default. I’m excluding samples with other types of loan status as fully paid and default will be the good and bad debt to be worked on credit risk machine learning prediction on my later study.
Machine Learning Prediction
As indicated above, for machine learning, I selected samples with loan status of fully paid and default. Then I converted categorical features to numerical. After calculating the variance inflation factor (VIF) of the numerical features, I removed features with multicolinearity (VIF > 10) for linear models.
For tree based models, I used impalance-learn package to under sampling the fully paid samples and made it double size of default samples.
After applying 5 machine learning models, I got below result. Random Forest, Gradient Boosting, and Logit Classification are having more accurate test scores and higher recall and ROC AUC scores. However, gradient boosting is taking too much time to fit the model that I would not recommend to use due to the timing it costs.
From my analysis, I think that business of LendingClub is growing in a healthy shape with big increase of loan amount and lower risk since most of the loans provided are having lower interest rate and shorter tenor. There was an impact on its business during the year of 2015 and 2017 with some negative news. However, business was picked up again after 2017 with steep increase. Among the closed transactions, 80% were having good credit with fully paid amount. To predict the credit risk on the outstanding loans, I would recommend to use random forest or logit classification models.