Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. ##Funded Amount
  2. ```{r}
  3. #Graphs showing Funded Amount Frequencies and then splitting them up into those who paid off and those who defaulted
  4. data(data_cut, package="MASS")
  5. chargedOff <- split(data_cut, data_cut$loan_outcome)
  6. hist(data_cut$funded_amnt, main = "Funded Amount Frequencies", xlab = "Funded Amount")
  7. hist(chargedOff$`0`$funded_amnt, main = " Funded Amount Frequencies - Paid Off", xlab = "Funded Amount", ylim = c(0, 1000))
  8. hist(chargedOff$`1`$funded_amnt, main = "Funded Amount Frequencies - Default", xlab = "Funded Amount", ylim = c(0, 100))
  9. ```
  10.  
  11. After looking at the breakdowns, one key note we saw is that the people who defaulted had a higher average funded amount. For instance, a higher proportion of those who defaulted had a funded amount of $25,000 or higher than those who paid off a loan of $25,000 or higher. This aligns with what we expect, as the higher the fund amount, the more difficult it would be to pay it off.
  12.  
  13. ##Interest Rate
  14. ```{r}
  15. #Graphs showing Interest Rates and splitting them up into those who paid off and those who defaulted
  16. hist(data_cut$int_rate, main = "Interest Rate Frequencies", xlab = "Interest Rate", ylim = c(0, 800))
  17. hist(chargedOff$`0`$int_rate, main = "Interest Rate Frequencies - Paid Off", xlab = "Interest Rate", ylim = c(0, 700))
  18. hist(chargedOff$`1`$int_rate, main = "Interest Rate Frequencies - Default", xlab = "Interest Rate", ylim = c(0, 100))
  19. ```
  20.  
  21. Although the distributions for those who paid off loans and those who defaulted are similar, one thing we noticed is that everyone who defaulted had an interest rate of at least 5%. This aligns with what we'd expect because it's much easier to pay off loans that have low interest rates.
  22.  
  23. ##Purpose Breakdown
  24. ```{r}
  25. #Looking for significant differences in purposes for taking out the loan
  26. chargedOff$`0`$purpose <- factor(chargedOff$`0`$purpose)
  27. chargedOff$`1`$purpose <- factor(chargedOff$`1`$purpose)
  28. barplot(table(chargedOff$`0`$purpose), main = "Breakdown of Reason for Loan - Paid Off", xlab = "", ylab = "Count", names = c("car", "credit card", "debt conslidation", "educational", "home improvement", "house", "major purchase", "medical", "moving", "other", "renewable energy", "small business", "vacation", "wedding"),cex.names = .5, cex.main = .75, las = 2, ylim = c(0, 2000))
  29. barplot(table(chargedOff$`1`$purpose), main = "Breakdown of Reason for Loan - Default", xlab = "", ylab = "Count", names = c("car", "credit card", "debt conslidation", "educational", "home improvement", "house", "major purchase", "medical", "moving", "other", "small business", "vacation", "wedding"), cex.names = .5, cex.main = .75, las = 2, ylim = c(0, 250)) #no renewable energy
  30. ```
  31.  
  32. After seeing that the distribution of the reasons for taking a loan, we didn't find any significant differences between those who defaulted and those who paid off their loans.
  33.  
  34. ##Home Ownership Breakdown
  35. ```{r}
  36. chargedOff$`0`$home_ownership <- factor(chargedOff$`0`$home_ownership)
  37. chargedOff$`1`$home_ownership <- factor(chargedOff$`1`$home_ownership)
  38.  
  39. barplot(table(chargedOff$`0`$home_ownership), main = "Home Ownership Breakdown - Paid Off", xlab = "Home Ownership", ylab = "Count", names = c("Mortgage", "None", "Other", "Own", "Rent"), cex.names = .75, las = 2, col=c("red", "white", "blue", "green", "black"), ylim = c(0, 2500))
  40.  
  41. barplot(table(chargedOff$`1`$home_ownership), main = "Home Ownership Breakdown - Default", xlab = "Home Ownership", ylab = "Count", names = c("Mortgage", "Other", "Own", "Rent"), cex.names = .75, las = 2, col=c("red", "blue", "green", "black"), ylim = c(0, 300))
  42. ```
  43.  
  44. For the most part, the distribution of home ownership was similar for those who defaulted and those who paid off. One small difference is that of those who defaulted, a slightly lower proportion of them rent their homes and a slightly higher proportion of them mortgaged their homes. However, there was not a significant different in terms of home ownership for people who defaulted vs. people who paid off their loans.
  45.  
  46.  
  47. ##Number of Inquiries over the past 6 months
  48. ```{r}
  49. data(chargedOff, package="MASS")
  50. hist(data_cut$inq_last_6mths, main = "Inquires in Last 6 Months", xlab = "Number of Inquiries", ylim = c(0, 4000))
  51. hist(chargedOff$`0`$inq_last_6mths, main = "Inquires in Last 6 Months - Paid Off", xlab = "Number of Inquiries", ylim = c(0, 3500))
  52. hist(chargedOff$`1`$inq_last_6mths, main = "Inquires in Last 6 Months - Default", xlab = "Number of Inquiries", ylim = c(0, 350))
  53. ```
  54.  
  55. We saw two main trends here. The first is that the vast majority of those who received loans had fewer than 5 inquiries over the past 6 months (which makes sense because their odds of receiving a loan would likely decrease if they had more). Secondly, more interestingly, those who paid off had typically had more inquiries than those who defaulted. For example, the vast majority of those who defaulted had fewer than 3 inquiries. On the other hand, many of those who paid off had 4 or more inquiries.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement