Home

Awesome

Metrics for quantifying gerrymandering

PyPI version

This repository contains:

  1. Python code for implementing a number of metrics for quantifying gerrymandering<sup>9</sup>:
    • Mean-median difference and variant:
      • Mean-median difference<sup>1,2</sup>
      • Equal vote weight<sup>2</sup>
    • Lopsided margins (two-sample t-test on win margins)<sup>1</sup>
    • Bootstrap (Monte Carlo) simulation<sup>1</sup>
    • Mann-Whitney U test
    • Declination variants<sup>3</sup>
      • Declination
      • Declination (buffered)
      • Declination variant
      • Declination variant (buffered)
    • Efficiency gap variants
      • Efficiency gap<sup>4</sup>
      • Difference gap<sup>5,6,7</sup>
      • Loss gap<sup>7</sup>
      • Surplus gap<sup>8</sup>
      • Vote-centric gap<sup>6,7</sup>
      • Vote-centric gap 2<sup>6,7</sup>
      • Tau gap<sup>3</sup>
    • Partisan bias<sup>6,7</sup>
  2. Historical election results:
    • Congressional elections, 1948–2016 (CSV)
    • State legislative elections (lower house), 1971–2017 (CSV, full repository)
  3. Jupyter notebook demonstrating how to run the tests on all elections, as well as reporting the percentile ranking for all tests of any particular election.

Installation

If using pip, do pip install gerrymetrics

References

  1. Samuel S.-H. Wang. (2016). Three Tests for Practical Evaluation of Partisan Gerrymandering. Stanford Law Review.
  2. Michael D. McDonald and Robin E. Best. (2015). Unfair Partisan Gerrymanders in Politics and Law: A Diagnostic Applied to Six Cases. Election Law Journal.
  3. Gregory S. Warrington. (2018). Quantifying Gerrymandering Using the Vote Distribution. Election Law Journal.
  4. Eric McGhee. (2014). Measuring Partisan Bias in Single‐Member District Electoral Systems. Legislative Studies Quarterly.
  5. Whitford v. Gill, No. 15-cv-421, F. Supp. 3d. (2016). Griesbach, dissenting, 128.
  6. Benjamin P. Cover. (2018). Quantifying Partisan Gerrymandering: An Evaluation of the Efficiency Gap Proposal. Stanford Law Review.
  7. John F. Nagle. (2017). How Competitive Should a Fair Single Member Districting Plan Be? Election Law Journal.
  8. Wendy K. Tam Cho. (2018). Measuring Partisan Fairness: How Well Does the Efficiency Gap Guard Against Sophisticated as well as Simple-Minded Modes of Partisan Discrimination? University of Pennsylvania Law Review.
  9. Gregory S. Warrington. (2018). A Comparison of Gerrymandering Metrics. arXiv.