<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/analysing-the-modelled-territorial-authority-gdp-estimates-for-new-zealand/"></div></div><div><a data-url="https://www.r-bloggers.com/analysing-the-modelled-territorial-authority-gdp-estimates-for-new-zealand/" data-counturl="https://www.r-bloggers.com/analysing-the-modelled-territorial-authority-gdp-estimates-for-new-zealand/" data-count="horizontal" data-text="Analysing the Modelled Territorial Authority GDP estimates for New Zealand" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://ellisp.github.io/blog/2016/09/13/mtagdp"> Peter's stats stuff - R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>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 <a target="_blank" href="http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product">official website of the MTAGDP project</a> for definitive information. I <a target="_blank" href="http://ellisp.github.io/blog/2015/10/30/MTAGDP">briefly blogged</a> about the data when it was first released in October 2015; since then it has been updated and enhanced.</p>
<p>The papers from the conference were originally planned to be <a target="_blank" href="http://www.nzaeconference.co.nz/presenters-info.cfm">published on the NZAE website</a> but this doesn’t seem to have happened so I’ve put mine up in the <a target="_blank" href="http://ellisp.github.io/presentations/index.html">“presentations” part of my blog</a> instead.</p>
<ul>
<li><a target="_blank" href="http://ellisp.github.io/presentations/ellis-mtagdp.pdf">Full paper (PDF)</a> – the only manifestation that’s really aimed at being reader-friendly</li>
<li><a target="_blank" href="http://ellisp.github.io/blog/2016/09/13/presentations/ellisp-mtagdp-presentation.html">Presentation</a> – visual props, doesn’t tell the story by itself but looks nice</li>
<li><a target="_blank" href="https://github.com/ellisp/mtagdp-nzae">Source code</a> – source code for my contribution at the conference, including the analysis in R, paper in LaTeX and the Rmarkdown / reveal.js code of the presentation. Not the source code for creating Modelled Territorial Authority GDP estimates, which is published elsewhere (links in the paper)</li>
</ul>
<h2>Some visual highlights</h2>
<p>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).</p>
<p>Without wanting to paraphrase the whole paper again in this blog, here are some visual highlights. Explanations are in the <a target="_blank" href="http://ellisp.github.io/presentations/ellis-mtagdp.pdf">full paper</a>.</p>
<hr>
<h3>Which districts and cities have similar industry profiles?</h3>
<p><img alt="a" src="http://ellisp.github.io/img/0054-ta-associations.svg"></p>
<hr>
<h3>Which industries tend to be spatially related?</h3>
<p><img alt="b" src="http://ellisp.github.io/img/0054-industry-associations.svg"></p>
<hr>
<h3>How do agriculture and GDP in 2005 relate to subsequent growth? (not much)</h3>
<p><img alt="c" src="http://ellisp.github.io/img/0054-scatter-2005-v-growth.svg"></p>
<hr>
<h3>How does construction in Taranaki get allocated to sub-industries and districts?</h3>
<p><img alt="d" src="http://ellisp.github.io/img/0054-sankey_taranakiConstruction.svg"></p>
<hr>
<h3>How does the data look in its <a target="_blank" href="http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product/interactive-web-tool">web app built with Shiny</a>? (Note the machine-generated interpretation / commentary on the right side of the screen)</h3>
<p><a target="_blank" href="http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product/interactive-web-tool"><img alt="e" src="https://i0.wp.com/ellisp.github.io/img/0054-queenstown-snapshot.png?w=456" data-recalc-dims="1"></a></p>
<hr>
<h3>Which districts and cities had the highest growth rates 2005 to 2015?</h3>
<p><img alt="e" src="http://ellisp.github.io/img/0054-dotcagr10.svg"></p>
<hr>
<h3>What’s the GDP growth map of New Zealand look like?</h3>
<p><img alt="e" src="http://ellisp.github.io/img/0054-gdp-pp-map.svg"></p>
<hr>
<h3>What about if we smooth the growth patterns and draw it like a funky weather map instead?</h3>
<p><img alt="e" src="http://ellisp.github.io/img/0054-growth0513.svg"></p>
<hr>
<h2>Accessing the data</h2>
<p>The full source code for the conference paper and its analysis is <a target="_blank" href="https://github.com/ellisp/mtagdp-nzae">available on GitHub</a>, but here’s a much shorter snippet of R code to download the data in two tables from the definitive location on the <a target="_blank" href="http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product/data-download">MBIE website</a>:</p>
<ul>
<li>TAGDP_public contains industry breakdowns to 2013 (about 11MB)</li>
<li>mtagdp_totals is aggregate GDP (no industry breakdown) to 2015 (&lt;1MB)</li>
</ul>
<figure>
<pre><code data-lang="r"><span> </span><span>TAGDP_public</span><span> </span><span>&lt;-</span><span> </span><span>read.csv</span><span>(</span><span>&quot;http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product/resolveuid/98debb063cb14ecbab0f018b7681e7f4&quot;</span><span>,</span><span>
</span><span>stringsAsFactors</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span>
</span><span>mtagdp_totals</span><span> </span><span>&lt;-</span><span> </span><span>read.csv</span><span>(</span><span>&quot;http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product/resolveuid/b811fea8196c4d269c1d5ca973933c7c&quot;</span><span>,</span><span>
</span><span>stringsAsFactors</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span></code></pre>
</figure>
<p>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.</p>
<h2>Caveat and disclaimer from the <a target="_blank" href="http://www.mbie.govt.nz/info-services/sectors-industries/regions-cities/research/modelled-territorial-authority-gross-domestic-product">MBIE website</a></h2>
<p>“These estimates are at a more detailed level of granularity than available in the Statistics New Zealand official Tier 1 regional GDP series.</p>
<p>“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 …</p>
<p>…</p>
<p>“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.</p>
<p>“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.</p>
<p>“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.”</p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/analysing-the-modelled-territorial-authority-gdp-estimates-for-new-zealand/"></div></div><div><a data-url="https://www.r-bloggers.com/analysing-the-modelled-territorial-authority-gdp-estimates-for-new-zealand/" data-counturl="https://www.r-bloggers.com/analysing-the-modelled-territorial-authority-gdp-estimates-for-new-zealand/" data-count="vertical" data-text="Analysing the Modelled Territorial Authority GDP estimates for New Zealand" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://ellisp.github.io/blog/2016/09/13/mtagdp"> Peter's stats stuff - R</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/j38qcp-xpeU"></a></div>