Demystifying the Gallagher Index

by | January 20, 2017

I’ve written before about how important electoral reform is to secularists, humanists, atheists, and freethinkers, and since then it has become a major political issue. The most recent debacle had former Democratic Institutions Minister Maryam Monsef trying to dazzle Canadians with math, and make an important electoral metric – the Gallagher Index – look dangerous and scary. Not only is it neither of those things, it’s actually trivially simple and easy to understand. I will demonstrate that, by deriving the equation from scratch, right here.

[Photo of Maryam Monsef holding up a sheet of paper with the equation for the Gallagher Index of election proportionality on it (which is just a simple least squares regression).]

Maryam Monsef thinks you’re too stupid to understand this equation.

Much of what Monsef said in her original comments about the electoral reform committee was, not to mince words, an outright lie, made up of the usual distortions and misrepresentations politicians use while staying vague enough to be difficult to pin down. She did eventually apologize, sorta-kinda, but I don’t think anyone really tackled the substance of her lies head on.

The heart of the issue lies in the very first recommendation made by the Special Committee on Electoral Reform (ERRE) in their third report to the House of Commons on : Strengthening Democracy in Canada: Principles, process and public engagement for electoral reform:

The Committee recommends that the Government should, as it develops a new electoral system, use the Gallagher index in order to minimize the level of distortion between the popular will of the electorate and the resultant seat allocations in Parliament. The government should seek to design a system that achieves a Gallagher score of 5 or less.

Monsef capitalized on this wording to push the misconception that that Gallagher Index scores electoral systems (along with the absurd notion that the new electoral system would be chosen solely based on Gallagher Index score). But that’s not what the index does. The index scores elections… not electoral systems. The way the Gallagher Index helps in measuring systems is by averaging the results of elections under those systems.

If you’re good at math, much of what follows might seem a little tedious, but I wanted to make sure that even the non-mathematically-gifted among us could follow.

So how would you quantify whether an election was fair or not? There are a number of things you might want to watch out for:

  • eligibility to vote should be determined through fair and rational means, so that as many people as possible can vote;
  • everyone who is eligible to vote should be able to vote;
  • every vote made should be counted;
  • and so on.

All those things are important, but what we’re going to focus on is the connection between the votes and the results. In a fair election, the results should be – as much as reasonably possible – reflective of the votes. If there is no real relationship between the votes and the results, the election is obviously not fair in any meaningful sense.

Qualitatively, we can look at the results of our last election, and tell that something smells. The Liberals got just under 40% of the vote, but over 54% of the seats in Parliament, and thus, effective absolute power in Canada even though over 60% of Canadians voted against them. But how do we quantify that smell?

Well, it’s already sort of obvious from the observation above. We can look at the difference between the vote percentage, and the percentage of seats won. The percentage of seats a party has is essentially the percentage of power they have (with the caveat that once you’ve exceeded 50%, you have 100% of the power), so this metric is basically measuring the difference between the vote received and the power achieved.

So there’s our first step. For each party, we will calculate the percentage of votes they received, which is simply the sum of all votes all candidates for that party received. We’ll call that Vi. We’ll also calculate the percentage of seats they received, and call that Si.

Here are the results for our last federal election:

Party Votes Seats Vi Si
Liberal 6,943,276 184 39.47% 54.44%
Conservative 5,613,614 99 31.91% 29.29%
New Democratic 3,470,350 44 19.73% 13.02%
Bloc Québécois 821,144 10 4.67% 2.96%
Green 602,944 1 3.43% 0.30%
(Independent) 49,616 0 0.28% 0.00%
Libertarian 36,772 0 0.21% 0.00%
Christian Heritage 15,232 0 0.09% 0.00%
Marxist–Leninist 8,838 0 0.05% 0.00%
Strength in Democracy 8,274 0 0.05% 0.00%
Rhinoceros 7,263 0 0.04% 0.00%
Progressive Canadian 4,476 0 0.03% 0.00%
Communist 4,393 0 0.02% 0.00%
Animal Alliance 1,699 0 0.01% 0.00%
Marijuana 1,557 0 0.01% 0.00%
Democratic Advancement 1,187 0 0.01% 0.00%
Pirate 908 0 0.01% 0.00%
Canadian Action 401 0 0.00% 0.00%
Canada Party 271 0 0.00% 0.00%
Seniors 157 0 0.00% 0.00%
Alliance of the North 136 0 0.00% 0.00%
Bridge 122 0 0.00% 0.00%
PACT 91 0 0.00% 0.00%
United 57 0 0.00% 0.00%
Total 17,592,778 338

And now to quantify the distortion, we’ll simply find the difference between the percentage of votes and the percentage of seats each party got. This is just a simple subtraction, because both numbers are already percentages:

V_i minus S_i.

And here are the results of that:

Party ViSi
Liberal −0.1497
Conservative 0.0262
New Democratic 0.0671
Bloc Québécois 0.0171
Green 0.0313
(Independent) 0.0028
Libertarian 0.0021
Christian Heritage 0.0009
Marxist–Leninist 0.0005
Strength in Democracy 0.0005
Rhinoceros 0.0004
Progressive Canadian 0.0003
Communist 0.0002
Animal Alliance 0.0001
Marijuana 0.0001
Democratic Advancement 0.0001
Pirate 0.0001
Canadian Action 0.0000
Canada Party 0.0000
Seniors 0.0000
Alliance of the North 0.0000
Bridge 0.0000
PACT 0.0000
United 0.0000

Already we have some interesting information. The Liberals are the only party with a negative value, which means they are the only party that should have less seats. Or in other words, they got more seats than they should have, according to the actual votes they received. Every other party was cheated out of seats. The NDP was cheated worst of all, followed by the Greens, then the Conservatives.

But how do we boil all these numbers down to a single metric?

The first instinct might be to just add them all up, but it turns out that’s not a great idea. To see why, consider the following two situations:

  1. an election with only two parties, where one party got all the votes… and all of the seats; and
  2. an election with only two parties, where one party got all the votes… but none of the seats.

The first case is a perfectly fair election. Remember, we’re assuming that there were no shenanigans with voter suppression or anything like that, so the party fairly received all the votes in a legitimate election. Thus, they deserve all the seats. The second case is perfectly unfair.

In the first case, the first party got a Vi of 100% and a Si of 100%. Thus their ViSi is 0. The second party got a Vi of 0% and a Si of 0%; their ViSi is 0. If we add those up, we get 0.

So far so good: There is no unfairness in that election, so a score of 0 is correct.

But now consider the second case. The first party got a Vi of 100%… but a Si of 0%. Thus their ViSi is 100%. The second party got a Vi of 0% …but a Si of 100%; their ViSi is −100%. If we add 100% and −100%, we get 0.

That’s bad: This is the most unfair election we can possibly conceive of, and it gets a score of 0.

You’ve probably realized that the problem is the negative numbers. When they get added to the positive numbers, they cancel out. In fact, if you include all parties, all seats, and all votes in an election, the sum of all ViSi values will always cancel out to zero.

So how do we handle this? Well, the simplest way to do that is to simply take the absolute value of each ViSi value. In plain English, we just drop any negative signs.

Of course, one can’t just “drop the negative signs” in math. But there is an easy way to eliminate negatives: squaring. 22 is 4 … and −22 is also 4. In fact, for any number N, N2 and −N2 are equal. Thus squaring is an easy way to eliminate negative values, and make everything positive.

So what we want to do is sum up all the ViSi values… squared. “∑” is math for “sum up”, so the mathematical expression of what we want to do is:

Sum of all open bracket V_i minus S_i close bracket squared.

Or in plain English: Sum up the squares of all ViSi values.

This gives us a single number that measures the unfairness in an election. Applied to the 2015 election, we get:

Party (ViSi)2
Liberal 0.0224
Conservative 0.0007
New Democratic 0.0045
Bloc Québécois 0.0003
Green 0.0010
(Independent) 0.0000
Libertarian 0.0000
Christian Heritage 0.0000
Marxist–Leninist 0.0000
Strength in Democracy 0.0000
Rhinoceros 0.0000
Progressive Canadian 0.0000
Communist 0.0000
Animal Alliance 0.0000
Marijuana 0.0000
Democratic Advancement 0.0000
Pirate 0.0000
Canadian Action 0.0000
Canada Party 0.0000
Seniors 0.0000
Alliance of the North 0.0000
Bridge 0.0000
PACT 0.0000
United 0.0000
Total 0.0289

We could stop here. We have what we need: a single number that measures the disconnect between voter will and achieved power. But the number we have is… ugly. It’s disconnected from common understanding. 0.0289? It doesn’t seem to mean anything.

There are two things we can do to fix that. The first is to simply take the square root of the number. This is a logical step, because the number we have is the sum of squares… not the sum of actual values. By taking the square root we get back to an actual value – in this case a percentage:

Square root of the sum of all open bracket V_i minus S_i close bracket squared.

Again, this “works”. It gives us a valid number that does actually represent the disproportionality of the election. But it does cause a bit of weirdness.

To see why, let’s go back to our two extreme examples. This time, we won’t add the ViSi values, we’ll add their squares.

In the first case, the first party’s ViSi is 0. 02 is 0. The second party’s ViSi is also 0. If we add everything up, we get 0. If we take the square root of 0, it’s still zero.

This is cool: There is no unfairness in that election, so a score of 0 is correct.

In the second case, the first party’s ViSi is 100%. 100% is 1, and 12 is 1. The second party’s ViSi is −100%. −100% is −1, and −12 is 1. So we add 1 + 1, and get 2. The square root of that is 1.414… or 141.4%.

Okay, the election was completely unfair, so it should have a high score… but 141.4%? That’s a little weird.

Well that brings us to the second thing we can do to make the result more meaningful. You see, the problem is that by using ViSi, we’re taking the difference of two percentages. Each percentage can vary between 0% and 100%, which is sensible. But when we subtract them, while the minimum result is still 0%, the maximum value of the result – in the case where Vi is 100% and Si is −100% – is 200%, or 2.

So if we want to scale this [0% to 200%] range back to a sensible [0% to 100%] range… we just need to divide by 2.

Square root of half the sum of all open bracket V_i minus S_i close bracket squared.

(There’s another way to look at it. The parties that “gained” seats unfairly gained those seats by taking them from parties that “lost” seats unfairly. When we sum everything up, we’re counting those seats twice – once as “gained” seats for one party, and again as “lost” seats for another party. To correct for this double count, we divide by 2.)

(Yet another way to look at it that may appeal to the more statistically inclined. The Gallagher Index is simply a standard least squares regression analysis. There are only 2 degrees of statistical freedom: one for the number of votes, one for the number of seats.)

If you want to confirm it works, try it with the extreme case again. The first party’s ViSi is 100%. 100% is 1, and 12 is 1. The second party’s ViSi is −100%. −100% is −1, and −12 is 1. So we add 1 + 1, and get 2. Now we divide by 2, and get 1.The square root of 1 is 1… or 100%. So the absolute worst score is 100%. (And the absolute best score is still 0%, which you can confirm for yourself if you don’t believe it.)

Now our metric makes sense. We can take any election, and for each party find the number of votes the party received and the number of seats won, and use that to calculate this single number that scores how unfair the election is on a percentage scale. A perfectly fair election will score 0%. A perfectly unfair election will score 100%.

Wait, doesn’t that equation look familiar?

Why, yes. That’s the Gallagher Index. Obviously Michael Gallagher wasn’t so pompous as to name it the Gallagher Index himself; he calls it the “least squares” index, because that’s what it is, mathematically. So if that’s what we call it, using “LSq” as a shorthand for “least squares”, we get:

LSq equals the square root of half the sum of all open bracket V_i minus S_i close bracket squared.

Which, accounting for font differences, is identical to what Maryam Monsef is holding up in the picture:

[Photo of Maryam Monsef holding up a sheet of paper with the equation for the Gallagher Index of election proportionality on it (which is just a simple least squares regression).]

That’s all there is to it.

Is this really incomprehensible? Maybe there’s something wrong with Trent University’s science program.

Let’s actually apply it to the last election. From the table above, we get that the sum of all the squares of ViSi values is 0.0289. Divide that by 2 to get 0.0144. Take the square root to get 0.12, which is 12%. The actual Gallagher Index for that election is: 12.02%, which is just a matter of doing our calculations with more significant digits.

So now you’re all smarter than a Member of Parliament.

But where do we go from here?

Well, let’s put 12% in perspective. When I crunched the numbers two years ago, the global average was ~9%. So 12% is bad. And this is not a freak score that is unrepresentative of Canadian democracy in general. In 2014 I calculated the average score for all Canadian elections since 1990 to be 12.20%.

The Electoral Reform Committee recommended that we should aim for a system that averages Gallagher Index scores of 5 or less. In my opinion, 5 is still a little high; we should aim for 3 or lower. However, the Committee wasn’t talking about the basic Gallagher Index… they were talking about a special index they calculated, which they called the Composite Gallagher Index. This is essentially the basic Gallagher Index calculated province-by-province, rather than for Canada as a whole. The Gallagher Index for each province and territory is calculated, then weighted by the number of seats in that province or territory, then averaged out. The Composite Gallagher Index is a much tougher metric. The Gallagher Index for the 2015 election was 12.0%, but the Composite Gallagher Index was 17.2%.

But all of this still doesn’t help us all that much if we don’t have different electoral systems – and election results within those systems – to compare. Obviously we can’t re-run election using different electoral systems. But we also we can’t practically run a single election under multiple systems, because the ballots are different for different systems, and voters will behave differently depending on the system. The best we can do is use existing election data from past elections, and make some informed estimates for the missing information about voter behaviour under different systems.

Happily, someone’s already done that for us.

Byron Weber Becker is a computer science professor at the University of Waterloo, who also contributed to the Electoral Reform Committee report. Becker has created, which displays the results of running simulations on 61 different electoral systems, using the data from the 2015 federal election (and polling data to extrapolate for any data that was missing). (If you’re curious to run the simulations yourself, or to analyze the procedures or the data, Becker has made everything available on his GitHub account. The code’s in Scala.)

Our current system fails miserably, natch, but Alternate Vote (AV) – a favourite of the Liberal Party (for reasons the data makes obvious) – is even worse. Mixed Member Proportional (MMP) systems (which I was recommending in 2014) fare better. Single Transferable Vote (STV) systems do a little better.

But by far the best performers were the Swedish-inspired, made-in-Canada, Rural–Urban Proportional (RUP) systems. The biggest challenge in Canada is the vast range of riding sizes. Our ridings range in size from ~6 km2 to 2.1 million km2, and even with that wide range of riding sizes, we still don’t have an equal distribution of people in each riding. Trying to shoehorn this diverse set of ridings into a single system is challenging. If you try to use MMP, every riding retains a single MP to represent them, but you need a large number of “top-up” MPs to create proportionality. If you try to use STV, you end up with fucking enormous ridings, and MPs who are totally disconnected from their constituents.

RUP is a classic Canadian compromise system that gives you the best of all worlds. In sparsely-populated rural areas, nothing really changes – you still have single-member ridings. But in densely-populated urban areas, you combine several ridings into larger multi-member ridings, as in STV. And on top of all that, you add a layer of “top-up” MPs, as in MMP. The result is exceptionally proportional elections, without sacrificing local representation. In their default case, they get a Gallagher Index of 1.9%, and a Composite Gallagher Index of 3.4%. Not bad at all.

And there are still things that can be tweaked with RUP, such as the size of the riding and how many “top-up” MPs there are. It is possible to improve the results even further.

So electoral reform is still in progress, but despite the pretensions of Monsef, there is progress; significant progress, in fact. Most recently, Monsef was shuffled out of the Minister of Democratic Institutions post, and replaced with Karina Gould. Gould is a rookie minister – one of the youngest ever appointed to a cabinet post – but she’s spoken out in favour of electoral reform before. And pressure for real reform is greater now than it has ever been before. That’s good news for us, because there is no obvious path to better representation in government for secularists, humanists, atheists, or freethinkers under our current electoral system. A more proportional electoral system is the easiest way to get more influence for SHAFT concerns in our government. And that’s aside from the other ethical and practical reasons to want more proportional representation.

It doesn’t really matter all that much to us which system we ultimately go with, so long as it’s a system that promises better Gallagher Index scores (or Composite Gallagher Index scores). Now that you understand what the Gallagher Index is about, you can keep an informed eye on the happenings in the Electoral Reform Committee.

4 thoughts on “Demystifying the Gallagher Index

  1. Jeff Jewell

    Excellent de-mystification of intentional obfuscation.

    You must be disgusted by the PM’s unilateral betrayal of his promise to deliver electoral reform.

    You may be interested in my Open Letters to the PM and to all MPs:


    “”All Parliamentarians have the Duty to Defend and Improve Canada’s Democracy!”

    Please click on the following to read [ ] Open Letter #1 to All MPs: “All Parliamentarians have the Duty to Defend and Improve Canada’s Democracy”. It calls on Parliament to rise to the challenge of defending its own integrity, and to fulfill its responsibility to serve as the People’s representatives, and to assert itself as the ultimate authority of Democratic power, by standing up against the undemocratic infringement of Parliament’s power under its increasing domination by Prime Ministers, the PMOs and party bosses.

    The abuse of power by PMs & PMOs and their bullying of Parliamentarians would not be possible if Parliament asserted its authority and operated democratically. This is a deeper and more urgent problem than electoral reform, although it was the Prime Minister’s unilateral and quasi-dictatorial decision to kill electoral reform that showed his contempt for Parliament and for Democracy itself.

    For a better understanding of this, please also read [ ] Open Letter #4 to the PM: “Mr. Prime Minister, your decision to abandon electoral reform is unacceptable”, because it lacks democratic legitimacy.

    These two Open Letters are intended to be respectful but firm, calling for the reconsideration and reversal of the PM’s anti-democratic decision that was so undemocratically rendered.

    We urge all MPs to read both of these Open Letters, and to discuss these issues within their own caucus, and also with fellow MPs from all parties, including Government back-benchers. We hope that Opposition party leaders will discuss this amongst themselves, and with the Prime Minister.

    It’s important for Parliament to start seeing itself as the supreme institution of democratic power and authority, and to act as such. It’s time for Parliament to ‘take charge’ and to explain the new operating rules to the PM. Parliament should demand the PM’s respect of its higher authority as the elected representatives of the People. And it’s also time for all MPs, especially Government ‘back-benchers’, to begin serving as true representatives of the People rather than their Leader’s unquestioning ‘rubber stamps’.


    Jeff & Diana Jewell,
    Mission BC

    1. Jeff Jewell

      Further adding to the travesty of the misuse of the ‘Gallagher Index” to mystify the public, and to enable the Minister Monsef to ridicule the work of the ERRE Committee, as prelude to the PM’s eventual dictatorial decision to kill electoral reform [the desired goal of the PMO from the beginning, the Gallagher Index [which Gallagher himself had not even mentioned in his presentation to the Committee] by its design is a shockingly poor statistic coming from the supposed expert.

      Specifically, in the Wikipedia item on the Gallagher Index, it accurately states that “The index weighs the deviations by their own value”. Now that’s like reading the fine print on the label to understand what a product is made of, but it essentially means that the calculations from each component [i.e. in this case the percentages of Votes and Seats for each party] are each factored equally [i.e. unweighted] into the composite Gallagher Index.

      That means that the percent distortion for a small party is given equal weight in the statistic as the percentage of distortion for a major party with more than ten times as many votes and 177 times as many seats!?

      Correcting this fundamental flaw [by weighting the distortions of each party by their percentage of votes] produces an Index value of 17.09% rather than the Gallaher value of 12.02% for Canada’s 2015 election under FPTP.

      Byron Weber Becker also refined his calculation by factoring in the regional differences, a very important correction that’s entirely overlooked by the Gallagher Index.

      Sadly, what the ERRE Committee presented to the Minister and what she mocked for its complexity, ought to have been rejected as fundamentally deficient statistical analysis.

  2. Lev Tarasov

    Byron Weber Becker with others has come up with a better “performer” than Rural Urban. It’s a made in Canada system that blends STV with guaranteed local representation and around which we are building a national campaign:
    This systems also meets all the conditions set out for the ERRE, does not require extra MPs nor changes in electoral boundaries. It was also designed with the involvement of a local Liberal MP.

  3. Jeff Jewell

    I also salute Byron Weber Becker as an outstanding analyst and advocate of Electoral Reform.

    FYI, Byron Weber Becker also developed a fundamentally different voting system called “PR-By-Proxy”. With no prior knowledge of this, I independently developed “PPR123–Perfect Proportional Representation”, which I had the honour to present to the ERRE Committee in Vancouver on Sept.28, 2016. [ref.]

    But the one you should find much more interesting is “RPV–The Reassignable Proxy Vote” [ ].

    RPV is the only voting system that would empower Voters to make Governments more accountable–by being able to reassign their vote to another party between elections. RPV was in fact inspired as a response to the PM’s betrayal of his promise to implement Electoral Reform.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.