On December 20 a general election was held in Spain and it’s been a very active topic in local news and social networks. As usual, many people discussed seat allocation after the results were published and more so in this case. Two new parties got a lot of votes and the parliament is very fragmented. I had a rough idea of the whole seat allocation process but in the last few weeks, thanks to dozens of published articles and hundreds of comments, I learned quite a lot about it, and I also learned the specifics of the D’Hondt method used to allocate seats.
The process is well explained in the Wikipedia article about the election. For the parliament (the senate uses a different election mechanism), there are a total of 52 voting districts. These correspond to the 50 Spanish provinces in which the 17 autonomous communities are divided (autonomous communities are similar, saving the somewhat large distances, to states in the United States). Additionally, the cities of Ceuta and Melilla are voting districts too, choosing one seat each.
The amount of seats chosen in each district is mentioned in the Wikipedia article, for a total of 350. This division in voting districts is often mentioned as the cause of disproportional distribution in the number of seats. There’s another separate Wikipedia article discussing the election results were you can see the number of seats allocated for each party in the official results. In each voting district, the D’Hondt method was applied to allocate seats for each party as required by election law.
Some weeks ago, I didn’t know exactly how the D’Hondt method worked. I read Wikipedia’s above entry on it and found it to be surprisingly simple. In fact, I implemented a bit of Python code to calculate seat allocations if one single district had been used for the whole country. The code implements the D’Hondt method as well as the Sainte-Laguë method and the modified Sainte-Laguë method, just to compare several highest quotient methods. The code has been uploaded to GitHub if you want to play with it. It takes voting results in a specific format described in the code comments (and an example from the general election) and generates an HTML page with the results, which is the best format for result analysis I could think of. In the generated results, DH refers to D’Hondt, SL to Sainte-Laguë and MSL to Modified Sainte-Laguë.
I don’t think I can do a better job at describing the D’Hondt method than the Wikipedia article does, but it simply requires dividing the total number of votes each party got by an increasing number, related to the total number of seats to be allocated, and getting a very long list of resulting quotients. From all the calculated quotients, the biggest ones are taken and one seat is assigned for the party the quotient corresponds to.
As you can see by looking at the results page generated by my code, seat allocation does vary quite a bit compared to the official results. They show how the two biggest parties benefit from having many voting districts while other parties, specially UP (Unidad Popular), suffer major seat losses (I mean apart from having lost a lot of votes compared to the previous election). I was tempted to inline some results in the article here but the tables are too big. Simply observe how the election winner, Partido Popular, got 123 seats and would have gotten closer to 100 if using a single district. The two trailing parties, Partido Socialista and Podemos, got 90 and 69 seats respectively. In a single voting district, they would be much closer to one another, with around 80 and 75 seats respectively.
The results also show D’Hondt and Sainte-Laguë to be very similar, so choosing other highest quotient method isn’t going to alter the results significantly. Comparing the real votes proportion to seats proportion shows the modified Sainte-Laguë method, at least in this case, would arguably result in more disproportion compared to the normal version.
Another factor to be taken into account is that election law in Spain mandates any party to get a minimum of 3% of the valid votes in a given district to be able to opt to seats from that district. Valid votes are votes to any party plus blank votes. Some people in Spain are confused about how blank votes are taken into account and how they are different from invalid votes. The answer is not that they are added to the winner party in each district, as some people believe. They are not used for anything and seats are not left unallocated for them. That’s the specific purpose of the Escaños en Blanco party (roughly translated to Blank Seats). But they do make it more unlikely for a small party to win a seat, because they raise the bar to get that minimum 3%. In a single voting district, it wouldn’t make sense to have the 3% barrier. Otherwise, only 5 parties would be represented while the others, totalling a nontrivial quantity of 30 seats using the D’Hondt method, would get none.
Now, if we want to have a single voting district in Spain that would require changing the Spanish constitution, which is not legally easy. The constitution does not mention the exact proportional method used to allocate seats. That’s part of the election law, not the constitution. However, it does mention explicitly the voting districts correspond to provinces as it is now. Others argue having the current voting districts prevents politicians from just focusing on the 15 or 20 biggest Spanish cities, which hold the majority of the population. In theory, voting districts allow representation from minorities in small provinces. But, in practice, it shows people in small provinces choose representatives from the major parties, and smaller and raising parties are in practice losing seats right now. In other words, no system is perfect.