# US Election 2016: What if the Electoral College was proportional?

The title says it all really. What would have happened in the 2016 American federal election if votes in the Electoral College were allocated proportionally, either within each state or nationwide? I was curious, so here's some number-crunching.

Electoral Votes | Clinton | Trump | Johnson | Stein | McMullin |
---|---|---|---|---|---|

State-level Sainte-Laguë | 263 | 261 | 12 | 1 | 1 |

State-level D'Hondt | 267 | 266 | 3 | 1 | 1 |

National Sainte-Laguë | 257 | 255 | 18 | 6 | 2 |

National D'Hondt | 258 | 255 | 18 | 5 | 2 |

Weighted national Sainte-Laguë | 257 | 253 | 19 | 6 | 3 |

Weighted national D'Hondt | 258 | 255 | 18 | 5 | 2 |

Candidates other than those listed were not considered for the purposes of the calculation.

Here is my spreadsheet, if you'd like to look at the per-state breakdown. This was done very quickly, so please check my numbers! The Python code used is shown below:

```
NUM_CANDS = 5
def getWinners(evs, votes, quotient):
evsAllocated = [0] * len(votes)
while sum(evsAllocated) < evs:
quotients = [quotient(votes[i], evsAllocated[i]) for i in range(0, len(votes))]
maxquot = max(quotients)
maxcands = [i for i, j in enumerate(quotients) if j == maxquot]
if len(maxcands) > 1:
print('Error: A tie for the quotient.')
sys.exit(1)
evsAllocated[maxcands[0]] += 1
return evsAllocated
with open('data.tsv') as dataFile:
for line in dataFile:
data = line.rstrip('\n').split('\t')
assert len(data) == NUM_CANDS + 2
evs = int(data[1])
votes = [int(data[i + 2]) if len(data[i + 2]) > 0 else 0 for i in range(0, NUM_CANDS)]
result = getWinners(evs, votes, lambda v, s: v/(2*s+1)) + getWinners(evs, votes, lambda v, s: v/(s+1))
print(' '.join([str(x) for x in result]))
```

Input is of the form:

```
Alabama 9 718084 1306925 44211 9341
Alaska 3 93007 130415 15396 4699
Arizona 11 1123979 1219596 104688 32850
Arkansas 6 378632 681765 29662 9413 13187
etc.
```