Site icon R-bloggers

Analysing the Modelled Territorial Authority GDP estimates for New Zealand

[This article was first published on Peter's stats stuff - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

At the conference of the New Zealand Association of Economists (NZAE) in late June 2016 I gave a paper on Modelled Territorial Authority Gross Domestic Product, a new dataset my team developed last year in my day job. See the official website of the MTAGDP project for definitive information. I briefly blogged about the data when it was first released in October 2015; since then it has been updated and enhanced.

The papers from the conference were originally planned to be published on the NZAE website but this doesn’t seem to have happened so I’ve put mine up in the “presentations” part of my blog instead.

Some visual highlights

The paper talks about how we developed these estimates and has some example analysis demonstrating possible use case. For example, I fit a generalized additive model to economic growth from 2005 to 2015 to see if it could be explained in part by the absolute level of GDP or the importance of agriculture at the beginning of the period, while correcting for spatial auto-correlation (spoiler – found no evidence of a link).

Without wanting to paraphrase the whole paper again in this blog, here are some visual highlights. Explanations are in the full paper.


Which districts and cities have similar industry profiles?


Which industries tend to be spatially related?


How do agriculture and GDP in 2005 relate to subsequent growth? (not much)


How does construction in Taranaki get allocated to sub-industries and districts?


How does the data look in its web app built with Shiny? (Note the machine-generated interpretation / commentary on the right side of the screen)


Which districts and cities had the highest growth rates 2005 to 2015?


What’s the GDP growth map of New Zealand look like?


What about if we smooth the growth patterns and draw it like a funky weather map instead?


Accessing the data

The full source code for the conference paper and its analysis is available on GitHub, but here’s a much shorter snippet of R code to download the data in two tables from the definitive location on the MBIE website:

    TAGDP_public <- read.csv("http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product/resolveuid/98debb063cb14ecbab0f018b7681e7f4",
                   stringsAsFactors = FALSE)
    mtagdp_totals <- read.csv("http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product/resolveuid/b811fea8196c4d269c1d5ca973933c7c",
                              stringsAsFactors = FALSE)

Comments, questions and suggestions welcomed. If they’re about my example analysis or basic “how do I use the data” I’ll answer them here; if they get controversial or about the development method I’ll swap hats and refer them back to work.

Caveat and disclaimer from the MBIE website

“These estimates are at a more detailed level of granularity than available in the Statistics New Zealand official Tier 1 regional GDP series.

“They are experimental in nature and should be used with caution. The data are modelled and produced by the Ministry of Business Innovation and Employment (MBIE) (not by Statistics New Zealand), according to the methods outlined in …

“These estimates are not a Tier 1 statistic and have been created by MBIE for research purposes. While various Statistics New Zealand collections form the source data, Statistics New Zealand will not be held accountable for any error, inaccurate findings or interpretation within the publication.

“One of the sources used for the modelling is a customised dataset created in a way that protects confidentiality, provided by Statistics New Zealand. Access to that data was provided to MBIE by Statistics New Zealand under conditions designed to give effect to the security and confidentiality provisions of the Statistics Act 1975.

“While all care and diligence has been used in processing, analysing, and extracting data and information for this publication, MBIE gives not warranty it is error free and will not be liable for any loss or damage suffered by the use directly, or indirectly, of the information.”

To leave a comment for the author, please follow the link and comment on their blog: Peter's stats stuff - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.