Online Gerrymander calculator
Enter the by district vote counts below and hit submit to calculate the amount and direction of gerrymandering.
To see how the numbers are calculated click: view source.
For an explanation of the reasoning behind the measure, read this blog post.
Score normalization | Disenfranchised Democrats | Disenfranchised Republicans | Difference | Sum |
raw | | | | |
per voter | | | | |
Seats / votes curve asymmetry:
$r) {
$s++;
}
}
$votes[] = $v;
$seats[] = $s/$count;
}
//count asymmetric area
$da = 0;
$ra = 0;
$c = count($votes);
for( $i = 0; $i < $c; $i++) {
$j = $c-$i-1;
$med = ($seats[$i]+(1-$seats[$j]))/2;
if( $med > $votes[$i]) {
$da += $med - $votes[$i];
} else {
$ra += $votes[$i] - $med;
}
}
$da *= $inc;
$ra *= $inc;
//count disenfranchisement
$dem_sq = 0;
$rep_sq = 0;
$tot = 0;
for( $i = 0; $i < $count; $i++) {
$excess = $dem_votes[$i] - $rep_votes[$i];
if( $excess < 0) {
$rep_sq += $excess * $excess;
} else {
$dem_sq += $excess * $excess;
}
$tot += abs($excess);
}
if( $tot == 0) { $tot = 1; }
return array(
"dem" => $dem_sq/$tot , "rep" => $rep_sq/$tot,
"dem_t" => $dem_sq/$target , "rep_t" => $rep_sq/$target,
"target" => $target,
"dem_a" => $da , "rep_a" => $ra,
);
}
include 'footer.php';
?>