Publications by PirateGrunt
Loss reserving has a new, silly name
I started using Git some time ago, but mostly for local work files. Today, I finally sync’ed up a repository for loss reserving analysis. It may be found here: https://github.com/PirateGrunt/MRMR MRMR stands for Multivariate Regression Model for Reserves. When pronounced “Mister Mister” it also sounds like a thankfully forgotten American so...
1714 sym R (1214 sym/1 pcs) 8 img
Object Orientation in R – Notes from a novice
Having posted some code to Git a few days ago and having been wholly dissatisfied with it, I began to do what I often do with code I don’t like. I started re-writing it bigger and weirder and more philosophically pure. Part of this search for Platonic code lead me to explore object oriented programming in R. To me, OOP is very similar to relati...
7169 sym Python (2867 sym/2 pcs) 4 img
Building a package in RStudio is actually very easy
So, you’ve written some code and you use it routinely. Now you’ve written some code and you’d like to use version control to ensure that development continues in a robust fashion. You do that and you use Github or something so that not only are changes tracked, but the general public receives the benefit of your knowledge. At the same time,...
3034 sym R (116 sym/1 pcs) 4 img
Clustering Loss Development Factors
Anytime I get a new hammer, I waste no time in trying to find something to bash with it. Prior to last year, I wouldn’t have known what a cluster was, other than the first half of a slang term used to describe a poor decision-making process. Now I’ve seen it in action a few times and have searched for a practical case where I could use it. It...
3506 sym 10 img
Callback functions for GUI widgets
Of all the things I dislike about R, one of the biggest is the fact that you can declare a function within the list of arguments to another function. I’ve gotten over it for very minor operations needed by things like lapply, but it can drive me bonkers elsewhere. One such instance is writing an event handler using the gwidgets package. Here’...
2205 sym R (1923 sym/4 pcs) 4 img
Passing columns of a dataframe to a function without quotes
I love the syntax of calls to lm and ggplot, wherein the dataframe is specified as a variable and specific columns are referenced as though they were separate variables. While developing some of my functions, I’d wanted to introduce something similar. I often find that I have a single large dataframe and want to execute the same function to man...
3187 sym R (356 sym/4 pcs) 4 img
Computed columns for dataframes
Everyone loves to aggregate data. Everyone loves to create new columns based on other columns. Everyone hates to do the same thing twice. In my continuing work on multilevel view of loss reserving, I reached a point where I realized that I needed a robust mechanism to aggregate computed columns. SQL server and (I’m assuming) other DBMSs have su...
2619 sym R (1543 sym/4 pcs) 4 img 2 tbl
More fun with data frames
Data frames are such a straightforward and essential element of R that it’s easy to lose sight of some of their peculiarities. Last week, I developed some code which would tear apart some data frames and create new ones based on columns specified by the user. This would allow me to dynamically create new data frames for later processing. Everyt...
2876 sym R (570 sym/4 pcs) 4 img
Fun with random effects in loss reserving
For some time now, I’ve advocated for the view that non-life loss reserving constitutes a categorized linear regression. I’ll emphasize that the idea of a linear regression isn’t remotely novel. Further, the categorization is the de facto approach. I’m merely recognizing it and suggesting instances where a decision may be made about the o...
1737 sym R (192 sym/1 pcs) 10 img
Another view of ordinary regression
This is something I’ve been meaning to write for ages. My formal training for most things is limited. Like a lot of folks, I’m an autodidact. This is good in that I’m always learning and always studying those things that I enjoy. At the same time, it means that I take in information in a highly unstructured, probably inefficient way. Linear...
3981 sym R (1851 sym/6 pcs) 10 img