# How many political parties rule Canada? Fun with statistics

Canada has several political parties with elected member of parliament: the Liberals, the Conservatives, the Bloc Québecois, de NDP and the Green. But do they behave as distinct political parties when voting, or are they somehow aligned?

Voting data for the member of parliament in Canada is easily accessible as JSON or XML. Thus I wrote a little Python script to compute, for each vote, what percentage of each party voted yea. I use the latest 394 votes. It turns out that, overwhelming, the percentage is either 0% or 100%. So individual members of parliament are not relevant, only caucuses matter.

We can first examine Pearson’s correlation between how the different parties vote:

 Conserv. Liberal NDP Bloc Québécois Green Party Conserv. 1 -0.5 -0.5 -0.1 -0.2 Liberal 1 0.8 0.4 0.5 NDP 1 0.4 0.6 Bloc Québécois 1 0.5 Green Party 1

We observe that there is excellent correlation between the ruling party (Liberal) and the NDP, and to a lesser extend to the Bloc Québécois (0.4) and Green (0.5). The Conservatives are anti-correlated with everyone else, although they less anti-correlated with the Bloc Québécois and the Green than with other parties (Liberal and NDP).

Though there are dozens of votes, you can capture 85% of the variance by using only two dimensions with a principal component analysis. In effect, you create two fictional voting events (that are weighted combinations of the votes) that represent most accurately the stances of the various parties.

The result demonstrates that four of the Canadian political parties are clustered, meaning that they vote similarly, while one party (the Conservatives) is clearly distinct in its voting patterns.

My source code is available. It is made of two simple Python files that you can run yourself. I encourage you to run your own analysis. My work can be extended to include more data.

Daniel Lemire, "How many political parties rule Canada? Fun with statistics," in Daniel Lemire's blog, March 8, 2024.