Sunday, 20 November 2011

Interactive presentations with deck.js

Data analysis is often an iterative and interactive process. However, when I present about this subject, I feel often limited by the presentation software I use. It doesn't matter if I use LaTeX/PDF, PowerPoint or Keynote. In all cases it is either very difficult or impossible to include interactive charts, such as Flash or SVG charts. As a result I have to switch between various applications during the talk. This can be fun, but quite often it is not.

The other day I came across a presentation by Christopher Gandrud. Christopher had used deck.js, a JavaScript library for building HTML presentations by Caleb Troughton.

This looked like an interesting approach to me and fortunately the learning curve was not too steep, although I am by no means an html or JavaScript expert. So I created my first deck.js presentation based on the content of previous googleVis presentations. For the first time I can embed videos, Flash and SVG charts without using lots of different apps. I am actually quite pleased by the result, see here: Getting started with googleVis

Now imagine a presentation hosted on a server with R installed! You could combine your slides with R using one of the following packages R.rsp, brew, Rook, etc and run live demos, without opening a console.

Saturday, 12 November 2011

Stochastic reserving with R: ChainLadder 0.1.5-1 released

Today we published version 0.1.5-1 of the ChainLadder package for R. It provides methods which are typically used in insurance claims reserving to forecast future claims payments.

Claims development and chain-ladder forecast of the RAA data set using the Mack method
The package started out of presentations given at the Stochastic Reserving Seminar at the Institute of Actuaries in 2007, 2008 and 2010, followed by talks at CAS meetings in 2008 and 2010.

Initially the package came with implementations of the Mack-, Munich- and Bootstrap Chain-Ladder methods. Since version 0.1.3-3 it also provides general multivariate chain ladder models by Wayne Zhang. Version 0.1.4-0 introduced new functions on loss development factor fitting and Cape Cod by Daniel Murphy following a paper by David Clark. Version 0.1.5-0 has added loss reserving models within the generalized linear model framework following a paper by England P. and Verrall R. (1999) implemented by Wayne Zhang.

For more details see the project web site: and an early blog entry about R in the insurance industry.

Changes in version 0.1.5-1:
  • Internal changes to plot.MackChainLadder to pass new checks introduced by R 2.14.0.
  • Commented out unnecessary creation of 'io' matrix in ClarkCapeCod function. Allows for analysis of very large matrices for CapeCod without running out of RAM. 'io' matrix is an integral part of ClarkLDF, and so remains in that function.
  • plot.clark method
    • Removed "conclusion" stated in QQplot of clark methods.
    • Restore 'par' settings upon exit
    • Slight change to the title
  • Reduced the minimum 'theta' boundary for weibull growth function
  • Added warnings to as.triangle if origin or dev. period are not numeric

Here is a little example using the googleVis package to display the RAA claims development triangle:

data(RAA) # example data set of the ChainLadder package
class(RAA) <- "matrix" # change the class from triangle to matrix
df <- # coerce triangle into a data.frame
names(df) <- 1981 : 1990
df$dev <-  1:10
plot(gvisLineChart(df, "dev", options=list(gvis.editor="Edit me!", hAxis.title="dev. period")))