Sunday, March 25, 2012

Unite the Left: Recalculating the 41st Parliament of Canada

(Picture retrieved from The Disaffected Lib. Copyright unknown.)



If you are a Liberal or New Democrat, you will probably cry. If you are a Conservative or Bloc Quebecois, this is your worst nightmare. This is the result of our last general election:


          party           | seats 
--------------------------+-------
 Green Party              |     1
 Bloc Québécois           |     4
 Liberal                  |    34
 NDP-New Democratic Party |   103
 Conservative             |   166

Now here are the hypothetical results if the NDP and Liberal Party had combined as Unite the Left in response to Unite the Right:

    party     | seats 
--------------+-------
 Green Party  |     1
 Conservative |   122
 Liberal/NDP  |   185

My results are based on raw poll data from Elections Canada. I have made the assumption that all votes would stay with their respective parties. I realize this is unlikely, however, this is purely a what-if exercise intended to get parties thinking. The status quo promises one thing: Unite the Right will continue to be a major factor in Canadian politics. Unless the left deals with party pride, the left can count on getting nothing. If they can overcome this divisiveness, everyone has the chance of having at least some of their favoured agendas put into action.

If you are curious how I produced these results, keep reading for more detailed results and methodologies.


Here are the riding results for a combined NDP/Liberal campaign.

Generating the results was mostly straight forward. The raw database produced by Elections Canada needed only cosmetic changes so that I could use it with my database server software. Many electoral district name fields were surrounded by multiple pairs of double quotation marks. These were corrected with a single search and replace command within a text editor. Party names were occasionally listed in French in the English name field. These were corrected easily with a single operation on all records for each incorrect party name. No single record from the original Elections Canada database was edited by hand.

At this point, the entire database was imported into a PostgreSQL database. Here, you can see the database schema.

In the first step, I imported the corrected Elections Canada database into the table 'elecres'. This is a relatively large database, so to reduce my time for developing the more complex queries, I used two queries, 'combined' and 'separate' to generate intermediate results. These queries produce the hypothetical and actual results, respectively. In this way, I could check my methods using the actual outcome of the election. The queries can be found as views with the same names, in the schema. The intermediate results were then copied into the tables, 'combined_tbl' and 'separate_tbl'. The output of the riding results, mentioned earlier, is a direct export of 'combined_tbl' as HTML.

The overall results were generated with the queries represented by the 'combinedtotal' and 'separatetotal' views as shown in the schema.




No comments:

Post a Comment