Extensive Analysis of the Pennsylvania districts

This is part 2 of Gerrymandering series in which , we will do more analysis and focus on PA state.

In the previous part, we discussed what gerrymandering is and the ways we can detect it. Now, in this part, we will discuss those ways in detail by investigating the 2012 plan for PA and comparing it with the 2018 (remedial) plan.

First of all, let’s look at the population distribution.

this image shows how population is unevenly distributed across the districts in the 2012 plan.
This image shows how the population distribution is comparatively even in the 2018 plan.

From the above plots, it is visible how uneven population distribution is in the 2012 plan compared to the 2018 plan, especially district number 6 in the 2012 plan which first of all, has a crooked design (we will talk about design later) has got a population more than 700,000 whereas bigger districts like 10 has got considerably lesser population. This unevenness itself is the first sign where large number of voters seems to be “packed” in a small district. If you look at the 2018 plan, the distribution seems quite equal across the districts. There are signs of packing in the 2012 plan as large districts have relatively lesser population than small ones whereas in the 2018 one, population distribution looks near about same, although there is difference.

Population distribution doesn’t give us the whole idea whether gerrymander has occured or not. So we dive into some metrics. First, we will use the compactness metrics we discussed in the previous blog and see how the 2012 and 2018 plan performed.

We can see compactness-wise, 2018 plan stands out better, irrespective of any method chosen. More districts are darker in the 2018 plan which implies higher compactness values. Although methods like Polsby-Popper and Schwartzberg are a bit more sensitive to district 6 (lower right hand side) compared to the other two methods. That’s why it’s always better to go with multiple methods and see how the results turn out. But does this give out the whole picture for gerrymandering? NO!

We need to investigate fairness metrics as well to get an even better insight.

Fairness metric comparison for 2012 and 2018 plan

We see that no matter what fairness method you choose, 2012 plan has worse scores compared to 2018 plan. (In case, you are confused, the more the scores are closer to 0, better is the plan)

There is no evidence available to show one fairness metric is better than the rest. All of them have their own shortcomings. So just like compactness scores, all the fairness scores should be treated equally although the Supreme Court favors Efficiency gap more.

In this analysis, we surely see that 2012 plan is worse in every aspect, be it population distribution across districts, compactness metric scores or fairness metric scores. These evidences lead us to the conclusion that gerrymandering has surely occured in PA in 2012 election and that the 2018 plan was able to answer the issues to some extent.

Situations like these bring out the necessity to use computation to generate district plans where there will be less chance of introducing bias. In the next blog, I will show you the clustering technique which I used to generate a plan and will check whether it was better than these existing ones.

You can check my project here.


  1. Smallest enclosing circle. (2018, June 20). Project Nayuki. https://www.nayuki.io/page/smallest-enclosing-circle
  2. McGlone, D. (2020, January 09). Measuring District Compactness in PostGIS. Retrieved from https://www.azavea.com/blog/2016/07/11/measuring-district-compactness-postgis/

3. Lefkowitz, M. (2020, November 24). ‘Fairmandering’ draws fair districts using data science. Cornell Chronicle. https://news.cornell.edu/stories/2020/11/fairmandering-draws-fair-districts-using-data-science

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store