[R-sig-ins] R-SIG-insurance Digest, Vol 22, Issue 3

Dan Murphy chiefmurphy at gmail.com
Sun Sep 28 21:21:25 CEST 2014


Ed:

I agree that it would be nice to have a packaged set of functions for
dealing with GI data in R because that would help the adoption of R by
actuaries and other analysts in the insurance space.

IMO, the issues of "importing" data are different from the issues of
aggregating (quarterly to annual), differencing/accumulating
(cum2incr/incr2cum, already in ChainLadder), etc. But, again, it
"would be nice" if that functionality were concentrated in one place.

For importing data from databases and excel I have used RODBC,
XLConnect, gdata, xlsx, and others. All have their pros and cons.Do
you also want to "export" data to excel?

Other manipulations are straightforward (maybe not for beginners) when
summarized data is in matrix format. Things become more complicated
when dealing with detailed data, partial periods, fiscal years,
missing data, staggered development ages, etc. Effectively dealing
with those complications is, of course, the reason for having that
code available!

I also have the same questions as Christophe. Are you only interested
in triangle data for reserving? Do you also want to simplify the
creation of data.frames for pricing? Do you want to simplify the
creation of time series for ERM and other financial modeling problems?

I am a strong advocate of R in the Casualty Actuarial Society and
would be willing to collaborate on your endeavor.

Dan Murphy
ChainLadder
mondate


> From: Christophe Dutang <dutangc at gmail.com>
> To: Edward Roche <ed.roche at yahoo.co.uk>
> Cc: r-sig-insurance at r-project.org
> Subject: Re: [R-sig-ins] General Insurance Data
> Message-ID: <263CECA0-CB51-4A21-9920-F9E5A1F00FBD at gmail.com>
> Content-Type: text/plain; charset=windows-1252
>
> Dear Edward,
>
> To my knowledge, there is no single package doing data manipulation in the insurance context.
>
> There are package for manipulating from database manager and other proprietary softwares : see http://cran.r-project.org/doc/manuals/r-release/R-data.html
>
> Maintaining the CASdatasets package, I face to some of your problem to read SAS or excel files. Typically the case, where there is a separator for thousand. I did write some R functions :
> - readfunc(filelist, yearlist, sheetname, pattern, nrow, ncol, colname, col2conv, echo=FALSE, row2rm=NULL) : read a list of excel file to extract the same sheet and concatenate the whole
> - str2num(x) : convert a character string to a numeric dealing with thousand separator
> - concatmultcol(df, nbinfo, nbblock, col2foot, col2conv, col2rmpre, cm2rmpost, cname2trunc=NULL, echo=FALSE) : concatenate blockwise data into a rowwise dataframe
> etc...
> In such function, I read excel files with gdata package.
>
> As you say, for manipulating triangles, there are functions in ChainLadder. By the way, I propose cum2incr and incr2cum to M. Gesmann. Another function shrinkTriangle was not kept in this package: this function computes an annual triangle from a monthly or quarterly basis.
>
> For manipulating string, there is a good book by Gaston Sanchez, see http://gastonsanchez.com/work/
>
> At the last R in insurance conf, there was a good presentation of data manipulation (see http://www.cass.city.ac.uk/news-and-events/conferences/r-in-insurance-2014/r-in-insurance,-conference-programme and ask for presentation file).
>
> Do you have a detailed list of what type of data you want to manipulate? for which purpose? (is it only for reserving purpose?)
> If you are willing to create a package, I will be happy to contribute.
>
> Regards, Christophe
> ?
> Christophe Dutang
> LMM, UdM, Le Mans, France
> web: http://dutangc.free.fr
>
> Le 27 sept. 2014 ? 01:16, Edward Roche <ed.roche at yahoo.co.uk> a ?crit :
>
>> Hi all,
>> I am interested in a package for working with General Insurance data, i.e. something that deals with the initial stage of getting GI data into R, reshaping it and subsetting it before performing projections using packages such as ChainLadder or claim development visualisations using googlevis.
>>
>> When working with GI data before you can do any meaningful analysis or projections you need to get your data in the right format. Typically you might start with incremental long format data showing claim transactions and this needs to be reshaped and summarised into triangle matrices (e.g.  paid and incurreds). You can then perform projections with packages such as ChainLadder or other simple development methods. This initial manipulation stage is not always easy to do especially for novice users of R. There are helper functions in the ChainLadder package such as incr2cum, as.triangle etc that let you perform conversions on the fly but I cant find anything for the wholesale restructuring or manipulation of GI data such as converting it from Annual Quarterly to Annual Annual etc. This type of manipulation is very easy to do in some proprietary software (not R based) that I use on a daily basis.
>> I am considering working on a package that would generally provide helper functions to load untidy GI data into R and let a novice R user perform restructuring and manipulation on the fly.  I envisage a GUI such as is available in Rattle to load the data and specify the key variables and formats. Once the data is loaded intuitive helper functions would let you manipulate it on the fly. For example you might wish to pick out paid and incurred triangles, subset the data in some way or convert it to Annual Annual or from cumulative to incremental.
>>
>> My question for this mailing list is are there any such packages out there? or is anyone working on something like this? I would love to get involved if so. Any other thoughts?
>>
>> Thanks
>> Ed
>>
>> _______________________________________________
>> R-SIG-insurance mailing list
>> R-SIG-insurance at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-insurance
>
>
>
> ------------------------------
>
> _______________________________________________
> R-SIG-insurance mailing list
> R-SIG-insurance at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-insurance
>
>
> End of R-SIG-insurance Digest, Vol 22, Issue 3
> **********************************************



More information about the R-SIG-insurance mailing list