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.

Heads You Win, Tails I Lose

It is November in Northeast Ohio. Homeowners are faced with an annual decision – buy a new snow shovel, buy/tune up the snow plow, or hire a plowing service. I was lucky enough to have always had a snow service when I had my house in Shaker Heights. For $250 a guy in a pick-up truck would magically appear every time there was as little as 2” of snow on my drive. He would clear the drive and make it safe for me and my family. Sometimes he would even sweep the snow off the walkway. $250 for six months. If it snowed only three times - $250. If it snowed thirty times - $250. I wasn’t purchasing the number of times he visited. I was buying peace of mind and security. And if it never snowed in Shaker Heights? Let’s not be silly. One year’s easy winter would surely be followed by a snow belt classic.

If you believe, as I do, that the Patient Protection and Affordable Care Act (PPACA) is designed to change who pays for health care in our country, then you had been waiting anxiously for yesterday’s decision from the Obama administration. Florida has aggressively fought the President’s legislation from day one. The latest salvo was a special request for a waiver of the 80% Minimum Loss Ratio (MLR) regulation. This special waiver has required a mound of paperwork and nearly a year of preparation.

And the verdict from the Centers for Medicare and Medicaid Services (CMS) was (drum roll please) - - - Come back in 30 days.

First, what is an 80% Minimum Loss Ratio? In the simplest of terms it means that for ever dollar of premium an insurance company receives, it must spend 80 cents on health care claims. That leaves 20 cents for taxes, administration, reserves, marketing, advertising, and profits. If the consumer has a good year and has fewer claims, the law requires the insurer to issue a rebate of the excess premiums. If the consumer has a really bad year, oh well.

I think you can see where this is going. Most of my clients are small businesses with fewer than ten employees. Some have only one or two employees. Many of my groups have little to no claims per year, while several of them more than make up the difference.

If a small business consists of three families, each paying $1,000 per month, we have an annual premium of $36,000. What happens if one of the spouses has a quadruple by-pass at $180,000? Where does the insurer get that money if it is returning excess premiums each year to the healthy clients?

The goal is to have a loss ratio between 65% - 80%. This goal is for the entire book of business, not on a client by client basis. We are pooling the risk, sharing the possibility of major accidents and illnesses among a large group of people. The MLR regulation effectively ends that. And in the end, it effectively ends private major medical insurance.

Insurers are threatening to pull out of the states that don’t get the federal waiver. At the very least, they will be forced to significantly restructure their product offerings. It is not an idle threat. This is all part of the process that began in March of 2010.

The Supreme Court will soon hear arguments about the individual mandate, a concept championed by Newt Gingrich and Bob Dole in the early 1990’s and pilloried by the Republicans today. This is a side-show. The Minimum Loss Ratio rulings will have far more impact on who pays for your healthcare in 2015.

I could have purchased a “pay as I go” snow service when I was a homeowner. What I couldn’t afford back then and can’t afford now is “pay as I go” healthcare.

DAVE

www.bcandb.com

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: http://code.google.com/p/chainladder/ 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:

library(ChainLadder)
library(googleVis)
data(RAA) # example data set of the ChainLadder package
class(RAA) <- "matrix" # change the class from triangle to matrix
df <- as.data.frame(t(RAA)) # 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")))

An Angry Mob

The National Journal, a non-partisan Washington based news magazine, published the story as if it was news. Poll: Majority of Voters Want Medicare Funding Left Untouched The first paragraph noted that 83 percent of the respondents oppose cuts to Medicare and higher beneficiary copayments. 70 percent believe that the government should be more active in fighting waste, fraud, and abuse in both Medicare and Medicaid. It wasn’t until the second paragraph that we got the rest of the story.

The poll was commissioned by Fight Fraud First. One of the members of the collection of groups that created Fight Fraud First just happens to be AARP, the same organization that sponsors an endless series of television spots scaring and/or rallying senior citizens.

So we have three questions.

  1. Is it at all surprising that 83% of the population (assuming that the poll wasn’t weighted with seniors!) want as much money and benefits as they can get with little or no charges?

  2. Would you expect a poll conducted by an organization named Fight Fraud First to release the results of a poll that didn’t strongly endorse the concept of fighting fraud first?

  3. Was this news?


Since the first two questions are obvious, allow me to answer the third. NO!

We want painless solutions to all of our problems and we are at least 83% convinced that someone else should pay for the debts we have all created. I’m not sure if this mindset can be traced to the concept of paying for two wars by shopping or if it is simply more prevalent in today’s society, but it is everywhere we look.

I was in New York City a few weeks ago and had a chance to visit the Occupy Wall Street. Yes, it did remind me of the anti-war protests of the late sixties and early seventies. But at the risk of ticking off most of my readers, I have to tell you that there is little difference between the Occupy Wall Street crowd, a Tea Party rally, and a group of Libyan soldiers firing their rifles straight up into the air with little regard to where the bullets will land. Within each group is a small core that understands and can discuss the issues. There is also a larger faction that has a propagandist’s view of the group’s concerns, but is totally committed for the moment. The rest, the vast majority, have nothing better to do and no place better to be.

The links in the above paragraph will provide you with plenty of laughs whether you are on the Right or the Left.

In a perfect world, in the ideal democracy, those masses gathering at Tea Party rallies and camping out at Occupy sites around the country would be engaged in intellectual policy debates. These citizens would be working hard to find solutions to our country’s economic woes.

That is not happening.

What we have, instead, are people desperately attempting to assert their relevance. It appears to be very easy to confuse one’s self-interest with what is allegedly in the U.S.’s best interest. And this leads us to the current health care debate.

The Patient Protection and Affordable Care Act (PPACA) attempts to change who pays for health care, but does nothing to control the cost of care. Changing the payer doesn’t solve our problem of spiraling health care costs.

The current financial debacle has forced some in Congress to start thinking about reigning in costs. This has resulted in the special interest groups to snap into action.

  • The American Hospital Association has a woman staring into the camera, and our souls, decrying any cuts that could endanger her father’s health.

  • AARP’s commercial supposedly speaks for 50 million seniors who are united to oppose any cuts and will vote, as one, against anyone who dares oppose them.

  • The A.M.A. (American Medical Association) is spending big bucks to remind you that doctors are on your side.


Luckily, as Ohio residents we have been spared the finger pointing and shouting of the Republican presidential primary ads. Better Iowa than us.

The next year is very important. Will the PPACA survive? My guess is still Yes. The rules and regulations are being written and imposed now. It will be very difficult to simply reverse all of this, even if anyone wanted to, in January 2013. What you need to watch, what you need to ask are what cost containment measures, if any, are being implemented?

There is a lot of noise out there. People are marching to retain the life they think they have. Or they might be marching to claim their share of the American largesse that has eluded them. Many of these same people will soon be whipped into action to save their local hospitals or to protest a cut in nurses’ wages. The one constant throughout all of this will be the absence of personal sacrifice.

Ask people to pay more? That might create an angry mob.

DAVE

www.bcandb.com