Notes from the 3rd R in Insurance Conference
| Photo: Arthur Charpentier |
Milliman, RStudio, CYBAEA, Deloitte, a.s.r., Triple A Risk Finance, AEGON, Delta Lloyd Amsterdam, QBE Re and APPLIED AI
This one-day conference focused once more on applications in insurance and actuarial science that use R. Topics covered included reserving, pricing, loss modelling, the use of R in a production environment and more.
Next summer we are back in London at Cass Business School.
The slides are now available from the links in the agenda below.
28 Jul 2015
07:52
Conference
,
Insurance
,
R
,
R in Insurance
MacBook Air battery replacement
After four years of daily use our MacBook Air informed us that it needed a battery replacement. That's kind of nice to know, in particular as it still feels speedy and otherwise just works.
A new battery isn't that expensive and according to iFixit it appeared to be quite easy to replace it. I needn't to worry, it was actually super simple, given appropriate tools:
Here are a few pictures of the surgery:
A new battery isn't that expensive and according to iFixit it appeared to be quite easy to replace it. I needn't to worry, it was actually super simple, given appropriate tools:
- Remove 10 screws from bottom case
- Open case
- Disconnect battery
- Remove 5 screws from battery
- Swap battery
- Reassemble everything back together
- Job done.
Here are a few pictures of the surgery:
| Lower case with screws removed |
| Old battery pack |
| New battery pack |
21 Jul 2015
07:55
Battery
,
MacBook Air
,
Soapbox
ChainLadder 0.2.1 released
Over the weekend we released version 0.2.1 of the ChainLadder package for claims reserving on CRAN.
Binary versions of the package will appear on the various CRAN mirrors over the next couple of days. Alternatively you can install ChainLadder directly from GitHub using the following R commands:
Completely new to ChainLadder? Start with the package vignette.
New Features
- New function
PaidIncurredChainby Fabio Concina, based on the 2010 Merz & Wüthrich paper Paid-incurred chain claims reserving method - Functions
plot.MackChainLadderandplot.BootChainLaddergained new argumentwhich, allowing users to specify which sub-plot to display. Thanks to Christophe Dutang for this suggestion.
![]() |
Output of plot(MackChainLadder(MW2014, est.sigma="Mack"), which=3:6) |
Changes
- Updated
NAMESPACEfile to comply with new R CMD checks in R-3.3.0 - Removed package dependencies on
grDevicesandHmisc - Expanded package vignette with new paragraph on importing spreadsheet data, a new section "Paid-Incurred Chain Model" and an added example for a full claims development picture in the "One Year Claims Development Result" section, see also [1] .
Binary versions of the package will appear on the various CRAN mirrors over the next couple of days. Alternatively you can install ChainLadder directly from GitHub using the following R commands:
install.packages(c(“systemfit”, “actuar", "statmod", "tweedie", "devtools"))
library(devtools)
install_github("mages/ChainLadder")
library(ChainLadder)Completely new to ChainLadder? Start with the package vignette.
References
[1] Claims run-off uncertainty: the full picture. (with M. Merz) SSRN Manuscript, ID 2524352, 2014.
14 Jul 2015
07:05
ChainLadder
,
Insurance
,
R
,
reserving
Adding mathematical notations to R plots
I have to admit that I find the
Apparently I am not the only one, but Stefano Meschiari did actually something about it. A few days ago his package
The package provides the wonderful function
Below is the first example from the
You find more information about
plotmath expressions in R a little fiddly to annotate plots with mathematical notation. Apparently I am not the only one, but Stefano Meschiari did actually something about it. A few days ago his package
latex2exp appeared on CRAN. The package provides the wonderful function
latex2exp that translates LaTeX code into plotmath expressions. Brillant! All I have to remember is to escape the "\" character, that is write "\\" instead of "\".Below is the first example from the
plotmath help file and again using latex2exp. I think this is much easier to read and write.You find more information about
latex2exp on Stefano's web site and his GitHub repository.Session Info
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] latex2exp_0.3.1
loaded via a namespace (and not attached):
[1] magrittr_1.5 tools_3.2.1 Rcpp_0.11.6 stringi_0.5-5 stringr_1.0.0
Notes from the Kölner R meeting, 26 June 2015
Last Friday the Cologne R user group came together for the 14th time. For the first time we met at Startplatz, a start-up incubator venue. The venue was excellent, not only did they provide us with a much larger room, but also with table-football and drinks. Many thanks to Kirill for organising all of this!
We had two excellent advanced talks. Both were very informative and well presented.
Imagine you have several servers that generate large data sets with no standard delimiters, like the example below.
The columns appear to be separated by a blank at first glance, but the second column (Military) has strings such as Air Force that include a blank itself. Furthermore, other columns have missing data (Month) and another uses speech-marks (Car). Thus, it's messy and difficult to read into R.
To solve the problem Kirill developed a Makefile that uses tools such as
Kirill's tutorial files are available via GitHub.
Paul Viefers gave a great introduction to Stan and RStan, with a focus on explaining the differences to other MCMC packages such as JAGS.
Stan is a probabilistic programming language for Bayesian inference. One of the major challenges in Bayesian analysis is that often there is no analytical solution for the posterior distribution. Hence, the posterior distribution is approximated via simulations, such as Gibbs sampling in JAGS. Stan, on the other hand, uses Hamiltonian Monte Carlo (HMC), an algorithm that is more subtle in proposing jumps, using more structure by translation into Hamiltonian mechanics framework.
Paul ended his talk by walking us through the various building blocks of a Stan script, using a hierarchical logistic regression example.
You can access Paul's slides on RPubs.
![]() |
| Photo: Günter Faes |
Data Science at the Command Line
Kirill Pomogajko showed us how he uses various command line tools to pre-process log-files for further analysis with R.![]() |
| Photo: Günter Faes |
The columns appear to be separated by a blank at first glance, but the second column (Military) has strings such as Air Force that include a blank itself. Furthermore, other columns have missing data (Month) and another uses speech-marks (Car). Thus, it's messy and difficult to read into R.
To solve the problem Kirill developed a Makefile that uses tools such as
scp, sed and awk to download and clean the server files. Kirill's tutorial files are available via GitHub.
An Introduction to RStan and the Stan Modelling Language
Paul Viefers gave a great introduction to Stan and RStan, with a focus on explaining the differences to other MCMC packages such as JAGS.
![]() |
| Photo: Günter Faes |
Stan is a probabilistic programming language for Bayesian inference. One of the major challenges in Bayesian analysis is that often there is no analytical solution for the posterior distribution. Hence, the posterior distribution is approximated via simulations, such as Gibbs sampling in JAGS. Stan, on the other hand, uses Hamiltonian Monte Carlo (HMC), an algorithm that is more subtle in proposing jumps, using more structure by translation into Hamiltonian mechanics framework.
Paul ended his talk by walking us through the various building blocks of a Stan script, using a hierarchical logistic regression example.
You can access Paul's slides on RPubs.
Drinks and Networking
No Cologne R user group meeting is complete without Kölsch and networking. In the end some of us ended up in a fancy burger place.Next Kölner R meeting
The next meeting will be scheduled in September. Details will be published on our Meetup site. Thanks again to Revolution Analytics for their sponsorship.
30 Jun 2015
20:41
Koelner R User
,
Kölner R Users
,
make
,
R
,
rstan
Next Kölner R User Meeting: Friday, 26 June 2015
The next Cologne R user group meeting is scheduled for this Friday, 6 June 2015 and we have an exciting agenda with two talks followed by networking drinks.
- Data Science at the Commandline (Kirill Pomogajko)
- An Introduction to RStan and the Stan Modelling Language (Paul Viefers)
Drinks and Networking
The event will be followed by drinks (Kölsch!) and networking opportunities.For further details visit our KölnRUG Meetup site. Please sign up if you would like to come along. Notes from past meetings are available here.
The organisers, Bernd Weiß and Markus Gesmann, gratefully acknowledge the sponsorship of Revolution Analytics, who support the Cologne R user group as part of their Matrix programme.
23 Jun 2015
06:47
Kölner R Users
,
KölnR
,
News
,
R
How to place titles in lattice plots
I like the Economist theme in the
For some time I wondered how I could put the title of my
Furthermore, I can use the same approach to place a sub-title in the bottom left corner of my chart, e.g. to describe the source of my data:
For more information see also the lattice help pages or the lattice book by Deepayan Sarkar: Lattice: Multivariate Data Visualization with R.
latticeExtra package. It produces nice looking charts that mimic the design of the weekly newspaper, such as in this example:For some time I wondered how I could put the title of my
lattice plots into the top left corner as well (by default titles are centred). Reviewing the code of the theEconomist.theme function by Felix Andrews reveals the trick. It is the setting of par.main.text:library(lattice)
my.settings <- list(
par.main.text = list(font = 2, # make it bold
just = "left",
x = grid::unit(5, "mm")))
xyplot(sin(1:100) ~ cos(1:100),
par.settings=my.settings,
main="Hello World",
type="l")
Furthermore, I can use the same approach to place a sub-title in the bottom left corner of my chart, e.g. to describe the source of my data:
my.settings <- list(
par.main.text = list(font = 2, # make it bold
just = "left",
x = grid::unit(5, "mm")),
par.sub.text = list(font = 1,
just = "left",
x = grid::unit(5, "mm"))
)
xyplot(sin(1:100) ~ cos(1:100),
par.settings=my.settings,
main="Hello World",
sub="Source: Nobody knows",
type="l")
For more information see also the lattice help pages or the lattice book by Deepayan Sarkar: Lattice: Multivariate Data Visualization with R.
Session Info
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lattice_0.20-31
loaded via a namespace (and not attached):
[1] tools_3.2.0 grid_3.2.0
16 Jun 2015
07:35
lattice
,
latticeExtra
,
R








