With the UK election on the way I thought I would try out a simple analysis to try and predict the result based on national polling figures.
For anyone unfamiliar, the UK uses a firstpastthepost parliamentary system. The electorate votes within their constituency, of which there are 650, and the candidate with the most votes becomes the member of parliament (MP) for that constituency. If a party can win a majority of the seats (at least 326) then they can form a government. As a result, the share of the popular vote is not simply reflected in the share of the seats.
Polling is of course not done on a constituency basis, and so in order to predict the result there needs to be some way to relate the national polls to the result in each constituency.
For polling data I went to britainelects.com who provide aggregated polling data. I’ve used their ‘poll of polls’ data to predict the election in England, and their latest poll for Wales and Scotland to make those predictions respectively. I’ve not made any predictions for Northern Ireland, but the result there likely won’t affect the next government.
In order to predict the result in each constituency I’ve used a uniform swing model. I took the results of the 2015 election (available by in full from the Electoral Commission) and calculated the overall vote share that each part achieved. Comparing this to the latest polls gives a swing, in number of percentage points, for each party. The result of each constituency is then adjusted by this additive swing, which allows a prediction of the new result. This gives the following:
However this prediction does not take into account polling error. In order to do that, a probabilistic model is needed. By assigning a uniform 5% error (not percentage points) to the polls, a random deviation with this width is chosen from the Gaussian distribution. This gives a new national poll from which the election can be predicted. By repeating this many times, the probability of each outcome can be found from the fraction of simulations in which it occurred. The result is a histogram of probable seat numbers for each party, shown here for the Conservatives, Labour, Liberal Democrats, and the SNP:
The prediction is then:

Con 406 +/ 12

Lab 165 +/ 10

Lib Dem 9 +/ 1

SNP 47 +/ 5