The UK referendum on leaving the EU June 2016

The UK referendum on leaving the EU

I’ve not been using WordPress since 2013, but I found that there is still traffic on the site, so will update it. This post was from last year and posted to

The full post with correctly formatted R code is best viewed on Rpubs



Much of the debate following the referendum on leaving the EU has focused on interpretations of the decision made by the electorate as a whole. It is impossible to know what motivated individual voters. However there may be some interpretable patterns in the results themselves that can be analysed statistically. The votes cast in each local authority are likely to be linked to the specific characteristics of the population. This analysis looks at these general patterns of voting across the country as a function of demography.

Finding the data

Unlike general elections in which votes are declared for constituencies, the votes cast for the referendum were aggregated at the level of local authorities. This provides an opportunity to combine them with demographic data at the same level. So although data is not available on individual voters, the broader patterns can be analysed

The raw data are available here.

Demographic data are available here.

Additional estimates of the population born outside the UK

The reshape library or dplyr can be used to manipulate these data and merge them into a single data set. The code for this is not shown here. However a link is provided to the merged data set that resulted for England uploaded into CartoDB. The map can be queried and the underlying data set itself downloaded for further analysis.

Percentage voting leave UK

CartoDB link to results map

The influence of migration

A great deal of the controversy regarding the referendum centered around the role of the leave campaign’s focus on immigration as the major issue. If people’s experience of directly losing jobs to immigrants influenced their votes it would be logical to expect a positive relationship between the proportion of the population not born in the UK (who could not vote) and the leave vote at the local authority level.

library(ggplot2) g0<-ggplot(d,aes(x=pernonuk,y=Pct_Leave)) g1<-g0+geom_point(aes(col=win))+scale_x_log10()+geom_smooth(method=lm) g1<-g1+labs(x="Percentage of population born outside the UK, log scale",y="Percentage voting leave") g1

In fact the opposite tendency is observed. There is a lot of scatter around the trend line, but the trend is clearly significant overall. Local authorities with higher resident immigrant populations tended on average to record a lower proportion of votes for leave. This aggregated data however may be confounded by the fact that the authorities with the highest percentage of residents born outside the UK were in London, which overwhelming favoured remain. So the results should also be looked at by region.


The same general trend emerges, although there is of course once again a great deal of unexplained scatter in the results.

The analysis above was based on the overall percentage of the population born outside the UK. However the argument used in favour of “leave” was that recent migration is putting pressure on services causing resentment. There are also data available on net migration to each authority that can be used to test this assumption. Allowance should be made for the size of the resident population so a percentage of recent immigrants in the population of each local authority has been calculated.

g0<-ggplot(d,aes(x=permig,y=Pct_Leave)) g1<-g0+geom_point(aes(col=win))+geom_smooth(method=lm) g1<-g1+labs(x="Percent net migration",y="Percentage voting leave") g1<-g1+scale_x_log10() g1

Remarkably this trend is also downwards. Areas with the highest percentage of migrants voted to remain. Once again this may be due to the London effect, so it should be looked at by region.


Even at the regional level the trend is mainly negative, with the notable exception of the East Midlands. Media coverage has focused on towns such as Boston as if they were representative of the general mood of the country. In reality Boston, and the East midlands as a whole, are clearly not representative of the overall trends. Furthermore Boston itself has a very small number of registered voters so the high leave vote from that authority in particular had no influence on the overall vote.

Migration works both ways. Much of the polemic has surrounded the net migration figures. Part of the issue is that temporary migration, especially of students from EU, is recorded in the figures. The areas with high inward migration also have high rates of outward migration.

g0<-ggplot(dd,aes(x=MigIn,y=MigOut)) g1<-g0+geom_point(aes(col=win))+scale_x_log10()+geom_smooth(method=loess) g1<-g1+labs(x="Inward migration",y="Outward migration") g1

Notice that the migration figures for the majority of local authorities is still relatively low. The migration figures are dominated by movements within a very small number of local authorities.


High mobility is striking. There is large amount of outward migration in areas receiving immigrants. It can therefore be assumed that most of the outward migration is not the result of British citizens emigrating to either the EU or other countries. It is much more likely that the figures represent two way movements back and forth of migrants both from the EU. In the case of Birmingham which was the only authority with high rates of migration to marginally vote to leave much of the migration is to the Indian subcontinent rather than the EU.

Keep reading


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s