Wondering how the tests work?

Partisan gerrymandering has a very particular goal: amplify a political party's power far beyond what it deserves based on vote share alone. This process is accomplished by two complementary methods: cracking and packing. "Packing" occurs when as many supporters of the victim party as possible are crammed into a small number of districts, creating a few overwhelming wins for the victim party. The remaining members of the victim party are then "cracked", or spread evenly across a large number of districts, so that they comprise a large but minority block of voters (typically 40 - 45%). Luckily, cracking and packing creates a distinctive pattern of wins for both the perpetrating and victimized parties, where the victim party wins its few seats by overwhelming margins and the perpetrating party wins its many seats by considerably lower margins. This pattern, and thus partisan gerrymanders, can be detected with the help of a little math.



Lopsided Wins (t-test)

The two-sample t-test, often called the most widely used statistical test of all time, tests how similar two groups are. In the case of gerrymandering, the t-test can determine how similar the group of districts won by Democrats is to the group of districts won by Republicans. In a perfectly fair world, it could be assumed that these two groups look very much like one another. Each party might expect to see wins in a mix of strongly partisan districts, moderately reliable districts, and tossups -- but each party should expect to have a roughly similar mix. In a gerrymandered state, by contrast, the victim party only accrues strong wins (the result of packing) and the perpetrating party only sees small-but-safe wins (the result of cracking). The t-test can check for this distinctive pattern of lopsided outcomes, and can check for the probability that that pattern arose by chance. If the outcome was unlikely to have occurred by chance alone, and the outcome favors one party, it's a possible indication that the state suffered a partisan gerrymander.

An example of the clustering effect detectable by the t-test in North Carolina's 2012 Congressional elections.

The t-test provided on this website is a one-tailed test, given the prior assumption that the party which wins a majority of the seats in a state may have perpetrated a gerrymander. It assumes homoscedasticity, or that Democratic and Republican wins in non-gerrymandered states should be distributed equally. This test can be performed in Microsoft Excel using the T.Test function.


Consistent Advantage (Mean-Median Difference)

Partisan gerrymandering can also be detected by comparing a party's statewide vote strength to the number of Congressional seats it wins. As mentioned above, in a gerrymander of a state that's roughly evenly split between parties, many of the supporters of the victim party are crammed into a few districts that they win overwhelmingly, and the remaining supporters are spread sparsely among districts they lose by small margins. This effect can be discerned by examining the difference between the average and median vote shares of either party. A large difference between the mean and median (which, mathematically and intuitively, is unlikely to arise by chance) is indicative of a partisan gerrymander.

The mean-median difference is simply calculated by subtracting the average vote share of either party across all districts from the median vote share of the same party across all districts. A negative mean-median difference indicates that the examined party has an advantage; a positive difference indicates that the examined party is disadvantaged. A z-score for the effect can be calculated by dividing the mean-median difference by the standard error of the party's vote share across districts, then applying a correction factor of .5708, as described in A Simple Test of Symmetry About an Unknown Median, Cabilio and Masaro, 1996.

In states where one party dominates at a statewide level, the mean-median difference becomes less robust. In those situations, tests of variance can be applied to detect asymmetric advantage, as described in Prof. Wang's Election Law Journal article.

Excess Seats (simulated elections)

Another way to detect possible gerrymanders is to examine how much the makeup of a state's Congressional delegation deviates from nationwide results, given the state's party divide. The statistical method for such analysis is the Monte Carlo simulation. Essentially, this test is a Congressional version of fantasy baseball -- out of the 435 districts nationally, randomly pick as many as are in the state of interest, check if they match the overall partisan makeup of the state and, if they do, record the party split of the districts' Congressional delegation. Repeat the process many times, then compare the results of the simulations to the actual state results.

The result of Monte Carlo analysis performed on Pennsylvania in 2012. None of the simulations showed as extreme a result as actually occurred (Democrats winning 51% of the vote but only 5 seats).

The Monte Carlo calculations carried out on this website uses 1 million simulations. A set of districts is said to match the partisan makeup of a state if the total vote share for each party across all districts is within 0.2% of the actual vote share across all districts. After the simulation is complete, the average number and standard deviation of Democratic seats across the matching fantasy delegations is calculated and used to define the zone of chance. The p-value is then calculated by determining how many simulations had outcomes as or more advantageous to the dominant party than occurred in reality (e.g. in states with a majority Democratic delegation, the number of simulations with as many or more Democratic seats).