Better late than never

Even before the UK Government decided to call a snap election a month ago or so, I have been trying to do some work around the general topic of “elections” together with a number of colleagues, including Roberto Cerina (whom I’ve known since he was a student at UCL) and Raymond Duch at Oxford, as well as Christina Pagel at UCL and Christabel Cooper.

The timing for the election was not the best — we were all busy doing our main job (which for some of us didn’t involve directly doing this…) so we didn’t manage to think carefully about all the bits and bobs we’ve started discussing. But Roberto has worked like crazy in the past few days and we’ve managed to do our prediction on tonight’s election. I think the model is very interesting — although we need to do more testing and polishing of some of the details… Anyway: here goes.

Summary

It should be noted the methodology and results presented below are highly experimental and derived from significant simplification and approximation to meet the impending election date. We plan to continue working on these ideas to improve them. Thus, the methods will likely undergo significant modification before being presented at conferences and published as a paper. Nonetheless, we thought the results were interesting enough to share with the wider public. We predict the conservatives will lead labour by around 6 percentage points, which will translate to 27 seats over the threshold for an absolute majority in parliament (ie 326 seats), with a 95% prediction interval of seats ranging from -1 (hence a hung parliament) to 55.

Method

We propose a novel methodology to produce dynamic election forecasts using exclusively publicly available data. The ethos of this work builds on two literatures: i) the literature on Multilevel Regression and Post-Stratification (MRP) and its general form of Regularized Regression and Post-Stratification (RRP); ii) the literature on pooling the polls and modeling campaign dynamics.

In short, the methodology takes full advantage of a Bayesian approach in combining different sources of evidence; firstly we consider a large survey (e.g. the British Election Study), which we use to estimate structured (“random”) effects of interest from the individual level data. In particular, we focus especially on constituency-level deviations from the global average voting share of each party. We then update the global mean using the latest public opinion polls. In particular, we consider the data published by pollsters in the form of univariate cross-tabulations (e.g. voting intention by age group; or voting intention by sex; ect). Finally, we produce voter-category-level estimates using the updated global mean and the constituency-level effects estimated in the first step, and post-stratify these to a stratification frame to obtain constituency-level results.

The Constituency-level estimates of the vote for each party are then tallied up and a winner is declared in each; in principle this procedure can easily provide credible uncertainty estimates by merging individual-level and polls-level uncertainty – note that this step is omitted in this brief exposition.

Data

The procedure requires three data sources:

  1. a recent (and relevant) publicly available source of individual-level voting intention, and associated individual- and constituency-level characteristics. In the UK, one relevant example is represented by the British Election Study (BES), and in particular wave 16 of the Online Panel was most relevant to the election at hand. The advantage of using the BES is that it is publicly available and has a relatively large sample size, with a wealth of covariates investigated. However, it is possible to include large specific surveys (possibly privately owned, but accessible to the researchers);
  2. A daily tally of published opinion polls, at the cross-tab level (i.e. voting intention by age groups or Brexit vote), conditional on turnout;
  3. The latest census data and any further information to model a stratification-frame (a vector of voter-categories and associated size within the electorate) on which to stratify our individual-level estimates.

Step 3. is a separate modeling exercise, which deserves a degree of attention we cannot devolve in this short piece, and so the reader should just assume it as given for now.

Modelling

Obtaining reasonable priors and constituency-level information from the British Election Study (BES)

We model the vote-choice for parties \(j = 1\ldots,J\) assuming they are categorically distributed (multinomial with \(N=1\)) for each individual in the BES sample \[ v_{ij} \sim \mbox{Categorical}(\boldsymbol\pi_i), \] where \(\boldsymbol\pi_i = \pi_{i1},\ldots,\pi_{iJ}\) is a vector of individual-level and party specific probabilities.

We model (on the logit scale) the mean probability μ_ij of voting for any of the parties at hand on the logit scale: \[ \displaystyle \pi_{ij} = \frac{\exp\left( \mu_{ij} \right)}{\sum_{j=1}^J \exp\left(\mu_{ij}\right)}; \] the model involves a party-level intercept \(\alpha_j\); a series of random effects \(\beta_{jko[k]}\), where each \(k = 1,\ldots,K\) represents an individual-level characteristic of the voter, such as “Age”, “Past Vote” or “Parliamentary Constituency”, and the index \(o = 1,..,O[k]\) indicates the level of the given characteristic - say \(k\) indicates “Age”, and we have age categories “18 to 34”, “35 to 54”, “55 to 64”, “65 plus”, represented by \(o = 1,\ldots,4\). The final piece of the model is an area-level predictor \(Z\), involving \(a=1,\ldots,A\) variables at the constituency-level, such as “%Leave”, “%Level4 Education” and others. The area-level predictor is needed to soften the MRP tendency to produce attenuation bias, by selectively relaxing the level of shrinkage on the constituency effects. These assumptions imply a model for \(\mu_{ij}\) as the following \[ \mu_{ij} = \alpha_j + \sum_{k=1}^K \sum_{o=1}^{O[k]} \beta_{jko[k]} + \sum_{a=1}^A \theta_{ja} Z_{ia}. \]

The following priors are assigned to the model parameters: no shrinkage is sought in the party-intercepts, which are assigned non-informative, independent normal priors; the area-predictor is assigned a ridge-prior to encourage stability where party-specific sample sizes are very small (as is the case for Plaid Cymru for instance); the random effects are given non-informative priors with a shared variance component, in order to encourage shrinkage and avoid over-fitting. The variance components are given (mostly) non-informative conjugate priors to encourage fast convergence given the size of the dataset and stringent time requirements (but of course, we will explore more structured alternatives soon). \[\begin{eqnarray*} \alpha_j & \sim & \mbox{Normal}(0, \psi_j) \\ \beta_{jko[k]} & \sim & \mbox{Normal}(0,\tau_k) \\ \theta_{ja} & \sim & \mbox{Normal}(0, \tau_\theta) \\ \psi_j, \tau_k, \tau_\theta & \stackrel{iid}{\sim} & \mbox{Gamma}(\epsilon,\epsilon). \end{eqnarray*}\]

Care is taken to ensure the model is fully identifiable, implementing a corner-constraint such that all coefficients for \(j =\) “Conservatives” are set to zero.

Modeling cross-tabs from publicly available Opinion Polls

All the effects estimated from the previous model, with the exception of the constituency level random effects and area level predictors (save these aside for now), are used as informative priors in the model of opinion polls.

We do not limit ourselves to analyzing the headline shares published daily, but have built a dataset of published cross-tabs for the most important breakdowns, such as age-groups, education level, gender, past vote etc.; note there is no breakdown published by pollsters at the constituency-level1 and hence we cannot update the constituency-level effects estimated in the first phase. We only look at breakdowns conditional of likely voters.

For each characteristic \(o[k]\) (i.e. “Age Group - 18 to 24”), on a given day-to-election \(t = T,\ldots,0\), a polling house \(h = 1,\ldots,H\) will publish a vote-breakdown by party \(j\); we can model these counts according to a multinomial distribution as follows: \[ V_{o[k]hjt} \sim \mbox{Categorical}(p_{o[k]h1t},\ldots,p_{o[k]hJt}); \] once again we implement a logit-link: \[\displaystyle p_{o[k]hjt} = \frac{\exp\left(\eta_{o[k]hjt}\right)}{\sum_{j=1}^J \exp\left(\eta_{o[k]hjt}\right)}; \] the model involves the familiar individual-level parameters as before, with a couple of differences: i) the party-intercepts now move over-time to the tune of a random walk, allowing for exponential discounting of past observations and dynamic estimation of the national campaign effect; ii) given the change in nature of the observations, which are now aggregated counts at the characteristic level, we estimate each characteristic effect \(\beta_{jo[k]}\) separately, but ensure they have the same random-effect structure across equations; iii) parameter \(\delta_{jo[k]h}\) is introduced, which seeks to identify and remove the “house effect” at the characteristic level - i.e. how much higher/lower does, say, YouGov estimate the \(j-\)th vote amongst 18 to 24 year olds, compared to the average pollster?

The linear predictor is defined as \[ \eta_{o[k]hjt} = \alpha_j + \beta_{jko[k]} + \delta_{jo[k]h}. \] Note that again care is taken to impose identification constraints: the same corner-constraint on the conservative coefficients is imposed, as well as a sum-to-zero constraint over houses to identify the bias parameter.

The priors follow; note that the \(^*\) sign indicates that the parameter value is set to point estimate from the individual-level model, so that the posterior will be an average of the polls and BES prior. \[\begin{eqnarray*} \alpha_{jt} & \sim & \mbox{Normal}\left(\alpha_{jt+1},\tau_\alpha\right) \\ \alpha_{jT} & \sim & \mbox{Normal}\left(\alpha_j^*,\psi_j\right) \\ \beta_{jko[k]} & \sim & \mbox{Normal}\left(\beta_{jko[k]}^*,\tau^*_{\beta o[k]}\right) \\ \delta_{jo[k]h} & \sim & \mbox{Normal}\left(0,\tau_\delta\right) \\ \tau_\gamma & \sim & \mbox{Gamma}\left(0.01,1\right) \end{eqnarray*}\]

Obtaining local predictions and stratifying

The last step of our effort involves producing group-level predictions to stratify. We identify groups \(g = 1,\ldots,G\) as the mutually exclusive combination of all voter-characteristics described above - so for instance \(g = 1\) can stand for the category “Age: 18 to 24; Vote2017: Labour; BrexitVote: Remain; Education: Level4”. For each of these groups we produce a vote-probability distribution \(\phi_{jga}\) based on the predictions from the updated model. For each constituency \(a = 1,\ldots,A\), we seek to aggregate over the groups according to their population weights conditional on turnout, \(N_{ga}\), and obtain constituency estimates of vote share \(\rho_{ja}\). \[\begin{eqnarray*} \phi_{jga} & = & \hat\alpha_{j0} + \sum_{k=1}^K \sum_{o=1}^{O[k]} \hat\beta_{jko[k]} + \hat\theta_{ja} Z_{ia} \\ \displaystyle \Phi_{jga} & = & \frac{\exp\left(\phi_{jga}\right)}{\sum_{j=1}^J \exp\left(\phi_{jga}\right)} \\ \displaystyle \rho_{ja} & = & \frac{\sum_{g=1}^G \Phi_{jga}N_{ga}}{\sum_{g=1}^G N_{ga}}. \end{eqnarray*}\]

Some results

So: the model produces a wealth of possible outcomes. For example, we can estimate the overall vote share from the “deep-polls” cross-tabulations, accounting for the underlying correlation in the several univariate cross-tabs. The model predicts the following overall vote share (rounded up).

Party Vote share
Conservative 43%
Labour 37%
Liberal Democrats 12%
SNP/PC 4%
Green 2%
Brexit Party 1%
Other 1%

We can then translate these into constituency level values, to determine the composition of the next parliament. Based on the outcome of the (again: relatively preliminary version of the) model, the Tories should be 27 seats over the threshold for an absolute majority in parliament (326 seats, which is 50% plus one seat); a healthy margin of error should be placed on these; following the same standard deviation of the YouGov MRP projections, the 95% prediction interval for this call is [-1,55]. Hence our model includes the possibility of a hung parliament, albeit with very low probability.

We can also explore the “house” effect (ie the impact of different pollsters on the several cross-tabulated covariates). Something like in the following graph.

House effect

Figure 1: House effect

The plots show the house-bias (relative to the average house’s pro-conservative bias) for each party, for each voter-characteristic (the color scheme is the same as for the campaign dynamic plot below). The idea here is that big swings (say 2 standard deviations away from 0) to the left or the right of the conservative baseline should identify house effects which are out of the ordinary and prompt further scrutiny of the pollster. Note that the conservative baseline makes the interpretation less intuitive, but it is a necessary evil to identify the model.

Or, we could explore the campaign dynamics — for instance, relatively to the baseline (eg the Conservatives, in this case)

Campaign dynamics

Figure 2: Campaign dynamics

which shows how Labour was slowly, slowly catching up.

Of course, we can compute all relevant posterior probabilities (eg actually probability of a given majority, hung parliament, geographical distributions, etc). For now, we’re not reporting on all the details — but we’ll keep working on the model and use the actual results that will be revealed later and tomorrow, to validate and improve on it.

Conclusions

So, in summary, the main idea is to use Bayesian hierarchical modelling to essentially bring some correlation in the many univariate cross-tabulations that are publicly available from the various pollsters. More care needs to be taken to fine-tune predictions at the constituency level, but for now our model creates a much finer estimate from just the polls, which can be complemented with large surveys or historical trends (eg local constituency to overall, or region). The overall aim of this project is to make MRP-like areal estimation available to researchers without the resources to collect hundreds of thousands of individual respondents.

(That’s just me writing again — and now I can brace for the actual results… fingers and toes crossed!).


  1. If MRP estimates (e.g. from Yougov and others) were available, we could eventually incorporate those in, though it should be noted that they are of quite different in nature to traditional polling, and would require ad-hoc model specification.

comments powered by Disqus

Related