Skip to content

Analyzing New Zealand fatal traffic crashes in Stan with added open-access science

Open-access science

I’ll get to the meat of this post in a second, but I just wanted to highlight how the study I’m about to talk about was done in the open and how that helped everyone. Tim Makarios read the study and responded in the blog comments,

Hold on. As I first skimmed this post, I happened to have, on the coffee table next to me, half a sheet of The Evening Post dated July 18, 1984. At the bottom of page 2, there’s a note saying “The Ministry of Transport said today that 391 road deaths had been reported so far this year. This compared with 315 at the same time last year.”

How is there such a big discrepancy with your chart of Sam Warburton’s data?

to which Peter Ellis, the author of the study responded in typical open-source fashion, encouraging the original poster to dig deeper and report back,

Good question. I’m not a traffic crash expert, the spirit of open source is – you let me know when you think you’ve worked it out. Obviously these are measuring two different things, I’m interested to know what! Thanks.

The question apparently prompted Peter to look himself; he followed up with

Looks like I misread the data for that particular bit of the analysis and my graphic was only showing *driver* deaths. I’ve updated it and the source code so it shows total casualties, which are consistent with that number in your old paper. Thanks for alerting me to that.

I love to see open science in action! Anyway, onto the real topic here.

New Zealand fatal traffic crashes

The above was an exchange about Peter Ellis’s analysis,

In his at-a-glance summary, Peter says,

I explore half a million rows of disaggregated crash data for New Zealand, and along the way illustrate geo-spatial projections, maps, forecasting with ensembles of methods, a state space model for change over time, and a generalized linear model for understanding interactions in a three-way cross tab.

I’d highly recommend it if you are interested in spatio-temporal modeling in particular or even just in plotting. It has great plots, very nice Stan code, and lots of great exploratory and Bayesian data analysis.

Cold wind from the north

We’ve had a rash of work lately on spatial models; must be the wind blowing down from the north (Finland and Toronto, specifically).

Contribute to Stan case studies?

Peter, if you’re listening and would be willing to release this open source, it’d make a great Stan case study. If you already submitted it for StanCon 2018, thanks! We’ll all be getting the New Year’s gift of a couple dozen new Stan case studies!


  1. Peter Ellis says:

    Sure, would love to. Let me just add in the seasonality adjustment I forgot to include…

  2. “I love to see open science in action!” So do I, and really appreciate the contributions by Peter and a few other statisticians publicly – whose skills are fair superior to mine – and a couple of others who’ve approached me in private who might go public later.

    I should note that the ability of open analysis in this area is being frustrated by less data being available

    and where data is released in less open ways.

  3. A.C. Wilson says:


    I notice that, among all of the photos of cats in your blog, a non-trivial fraction of the cats are “torties” and “torbies”. Can we therefore presume that you have a non-trivial preference for female cats over male cats? (I’m being facetious here – I DID long ago take several stats courses…)

    (To those readers who are not “cat people”: It is commonly written that all but 1 in 3000 cats of the tortoiseshell, calico, tortoiseshell-tabby, and calico-tabby color combinations/patterns are female. All four of these colorings include both orange and black. Even if the “1 in 3000” assertion is off by as much as an order of magnitude, that has no practical relevance to my above question.)


Leave a Reply