Applied Data Science on Jørgen Bølstad
https://www.boelstad.net/tags/applied-data-science/
Recent content in Applied Data Science on Jørgen BølstadHugo -- gohugo.ioj.b [AT] post.harvard.edu (Jørgen Bølstad)j.b [AT] post.harvard.edu (Jørgen Bølstad)Wed, 20 Jan 2021 00:00:00 +0000A New Website Is Born: Estimite.com
https://www.boelstad.net/post/2021_norwegian_election_forecast/
Wed, 20 Jan 2021 00:00:00 +0000j.b [AT] post.harvard.edu (Jørgen Bølstad)https://www.boelstad.net/post/2021_norwegian_election_forecast/<p>Bayesian modeling has proven its usefulness for poll aggregation and election forecasting – for instance through <a href="https://fivethirtyeight.com">FiveThirtyEight</a>. However, in Norway, media coverage of public opinion trends still tends to focus on a single poll at a time, or a simple average of polls at best. I was convinced it would be possible to do better, and after about three times as many long days and nights as I thought it would take, the result is finally live – both in <a href="https://www.estimite.com/no/post/stortingsvalget-2021/">Norwegian</a> and <a href="https://www.estimite.com/post/norwegian-election-2021/">English</a> – at <a href="https://www.estimite.com/">Estimite.com</a>.</p>
<div id="notes-on-the-approach" class="section level3">
<h3>Notes on the approach</h3>
<p>I have landed on a fully automated production process, where a script checks for new data, refits the model if necessary, and then rebuilds and publishes the website. This is all done using R, Stan, and a few shell scripts. Here is a brief description of the model:</p>
<ul>
<li><p>This is a state space model where center logratio transformed latent trends are given multivariate <em>t</em>-distributed innovations. The multivariate <em>t</em> has been given a non-centered specification through Cholesky factorization, which makes a notable difference.</p></li>
<li><p>The model estimates and corrects for average polling bias relative to previous elections. This contrasts with Nate Silver’s models at FiveThirtyEight, which assume that house effects have a mean of zero – I never fully bought that idea. Looking at Norwegian data, there seems to be a consistent pattern across elections, and ignoring it might be risky. At the same time, correcting for these biases carries its own risk, as it assumes polling companies do not fix their methodology from one election to the next.</p></li>
<li><p>The model estimates latent trends in party support at the national level, and predicts latent support for each electoral district based on previous election results. The predictions are restricted to sum up to the national trend. Votes at the district-level are predicted from the district-level trends using a Dirichlet-Multinomial distribution – the same kind of distribution as the one assumed to generate the polling data.</p></li>
<li><p>Predictions for future time points are based on: (1) Vote shares at the last election, (2) the degree of change in each party’s vote share from one election to the next, (3) current party support, (4), the degree of change in each party’s support from one week to the next, and (5) the degree of covariation in how support for each possible pair of parties evolves on a weekly basis.</p></li>
</ul>
</div>
<div id="conclusions" class="section level3">
<h3>Conclusions</h3>
<ol style="list-style-type: decimal">
<li><p>Stan is great for this, because it lets us define generated quantities, and get all kinds of relevant outputs from a single, joint simulation.</p></li>
<li><p>You should not underestimate how many technical challenges such projects entail and how much time it takes to fix them – especially if you care about details.</p></li>
</ol>
</div>