Publications by Peter's stats stuff - R
Success rates of automated ARIMA fitting
A function for testing auto.arima() This is the third, and the last from me on this particular topic for a while, in a series of posts on fitting time series models and comparing time series to eachother, originally inspired by a question on the Cross-Validated Q&A site. In this week’s post I’m exploring and testing an almost throw-away comm...
6633 sym R (3938 sym/4 pcs) 4 img 3 tbl
Recruiting Analysts for dynamic cutting edge public sector team
The jobs Within the New Zealand Ministry of Business, Innovation and Employment, the Sector Trends team has recently secured resourcing for additional analysts on a range of statistical programmes. That’s the team that I usually manage, although for the next few months I’m doing a stint on a similar team, different topics. The formal detail...
6114 sym 2 img
Seasonal adjusment on the fly with X-13ARIMA-SEATS, seasonal and ggplot2
Calling seasonal adjustment software from R I recently explored for the first time (having languished on the “check this out later” list) Christoph Sax’s excellent {seasonal} R package. It makes it super easy for R users to engage with X-13ARIMA-SEATS, the latest industry standard software for time series analysis and in particular seasona...
8799 sym R (4220 sym/9 pcs) 14 img
Silver flows in the seventeenth and eighteenth centuries
Silver trade I’ve been reading Ronald Findlay and Kevin H. O’Rourke’s 2009 book Power and Plenty: Trade, War, and the World Economy in the Second Millennium and finding it an excellent piece of big picture economic history. I felt the urge to re-express one of their figures (Figure 4.7 in the original). The original is made up of two flow...
5212 sym R (4273 sym/1 pcs) 4 img
Modelled Territorial Authority GDP for New Zealand
A big project at my work that I was involved with over the past year was the production of modelled estimates of gross domestic product at the District and City level. There are official statistics at the Regional Council level (16 of them in New Zealand), so the aim of this project was to get that extra bit of granularity that makes analysis mo...
1884 sym 2 img
Linear model with time series random component
What do auto-correlated residuals do to your linear model? For training purposes I wanted to illustrate the dangers of ignoring time series characteristics of the random part of a classical linear regression, and I came up with this animation to do it: I like this, because it shows how easy it is to fit something that looks to be a good fit but ...
3650 sym R (2687 sym/2 pcs) 4 img
Create ARIMA time series from bottom up
Simulating ARIMA models Generating an arbitrary Auto-Regressive Integrated Moving Average (ARIMA) model is easy in R with the arima.sim() function that is part of the built-in {stats} package. In fact I’ve done it extensively in previous blog posts for various illustrative purposes. But one cost of doing this for educational purposes is that...
3782 sym R (2172 sym/2 pcs)
Deaths from assault over time in 40 relatively rich countries
Deaths from assault A friend was looking at comparative data on violent deaths in a range of countries and I couldn’t resist the chance to turn out some graphics. The data come from the OECD, who compiles them from contributions by member and associated country governments – effectively, wealthier countries – and makes them available via a...
10431 sym R (6633 sym/5 pcs) 8 img
Inequality measures in the World Development Indicators
World Development Indicators After my last post on deaths from assault, I got a few comments both on and off-line asking for exploration of developing country issues, in contrast to the OECD focus of the previous post. I’d always intended at some point to do something with the World Bank’s World Development Indicators so now seems a good tim...
6188 sym R (2951 sym/2 pcs) 8 img 1 tbl
Importance of exports and economic growth, cross-country time series
Exports and economic growth I was looking to show a more substantive piece of analysis using the World Development Indicators data, and at the same time show how to get started on fitting a mixed effects model with grouped time series data. The relationship between exports’ importance in an economy and economic growth forms a good start as it ...
9227 sym R (5316 sym/5 pcs) 14 img