Summary
The lending data comes from 5 years of investment in a crowd-lending platform, the purpuse of creating this tables is to have a scorecard to decide how to invest based on real data of the of the credit’s behavior classified by the Credit Score.
The Credit Score can be A for a person who has a very good credit history in the Mexican Bureau of Credit, to G being the lower score. Of course, credits with better score have a lower interest rate. This game is about manage the risk.
Data Source :
Personal information about investment from a crowd-lending platform known as Prestadero.
www.prestadero.com
Formating:
R Code
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.3.6 ✔ purrr 0.3.4
✔ tibble 3.1.8 ✔ dplyr 1.0.10
✔ tidyr 1.2.1 ✔ stringr 1.4.1
✔ readr 2.1.2 ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
library (gt)
lending <- read_csv ('lending.csv' , show_col_types = FALSE )
lending$ capital_int <- lending$ interes_p+ lending$ interes_m+ lending$ capital_p
#grouping by score
lending_t1 <- lending %>% filter (year <= 2019 & status %in% c ("PAGADO" ,"LIBERADO" )) %>% select ( score, amt_inv, interes_rate, capital_p, capital_int) %>% group_by (score) %>% summarise (credits= n (), interest_avg = mean (interes_rate),ammount_inv= sum (amt_inv), cap_int = sum (capital_int)) %>% dplyr:: mutate (profit_pct = cap_int/ ammount_inv - 1 ) %>% gt ()
#formatting
#tittles and footnotes
lending_t1 <- lending_t1 %>% tab_header (
title = md ("**Performance of Investment by Credit Score**" ),
subtitle = md ( "*Credit Score* provided by Credit Bureau" )
) %>% tab_source_note (
source_note = "Source: Crowd-Lending investment, credits granted between 2017 and 2019."
)
#
lending_t1 <- lending_t1 %>% cols_label ( score = md ("**Credit \n Score**" ), credits = md ("**Credits**" ), interest_avg = md ("**Interest Rate** \n (Average)" ), ammount_inv = md ("**Ammount Invested**" ), cap_int = md ("**Capital + Interest**" ), profit_pct = md ("**Profit Percentage**" ))
lending_t1
Credit
Score
Credits
Interest Rate
(Average)
Ammount Invested
Capital + Interest
Profit Percentage
A
3
10.23333
2500.00
2233.595
-0.10656184
B
35
13.32857
16750.00
19191.686
0.14577228
C
107
15.99346
45497.39
53698.737
0.18025984
D
142
18.99155
52974.24
59546.300
0.12406143
E
58
21.84828
18866.05
20185.792
0.06995317
F
26
24.93846
9250.00
8852.453
-0.04297807
G
13
27.59231
4250.00
3686.879
-0.13249915
Source: Crowd-Lending investment, credits granted between 2017 and 2019.