Why German elections don't make sense

There's only a week left on the German federal campaign, so I've decided to take a closer look at the mechanics of the actual election by implementing the complete tabulation process in a JavaScript library, btw13.js (see it in action).

Tally of the 2013 German elections, based on btw13.js's calculations of seat allocations.

Our electoral system is notoriously complex, with 299 districts electing both a direct representative, and party representatives from one of 16 state lists. Theoretically, this should leave us with a total of 598 members of the Bundestag (MdBs). To ensure proportionality between the state and district votes, however, additional seats are created in some states, based on the outcome of the vote. This has lead not only to a total of 620 MdBs in the current session, but also to situations in which additional votes in a particular state can cost a party seats in parliament.

Of course, more votes should mean more seats, so in 2012 the German constitutional court declared the rules used in the 2009 election unconstitutional. This resulted in a lot of backroom negotiations in parliament, leading to an even more complex electoral law for this year's election. The most politically attractive solution to negative vote weights turned out to be simple: more parliamentarians.

Basically, the new system works by first calculating the minimal number of seats that each party should get in each state, then adding them up and finding a seat constellation in the federal parliament which has the proportions of the federal vote, but at least as many seats as each party has been allocated in the states. Finally, the seats then get distributed down to the states, where one of the parties can somehow still end up with fewer seats than they've been allocated in the first step.

All of this is really complex and weird, so I decided to learn about it by writing it up as an algorithm. The resulting script is a nice way to parse the data feed released by the German elections authority on election evening, and to turn it into a tabulation of state and federal seat distributions. Which, by election evening, I'm hoping to turn into something similar to the NPR Big Board.

Sample data released by the German elections authority contains an extreme case of the possible election results. It shows a constellation - just a few points off current polling - in which we end up with 810 seats in the Bundestag. That's more than all of the US Congress, and more than the bloated, 28-country EU Parliament with its 766 seats.

One way to fight unemployment.