Peer-to-peer lending on the Isle of Man (IM)

For background and methodology please visit: smtm.labs.theodi.org.

This document was written in R Markdown. You can ignore the first lines of syntax that loads the data.

setwd("~/Desktop/p2p/"); library(data.table); load("p2p-all.RData") 

# Lenders
setkey(p2p, area.len); im.len <- p2p["IM"]; saveRDS(im.len, file="im-len.RData")

# Recipients
setkey(p2p, area.bor); im.rec <- p2p["IM"]; saveRDS(im.rec, file="im-rec.RData")
library(data.table)
im.rec <- readRDS("~/Desktop/p2p/im-rec.RData")
im.len <- readRDS("~/Desktop/p2p/im-len.RData")

Here is the total loan amount for lenders and recipients.

Lenders: £158,484

Recipients: redacted, there is only one loan.


An overview of the IM data

data.table gives us a convenient overview of the data.

sum(complete.cases((im.len)))  # No. of loan parts lenders
## [1] 2831
# There is only one loan with 6 parts for recipients on the Isle of Man.
sum(complete.cases((im.rec)))  # No. of loan parts recipients
## [1] 6
im.len[, list(area.len, area.bor, term, loan.part.value, loan.rate)]
##       area.len area.bor term loan.part.value loan.rate
##    1:       IM       BT   36              20      8.00
##    2:       IM       DE   12              20      7.80
##    3:       IM       NN   36              20      7.20
##    4:       IM        G   36              20      9.00
##    5:       IM        G   36              40      9.90
##   ---                                                 
## 2827:       IM       SG   36              19      4.36
## 2828:       IM       CT   60              10      5.24
## 2829:       IM       CO   24              21      2.90
## 2830:       IM       BT   60              60      5.64
## 2831:       IM       CH   36             813      4.29

Let's count the number of loans.

loans.len <- im.len[, list(area.len = area.len[1], total.loans = sum(loan.part.value), 
    no.loan.parts = length(loan.part.value)), by = postcode.len]

loans.len[, -1, with = FALSE]
##     area.len total.loans no.loan.parts
##  1:       IM        4620           198
##  2:       IM       19401           356
##  3:       IM       37720           154
##  4:       IM        1280            44
##  5:       IM       21220           424
##  6:       IM        1120            56
##  7:       IM        1200            49
##  8:       IM        2160           105
##  9:       IM         900            21
## 10:       IM        4140            94
## 11:       IM         580            28
## 12:       IM       11960            37
## 13:       IM        2160            69
## 14:       IM       22420           179
## 15:       IM        1100            32
## 16:       IM         300            15
## 17:       IM          40             2
## 18:       IM         120             5
## 19:       IM         360            18
## 20:       IM         320            32
## 21:       IM       12310           873
## 22:       IM          40             4
## 23:       IM         100             4
## 24:       IM        5000             5
## 25:       IM         900             3
## 26:       IM        1406             7
## 27:       IM        4584            16
## 28:       IM        1023             1
##     area.len total.loans no.loan.parts

More statistics and a plot for lenders on the Isle of Man

summary(loans.len[, list(total.loans)])
##   total.loans   
##  Min.   :   40  
##  1st Qu.:  525  
##  Median : 1240  
##  Mean   : 5660  
##  3rd Qu.: 4715  
##  Max.   :37720

library(ggplot2)
ggplot(aes(total.loans), data = loans.len) + geom_histogram(fill = "#558800", 
    colour = "white", binwidth = 500) + theme_minimal() + xlab("Total loans for lenders (in £)")

plot of chunk unnamed-chunk-4

ggplot(aes(total.loans), data = loans.len) + scale_x_log10() + geom_density() + 
    xlab("Total loans for lenders in £ on a log scale") + theme_minimal() + 
    theme(axis.text.y = element_blank(), axis.ticks.y = element_blank())

plot of chunk unnamed-chunk-4