Easy Google geocoding in Stata

For the un-initiated: Geocoding is the fine art of converting addresses into geographical coordinates (longitude and latitude). Thanks to Google and some other providers like OpenStreeMap, this is now a relatively painless process. But when one needs more than a few addresses geocoded, one does not rely on pointing-and-clicking. One needs an API, i.e. a software library that makes the service accessible through R, Python or some other programming language.
geocode is a user-written Stata command that gives access to Googles API from within Stata. It takes a variable containing address strings and returns two new variables containing the latitude/longitude information

Putting candidates in their place with R

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. R function overlay from package sp carries out the relevant operation. Counting candidates and mapping their number is easy if you remember one thing: VECTORISATION

English Voters Prefer Local Candidates, Ceteris Paribus

The effect of geographical distance between candidate and voter on vote likelihood in the UK is essentially untested. In systems where constituency representatives vie for local inhabitants’ support in elections, candidates living closer to a voter would be expected to have a greater probability of receiving that individual’s support, other things being equal. In this paper, we present a first test of this concept using constituency data (specifically, notice of poll address data) from the British General Election of 2010 and the British Election Survey, together with geographical data from Ordnance Survey and Royal Mail, to test the hypothesis that candidate distance matters in voters’ choice of candidate. Using a conditional logit model, we find that the distance between voter and candidates from the three main parties (Conservative, Labour and Liberal Democrat) matters in English constituencies, even when controlling for strong predictors of vote-choice, such as party feeling and incumbency advantage.