Forecasting Britain’s election in real-time
By: G. Elliott Morris
Tags: Elections, Data Journalism, Politics, UK, Data Science

How can we predict election results? The answer largely depends on when you ask the question. If you ask before election day, the usual approach is to take a poll of the electorate and tally up their vote intentions. But what if you’d like to hazard a guess at the result on election night itself, after people have voted and before the final totals have been decided?

Media outlets often turn to a special type of survey called an exit poll for initial answers. The exit poll is designed to predict each constituency’s swing in voting habits relative to the previous election. By polling voters’ choices in a selection of hand-picked, nationally-representative polling places, data scientists can predict the outcome of the election. But although the exit poll is typically bang-on, it is not an infallible methodology, and it is unhelpful if one party is predicted to win a number of seats within the margin of error of a majority (roughly 326 seats). If an exit poll is wrong or an election is too close to call, analysts can find themselves waiting for many hours until the final result is known.

We decided that elections aren’t worth the wait. For Britain’s 2019 general election, The Economist’s data-journalism team will produce real-time forecasts of the final results — in every constituency — starting as soon as the first few seats are announced and continuing throughout the night.

Our forecasting model predicts the results in each constituency using data from those that have already released their returns. It works in two stages. First, we train a simultaneous equations model to predict each party’s vote shares in constituencies that have already reported results. That model teases out the relationship between this year’s results and a seat’s past returns, geographic region as well as the expected 2019 vote shares according to polling data from YouGov. Then, we use this model to project the results in seats that have not yet released their vote tallies. Our approach avoids many of the problems introduced by geographic variation in early constituencies by measuring the over- and under-performance of each party. Even if the first few constituencies are all strong Labour seats, in other words, the model can produce accurate forecasts. But it would still hurt our accuracy if all of those seats had differential swings towards one party when compared with the constituencies that reported after it.

In addition, we account for the chance that our model may be wrong by simulating many different ways election night could unfold. For each simulation, we increase or decrease the parties’ forecast vote shares in the remaining constituencies. These errors are correlated across seats and parties — using the covariance matrix for party vote shares from the model and a seat-by-seat correlation matrix calculated using Mahalanobis distances — to capture the correct dynamics of the election. For example, our model ensures that if Labour candidates are performing better in one simulated election, the Tories and Liberal Democrats are accordingly punished. And by correlating these errors by constituency, the parties will perform similarly in seats that have matching demographic and political profiles.

Each time the model runs, we simulate 10,000 different election results. This allows us to calculate a confidence interval for the expected number of seats won by each party throughout the night.

This method produced accurate estimates very early during election night in 2017. Using returns from only 38 constituencies, at roughly 12:30 AM the model correctly anticipated a surprise Tory minority.

Every minute from around midnight on Thursday, December 12th to 6:00am the following morning, our live forecasting model will update with new constituency-level results to predict the aggregate outcome of the election. You can follow along at https://projects.economist.com/uk-elections/2019/general-election-results.

G. Elliott Morris is a data journalist at The Economist. You can follow The Economist’s Data Team on Twitter.