As (West) European election years go, 2017 was quite something. The French party system changed beyond recognition. The radical right entered Germany’s national parliament for the first time. UKIP was wiped out, but May still managed to lose a comfortable majority. And very high fragmentation resulted in a coalition that looks improbable even by Dutch standards.
Accordingly, my colleagues have written up reports for France, Germany, the Netherlands, and the UK, complete with beautiful maps. Who does not like maps?
Four 2017 elections that changed West European Politics: France, Germany, the Netherlands & the UK
But perhaps you’re pressed for time or not sure if you really want to read four (fairly short) reports? With the European Parliamentary elections on the horizon, I made a short explainer/teaser video about them to bring you up to speed in just over two minutes. I have a hunch that afterwards, you will want to read all four pieces.
It is mildly embarrassing to come across a great resource that is hosted within one’s own institution by accident (read: google). Unwittingly googling one’s own publications is definitively worse, but that is not the point. Nonetheless, I was happy to stumble upon the Institute of European History’s digital map server when I needed to illustrate my point about territorial cleavages in Germany. The site has a slightly dusty look and uses gifs for previews, but the licence is more than generous and the coverage and quality are impressive. If you ever need a map of Hessen-Kassel’s administrative structures in 1821, look no further. The only thing that is missing (as far as I can tell) are shapefiles, but if you are serious about GIS applications, you can convert/georeference the postscript files. For lecture slides, the gifs should suffice anyway.
I’m more and more intrigued by the potential spatial data hold for political science. Once you begin to think about it, concepts like proximity and clustering are basic building blocks for explaining social phenomena. Even better, since the idea of open data has gone mainstream, more and more spatially referenced information becomes available, and when it comes to free, open source software, we are spoilt for choice or, at least in my case, up and beyond the point of utter confusion.
GRASS is a full-blown open source GIS, whose user interface is perfect for keyboard aficionados and brings back happy memories of the 1980s. While GRASS can do amazing things with raster and vector maps, it is suboptimal for dealing with rectangular data. In the end, we used only its underrated cartographic ps.map module, which reliably creates high-resolution postscript maps.
The real treasure trove, however, is R. The quality of packages for spatial analysis is amazing, and their scope is a little overwhelming. Applied Spatial Data Analysis with R by Roger Bivand, who wrote much of the relevant code, provides much-needed guidance.
Counting the number of mainstream candidates living in a constituency is a point-in-polygon problem: each candidate is a co-ordinate enclosed by a constituency boundary. Function overlay from package sp carries out the relevant operation. Once I had it located, I was seriously tempted to loop over constituencies and candidates. Just in time, I remembered the R mantra of vectorisation. Provided that points (candidates) and polygons (constituencies) have been transformed to the same projection, all that is needed is this: [email protected]$homeconst1 <-overlay(candpos1,mymap) [email protected]$homeconst2 <-overlay(candpos2,mymap) [email protected]$homeconst3 <-overlay(candpos3,mymap)
This works because candpos1 is a vector of points that represent the spatial positions of all Labour candidates. These are tested against all constituency boundaries. The result is another vector of indices, i.e. sequence numbers of the constituencies the candidates are living in. Put differently, overlay takes a list of points and a bunch of polygons and returns a list that maps the former to the latter. With a bit of boolean logic, a vector of zeros (candidate outside constituency) and ones (candidate living in their constituency) ensues. Summing up the respective vectors for Labour, Tories, and LibDems then gives the required count that can be mapped. Result!