Visit https://openacttexts.github.io/Loss-Data-Analytics/index.html#for-our-readers for the topic discussion.
Visit https://github.com/OpenActTexts/Loss-Data-Analytics/tree/master/Chapters for the data sets.
Visit https://openacttexts.github.io/LDARcode/#prerequisites for the R codes.
This is blah blaa
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
in_sample <- read.csv("PropertyFundInsample.csv", header = T,
na.strings = c("."), stringsAsFactors = FALSE)
in_sample_2010 <- subset(in_sample, Year == 2010)
head(in_sample_2010)
## PolicyNum Year LnCoverage BCcov Premium Freq Deduct y lny
## 5 120002 2010 3.157489 23511493 7994 1 1000 6838.87 8.830378
## 10 120003 2010 4.741850 114646079 36687 1 5000 9711.28 9.181043
## 15 120004 2010 3.461150 31853574 17839 1 1000 10323.50 9.242178
## 20 120005 2010 3.487794 32713698 12431 0 5000 0.00 0.000000
## 25 120008 2010 3.856969 47321724 16090 1 500 3469.79 8.151849
## 30 120009 2010 4.280644 72286976 15180 0 25000 0.00 0.000000
## yAvg lnDeduct Fire5 NoClaimCredit TypeCity TypeCounty TypeMisc
## 5 6838.87 6.907755 1 1 0 1 0
## 10 9711.28 8.517193 1 0 0 1 0
## 15 10323.50 6.907755 1 0 0 1 0
## 20 0.00 8.517193 1 0 0 1 0
## 25 3469.79 6.214608 1 0 0 1 0
## 30 0.00 10.126631 1 0 0 1 0
## TypeSchool TypeTown TypeVillage AC00 AC05 AC10 AC15
## 5 0 0 0 1 0 0 0
## 10 0 0 0 0 0 0 1
## 15 0 0 0 0 0 0 1
## 20 0 0 0 0 0 0 1
## 25 0 0 0 0 0 0 1
## 30 0 0 0 0 0 0 1
#summary(in_sample_2010)
library(pander)
table <- as.data.frame(table(in_sample_2010$Freq))
names(table) <- c("Number of Claims", "Frequency")
pander(t(table))
| Number of Claims | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| Frequency | 707 | 209 | 86 | 40 | 18 | 12 | 9 | 4 | 6 | 1 | 3 | 2 |
| Number of Claims | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 30 | 39 | 103 | 239 |
| Frequency | 1 | 2 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
pander(summary(in_sample_2010$Freq))
| Min. | 1st Qu. | Median | Mean | 3rd Qu. | Max. |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1.241 | 1 | 239 |
table_sev <- as.data.frame(in_sample_2010$yAvg)
names(table_sev) <- c("claims severity (2010)")
head(table_sev)
## claims severity (2010)
## 1 6838.87
## 2 9711.28
## 3 10323.50
## 4 0.00
## 5 3469.79
## 6 0.00