Gerrymandering code – for the do-it-yourselfers

January 3, 2013 by Sam Wang

For the true hardcore…A version of the MATLAB code I used is now available. I used gerry.m for Part 1, and delegations.m for Part 2. Voting data are available from David Wasserman (@Redistrict).

The code is a bit of a mess: mysterious variable names, bad structure, that kind of thing. I’ll clean it up later.

If you have 2010 or earlier House voting data in tabular form, let me know. It will allow additonal tests.


Mint says:

Hi Sam,
I like the work you’ve done here, but there’s an issue in your conclusions. You assume that any deviation from the national structural imbalance is due to gerrymandering, discounting the possibility that there can be major state-to-state variations.
Since PA was the biggest outlier, I sought its local data and found it here:
The districting cuts through a few of the 67 counties, reating 106 subdistricts. I also assembled a connectivity graph for all the counties, allowing me to make good approximations of randomly created districts using the data for 106 subdistricts.
What I found is that PA has a HUGE structural imbalance. Picking a random citizen and growing a new district around him by adding votes from neighboring subdistricts results in Democrats winning only ~30-35% of the time, despite the evenly split vote.
If you’re interested in the code, let me know, preferably by email.

Leave a Reply

Your email address will not be published. Required fields are marked *