Skip to content

Instantly share code, notes, and snippets.

@cingraham
Last active April 26, 2019 14:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cingraham/7551527 to your computer and use it in GitHub Desktop.
Save cingraham/7551527 to your computer and use it in GitHub Desktop.
How Dems won the popular vote but lost the House

Interactive graphic by Christopher Ingraham. Vote totals from the Federal Election Commission. Current House delegation data from Wikipedia. State government control data compiled by Derek Willis.

After the 2012 election many commenters noted an extraordinary fact: House Democrats earned 1.17 million more votes than their Republican counterparts. Yet despite receiving 50.59% of the two-party vote, they only received 46.21% of the total seats in the House. I wanted to investigate which states accounted for the majority of this discrepancy.

I gathered summary election data from the Federal Election Commission. For each state, I took each party's share of the two-party vote and expressed it as a percent, and then calculated the expected number of seats won per party based on their vote share and the total number of seats per state. I then compared this number to the state's actual Congressional delegation, calculating the difference between the two. Finally, for visualization purposes I plotted each value and colored each bar according to which party is in control of the state's government.

Democrats hit above their weight in 18 states, for a total over-representation of 22.79 seats. But in the remaining 32 states they are actually under-represented to the tune of 40.79 seats. The net is a total under-representation in the House of 18 seats -- the number of additional seats they would have had to have won in order for the partisan make-up of the House to completely match the parties' respective popular vote shares.

Pennsylvania and Ohio are notable for their high degree of Democratic under-representation. In Pennsylvania, for instance, Democrats received over half of the popular two-party vote, but won less than a third of the state's House seats. The converse is true in California, where Democrats are over-represented by over 5 seats.

Most striking, states with Democratic under-representation are almost exclusively controlled by the GOP, and vice-versa. This strongly suggest that highly partisan endeavors like redistricting are at play here, and underscores the importance of state and local elections in influencing national politics.

Obviously this is something of an academic exercise -- deriving percentages necessitates dealing with fractions of seats, which is a real-world impossibility. Moreover, complete parity between vote shares and congressional make-up is an impossibility -- there will be a losing candidate in every contested election. Nonetheless, the exercise provides a useful illustration of where Democrats are underperforming relative to their vote shares. This is less of a conclusion and more of a jumping-off point for future research. In particular, I'd like to look at these numbers from a historical context -- there's a sense that this Congress is an outlier, but it is unclear how much. I also plan to look at these figures in the context of redistricting efforts.

Comments? Questions? Ideas? Drop me a note.

<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>Where are the missing Democrats?</title>
<link rel = "stylesheet" type = "text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<style type = "text/css">
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
position: relative;
}
#container {
padding: 10px;
width: 960px;
}
svg { background:rgb(255,255,255);position:relative;}
svg:not(:root) { overflow: hidden; }
.axis text {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #333;
shape-rendering: crispEdges;
}
#tt { pointer-events: none;color:white;}
#tipContainer { font-size:16px;position:absolute;width:180px;z-index:100;background-repeat:no-repeat;text-align:left;line-height:20px;}
#tipLocation {font-weight:normal;font-family:Georgia; font-style: Italic; color:white;margin:0px;padding:10px 10px;background:#333;font-size:14px;}
#tipCount {font-weight:bold;font-size:32px;letter-spacing:-1px;margin:0px;padding:0px 10px 10px 10px;color:#333;}
#tipKey {font-weight:normal;font-size:10px;color:#333;margin:0px;padding:5px 0px 5px 10px;background:#eee;}
.tipClear { clear:both;}
</style>
</head>
<body>
<h3 style = "font-size: 18px; padding: 10px;"><i>Under- and over-representation of Democrats in the U.S. House, 113th Congress, by state</i></h3>
<p style = "padding-left: 10px;"><b>Bars are colored according to which party is in control of the state government: red for Republicans, blue for Democrats, grey for split/other. Mouse over for detail.</b></p>
<p style = "padding-left: 10px;">The y-axis indicates the difference between the number of actual and expected Democratic seats in a state's House delegation. Expected values are based on total votes for a given party across all House races in a given state. Negative values indicate fewer Democratic seats than expected, positive indicate more Democratic seats than expected.<p>
<div id = "container">
</div>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<script>
var margin = {
top: 10,
right: 20,
bottom: 20,
left: 40
},
w = 960 - margin.left - margin.right,
h = 500 - margin.top - margin.bottom;
var formatpct = d3.format(".1%");
var format1 = d3.format(",0f");
var x = d3.scale.ordinal().rangeRoundBands([0, w], .1, 1);
var y = d3.scale.linear().range([h, 0]);
var red = "#bb1813",
blue = "#0071bc";
var xAxis = d3.svg.axis().scale(x).tickSize(5).orient("bottom");
var yAxis = d3.svg.axis().scale(y).orient("left");
var svg = d3.select("#container").append("svg").attr("width", w + margin.left + margin.right).attr("height", h + margin.top + margin.bottom).append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var tooltip = d3.select("#container").append("div").attr("id", "tt").style("z-index", "10").style("position", "absolute").style("visibility", "hidden");
d3.csv("results.csv", function (error, data) {
data.forEach(function (d) {
for (var prop in d) {
if (!isNaN(d[prop])) {
d[prop] = +d[prop]
};
}
});
x.domain(data.sort(function (a, b) {
return b.diffdem - a.diffdem;
}).map(function (d) {
return d.state;
}))
y.domain([-5, 5]);
svg.append("g").attr("class", "y axis").call(yAxis).attr("transform", "translate(-10," + 0 + ")").append("text").attr("class", "ylabel").attr("transform", "rotate(-90)")
.attr("y", 6).attr("dy", ".71em").style("text-anchor", "end").text("Diff. between actual and expected Democratic seats in state's House delegation");
svg.selectAll(".bar").data(data).enter().append("rect").attr("class", ".bar").attr("x", function (d) {
return x(d.state);
}).attr("width", x.rangeBand()).attr("y", function (d) {
return y(Math.max(0, -d.diffdem));
}).attr("height", function (d) {
return Math.abs(y(-d.diffdem) - y(0));
}).style("fill", function (d) {
if (d.legis_control == "Dem") {
return blue;
} else if (d.legis_control == "Rep") {
return red;
} else {
return "#ccc";
}
}).style("fill-opacity", 0.6).on("mouseover", function (d) {
return toolOver(d, this)
}).on("mouseout", function (d) {
return toolOut(d, this)
}).on("mousemove", function (d, i) {
myPos = d3.mouse(this);
myX = myPos[0];
myY = myPos[1];
return toolMove(d.state, d.totaldr, d.totalhouse, d.dem, d.expdemseats, d.demhouse, d.diffdem)
});
svg.append("g").attr("class", "x axis").attr("transform", "translate(0," + (h / 2) + ")").style("pointer-events", "none").call(xAxis).append("text").attr("class", "xlabel").attr("x", w).attr("y", -6).style("text-anchor", "end").text("State");
svg.append("text").attr("id", "underlabel").style({
"font-size": "18px",
"font-weight": "bold",
"fill": "#333"
}).attr("x", 25).attr("y", h / 2 - 100).text("Total under-representation:");
svg.append("text").attr("id", "underval").style({
"font-size": "60px",
"font-weight": "bold",
"fill": "#333"
}).attr("x", 25).attr("y", h / 2 - 40).text("40.79 seats");
svg.append("text").attr("id", "overlabel").style({
"font-size": "18px",
"font-weight": "bold",
"fill": "#333",
"text-anchor": "end"
}).attr("x", w - 25).attr("y", h / 2 + 50).text("Total over-representation:");
svg.append("text").attr("id", "overval").style({
"font-size": "60px",
"font-weight": "bold",
"fill": "#333",
"text-anchor": "end"
}).attr("x", w - 25).attr("y", h / 2 + 110).text("22.79 seats");
svg.append("text").attr("id", "overlabel2").style({
"font-size": "18px",
"font-weight": "bold",
"fill": "#333",
"text-anchor": "end"
}).attr("x", w - 25).attr("y", h / 2 + 160).text("Net difference, under- vs. over-representation:");
svg.append("text").attr("id", "overval2").style({
"font-size": "60px",
"font-weight": "bold",
"fill": "#333",
"text-anchor": "end"
}).attr("x", w - 25).attr("y", h / 2 + 220).text("18 seats");
});
function toolOver(v, thepath) {
d3.select(thepath).style({
"fill-opacity": "1"
});
return tooltip.style("visibility", "visible");
};
function toolOut(m, thepath) {
d3.select(thepath).style({
"fill-opacity": "0.6"
});
return tooltip.style("visibility", "hidden");
};
function toolMove(state, totalvotes, totalreps, demvotes, expecteddems, actualdems, diff) {
if (myX < 120) {
myX = 120
};
return tooltip.style("top", myY + -30 + "px").style("left", myX - 120 + "px").html("<div id='tipContainer'><div id='tipLocation'><b>" + state + "</b></div><div id='tipKey'>Total votes: <b>" + format1(totalvotes) + "</b><br>Dem votes: <b>" + format1(demvotes) + "</b><br>Total reps from state: <b>" + totalreps + "</b><br>Expected Dem seats: <b>" + expecteddems + "</b><br>Actual Dem seats: <b>" + actualdems + "</b><br>Difference: <b>" + -diff + "</b></div><div class='tipClear'></div> </div>");
};
d3.select(self.frameElement).style("height", "700px");
</script>
</body>
</html>
state dem rep totaldr expdem exprep demhouse rephouse totalhouse actdem actrep diff votesperseat expdemseats exprepseats diffdem diffrep difftots legis_control
CA 7392703 4530012 11922715 62 38 38 15 53 71.7 28.3 9.7 224956.9 32.86 20 -5.14 5 0 Dem
NY 3904513 1949229 5853742 66.7 33.3 21 6 27 77.8 22.2 11.1 216805.3 18.01 9 -2.99 3 0 Dem
IL 2743702 2207818 4951520 55.4 44.6 12 6 18 66.7 33.3 11.3 275084.4 9.97 8 -2.03 2 0 Dem
MA 2080594 697637 2778231 74.9 25.1 8 0 8 100 0 25.1 347278.9 5.99 2 -2.01 2 0 Dem
CT 884398 490580 1374978 64.3 35.7 5 0 5 100 0 35.7 274995.6 3.22 2 -1.78 2 0 Dem
MD 1626872 858406 2485278 65.5 34.5 7 1 8 87.5 12.5 22 310659.8 5.24 3 -1.76 2 0 Dem
OR 949660 687839 1637499 58 42 4 1 5 80 20 22 327499.8 2.90 2 -1.10 1 0 Dem
NH 340925 311636 652561 52.2 47.8 2 0 2 100 0 47.8 326280.5 1.04 1 -0.96 1 0 Split
AZ 946994 1131663 2078657 45.6 54.4 5 4 9 55.6 44.4 10 230961.9 4.10 5 -0.90 1 0 Rep
RI 232679 161926 394605 59 41 2 0 2 100 0 41 197302.5 1.18 1 -0.82 1 0 Dem
ME 427819 265982 693801 61.7 38.3 2 0 2 100 0 38.3 346900.5 1.23 1 -0.77 1 0 Dem
HI 285008 137531 422539 67.5 32.5 2 0 2 100 0 32.5 211269.5 1.35 1 -0.65 1 0 Dem
MN 1560984 1210409 2771393 56.3 43.7 5 3 8 62.5 37.5 6.2 346424.1 4.51 3 -0.49 0 0 Dem
WA 1852870 1511131 3364001 55.1 44.9 6 4 10 60 40 4.9 336400.1 5.51 4 -0.49 0 0 Dem
DE 249933 129757 379690 65.8 34.2 1 0 1 100 0 34.2 379690.0 0.66 0 -0.34 0 0 Dem
NM 422189 323269 745458 56.6 43.4 2 1 3 66.7 33.3 10 248486.0 1.70 1 -0.30 0 0 Dem
VT 208600 67543 276143 75.5 24.5 1 0 1 100 0 24.5 276143.0 0.76 0 -0.24 0 0 Dem
NV 453310 457239 910549 49.8 50.2 2 2 4 50 50 0.2 227637.3 1.99 2 -0.01 0 0 Dem
IA 772387 726505 1498892 51.5 48.5 2 2 4 50 50 -1.5 374723.0 2.06 2 0.06 0 0 Split
LA 359190 1239614 1598804 22.5 77.5 1 4 5 20 80 -2.5 319760.8 1.12 4 0.12 0 0 Rep
WV 257101 384253 641354 40.1 59.9 1 2 3 33.3 66.7 -6.8 213784.7 1.20 2 0.20 0 0 Dem
WY 57573 166452 224025 25.7 74.3 0 1 1 0 100 -25.7 224025.0 0.26 1 0.26 0 0 Rep
AK 82927 185296 268223 30.9 69.1 0 1 1 0 100 -30.9 268223.0 0.31 1 0.31 0 0 Rep
UT 324309 647873 972182 33.4 66.6 1 3 4 25 75 -8.4 243045.5 1.33 3 0.33 0 0 Rep
CO 1080454 1143796 2224250 48.6 51.4 3 4 7 42.9 57.1 -5.7 317750.0 3.40 4 0.40 0 0 Dem
SD 153789 207640 361429 42.6 57.4 0 1 1 0 100 -42.6 361429.0 0.43 1 0.43 0 0 Rep
ND 131869 173433 305302 43.2 56.8 0 1 1 0 100 -43.2 305302.0 0.43 1 0.43 0 0 Rep
MT 204939 255468 460407 44.5 55.5 0 1 1 0 100 -44.5 460407.0 0.45 1 0.45 0 0 Rep
MS 411398 703635 1115033 36.9 63.1 1 3 4 25 75 -11.9 278758.3 1.48 3 0.48 0 0 Rep
ID 208297 406814 615111 33.9 66.1 0 2 2 0 100 -33.9 307555.5 0.68 1 0.68 -1 0 Rep
GA 1448869 2104098 3552967 40.8 59.2 5 9 14 35.7 64.3 -5.1 253783.4 5.71 8 0.71 -1 0 Rep
KS 195505 740981 936486 20.9 79.1 0 4 4 0 100 -20.9 234121.5 0.84 3 0.84 -1 0 Rep
NJ 1960820 1430386 3391206 57.8 42.2 6 6 12 50 50 -7.8 282600.5 6.94 5 0.94 -1 0 Dem
WI 1445015 1401995 2847010 50.8 49.2 3 5 8 37.5 62.5 -13.3 355876.3 4.06 4 1.06 -1 0 Rep
NE 276239 496276 772515 35.8 64.2 0 3 3 0 100 -35.8 257505.0 1.07 2 1.07 -1 0 N/A
AL 693498 1233624 1927122 36 64 1 5 6 16.7 83.3 -19.3 321187.0 2.16 4 1.16 -1 0 Rep
AR 304770 637591 942361 32.3 67.7 0 4 4 0 100 -32.3 235590.3 1.29 3 1.29 -1 0 Rep
TN 796513 1369562 2166075 36.8 63.2 2 7 9 22.2 77.8 -14.5 240675.0 3.31 6 1.31 -1 0 Rep
KY 791342 1201674 1993016 39.7 60.3 1 5 6 16.7 83.3 -23 332169.3 2.38 4 1.38 -1 0 Split
MO 1119554 1463586 2583140 43.3 56.7 2 6 8 25 75 -18.3 322892.5 3.47 5 1.47 -1 0 Rep
OK 410324 856872 1267196 32.4 67.6 0 5 5 0 100 -32.4 253439.2 1.62 3 1.62 -2 0 Rep
SC 714191 1026129 1740320 41 59 1 6 7 14.3 85.7 -26.8 248617.1 2.87 4 1.87 -2 0 Rep
IN 1142554 1351760 2494314 45.8 54.2 2 7 9 22.2 77.8 -23.6 277146.0 4.12 5 2.12 -2 0 Rep
FL 3392402 3826522 7218924 47 53 10 16 26 38.5 61.5 -8.5 277650.9 12.22 14 2.22 -2 0 Rep
MI 2487243 2238540 4725783 52.6 47.4 5 9 14 35.7 64.3 -16.9 337555.9 7.37 7 2.37 -2 0 Rep
TX 2949900 4429270 7379170 40 60 12 24 36 33.3 66.7 -6.6 204976.9 14.39 22 2.39 -2 0 Rep
VA 1806025 1876761 3682786 49 51 3 8 11 27.3 72.7 -21.8 334798.7 5.39 6 2.39 -2 0 Split
NC 2218357 2137167 4355524 50.9 49.1 4 9 13 30.8 69.2 -20.2 335040.3 6.62 6 2.62 -3 0 Rep
OH 2412451 2620251 5032702 47.9 52.1 4 12 16 25 75 -22.9 314543.9 7.67 8 3.67 -4 0 Rep
PA 2793538 2710070 5503608 50.8 49.2 5 13 18 27.8 72.2 -23 305756.0 9.14 9 4.14 -4 0 Rep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment