Code Monkey home page Code Monkey logo

va_efficiency's Introduction

Virginia Efficiency Gap 1947-2016

Context

Partisan gerrymandering is generally considered to be an obstructor to true representative democracy. The efficiency gap metric is one way to measure the extent to which a particular district map benefits one party or the other in a bipartisan system: it measures the partisan difference in wasted votes (across the state) as a proportion of total votes cast, where a wasted vote is any vote for a losing candidate, or any votes more than floor(total_votes / 2 + 1) for the winning candidate.

This script applies the efficiency gap measure to Virginia's General Assembly and US Representative elections over the last 60 years, using data pulled from http://historical.elections.virginia.gov/.

For simplicity, votes cast for candidates other than Republican and Democratic are ignored. The efficiency gap works on the district map as a whole, rather than on any single district. To get a sense of the general balance of the district map, this script also sums across all elections for a particular office held within the decade for which the district map persisted.

Results

Figure

While historically the district maps have varied in their partisan favour, in the last decade the VA and US House district maps have heavily favoured the Republican party - they have allowed the conversion of votes into seats at a rate nearly 20% higher than the Democrats

Issues

  • At time of writing, the 2017 elections' results are not finalsed. The efficiency gap is particularly sensitive to results in marginal seats, so this election is ignored for now.

  • The efficiency gap works on votes, and as such can say nothing about factors influencing those who did not vote at all. Uncontested seats have been ignored in this analysis for that reason, but low turnout by opposition voters in safe but technically contested seats is a potential confound.

Dependencies

  • Python >=3.6
pip install -r requirements.txt

Usage

python3 -m va_efficiency path/to/figure.png

Path defaults to figure.png

va_efficiency's People

Contributors

clbarnes avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.