<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/time-varying-house-effects-in-new-zealand-political-polls-by-ellis2013nz/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://ellisp.github.io/blog/2017/09/16/time-varying-house-effects"> Peter's stats stuff - R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h2>House effects in state space models of voting intention</h2>
<p>“House effects” is the term commonly used in models of voting intention to refer to the different statistical biases of different pollsters. In my <a rel="nofollow" href="http://ellisp.github.io/elections/state-space.html" target="_blank">Model B state space model of the New Zealand 2017 election</a>, the estimated house effects look like this:</p>
<p><img width="100%" src="http://ellisp.github.io/img/state-space-house-effects.svg"></p>
<p>What these mean, to pick the largest example, is that Bauer Media Insights are estimated to over-estimate the party vote for Greens by about four percentage points. This is taken into account when the model simultaneously estimates the unobserved latent voting intention for every day in the observed period – and the house effects for all the other pollsters. Only one type of observation has no house effect, and that’s the elections on the day. Those particular results are definitive!</p>
<p>For those wondering about the presence of six pollsters, including some that are no longer active in New Zealand – my model starts with the 2011 election and any pollster with two or more public polls since then is included. Even though Digipoll and Ipsos are not publishing polls for the 2017 election, they did leading up to 2014, and hence they go into the mix for estimating the latent voting intention every day leading up to the 2014 election day, which is useful for understanding the house effects of those pollsters that are still publishing polls.</p>
<h2>What happens when the pollster changes their method?</h2>
<p>Peter Green drew my attention (<a rel="nofollow" href="https://twitter.com/ellis2013nz/status/908463168581599232" target="_blank">on Twitter</a>) to a recent change in the Newshub – Reid Research poll – in 2017, 25% of the sample has been online, rather than the full sample being recruited and questioned over “land” telephone lines. With a lot of scrutiny recently on volatility and disagreement between the polls as we head to election day in a week’s time, Dr Green wondered if the change in method could have led to a detectable change in the Reid Research house effect.</p>
<p>Trying to detect this is a fairly straightforward addition to my state space model; I just added to the data a dummy variable that was 1 for Reid Research polls in 2017 and 0 otherwise, and a parameter “additional house effect” for each party to apply when that indicator is 1. Seven more parameters to estimate in a model that already has more than 20,000 (because there is a parameter for the voting intent for each party, every day since September 2011) doesn’t add too much to the estimation difficulty.</p>
<p>We get this result:</p>
<p><img width="100%" src="http://ellisp.github.io/img/0111-reid-methodology-change-impact.svg"></p>
<p>We can interpret this as the change in Reid Research’s house effect in 2017, compared to their house effect in 2016 and earlier. Remember that all this is estimated in the light of how the other pollsters are estimating the unobservable voting intention; those other house effects are assumed to stay the same over this period. So it looks like since the change in method is leading to the reported estimated vote for National going <em>up</em> by about 1.5 percentage points (but really, anwhere between 0 and 3%) and Labour <em>down</em> by about 1 percentage point; Greens and Māori Party vote down by a little less.</p>
<p>These effects are additional to the “2016 and earlier” effects shown in the first chart of this post. So the <em>net</em> Reid Research house effect for the Greens is that Reid Research polls are probably still <em>over</em>estimating the vote but only by about one percentage point (less than the two points in 2016 and earlier); and for the National Party, Reid’s reported values should probably be discounted by about 1.5 percentage points (as the 2016 and earlier effect is basically zero). The house effect for New Zealand First doesn’t change – our best estimate is that Reid Research continue to understate the vote for New Zealand First by about 1.5 percentage points.</p>
<p>The operative line of code, written in Stan is this:</p>
<figure>
<pre><code data-lang="stan">for(j in 1:n_parties){
    
    ...
                              
    for(t in 1:y5_n)
        y5_values[t, j] ~ normal(mu[y5_days[t], j] + 
					d[5, j] + 
					reid_impact[j] * reid_method[t], 
				 y5_se[j] * inflator);
        
    ...
        
  }</code></pre>
</figure>
<p>I’m not terribly proud of my Stan coding (everyone’s learning, right) and think this could be optimised in various ways, but it’s fairly transparent. The <code>y5_n</code> number of random values of polls by the 5th pollster (Reid Research – 5th in alphabetical order), for the <code>j</code>th party on the <code>t</code>th day since the election are normally distributed. The mean of that distribution is the appropriate value of <code>mu</code> for that day (<code>mu</code> is the unobserved, latent voting intention), plus the appropriate value of <code>d</code> (ie the standard house effect), plus the <code>reid_impact</code> adjustment if and only if the dummy variable <code>reid_method</code> is 1 for that particular day.</p>
<p>The impact on my prediction for election day is pretty marginal; it’s only one pollster among several, and we nudge <em>down</em> National’s chances a bit compared to my last publication, and <em>up</em> Labour and Greens. The overwhelming probability at the time of writing is forecast to be with a coalition led by either Labour or National but needing New Zealand First as one of its members.</p>
<p>Check out:</p>
<ul>
<li>the <a rel="nofollow" href="http://ellisp.github.io/elections/state-space.html" target="_blank">latest forecast with Model B</a>, or my <a rel="nofollow" href="http://ellisp.github.io/elections/combined.html" target="_blank">combined forecast</a> (recommended) that averages my two models</li>
<li><a rel="nofollow" href="https://github.com/ellisp/nz-election-forecast" target="_blank">source code</a> for the New Zealand election forecasting project</li>
<li>Latest version of my <a rel="nofollow" href="https://github.com/ellisp/nzelect" target="_blank">nzelect R package</a>, with poll data from 2002 to the current day and detailed results for the 2014 election.</li>
</ul>
	<p>
<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/2017/09/16/time-varying-house-effects"> 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 rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/_Z80E2slB3k" height="1"></a></div>