election

We’ve compared our predictions of the 2019 ๐Ÿ‡จ๐Ÿ‡ฆ election to the actual votes. Overall, we were within 5% with no obvious geographical biases, though we did slightly overestimate support for the NDP at the expense of the Liberals. I think weโ€™re on to something good here!

With an agent based model you can explore interesting scenarios. Our latest post models the ๐Ÿ‡จ๐Ÿ‡ฆ election with another Liberal scandal, new Conservatives climate change policy, or proportional representation. The results are not obvious, showing benefits of non-linear modelling.

Spatial analysis of votes in Toronto

This is a โ€œbehind the scenesโ€ elaboration of the geospatial analysis in our recent post on evaluating our predictions for the 2018 mayoral election in Toronto. This was my first, serious use of the new sf package for geospatial analysis. I found the package much easier to use than some of my previous workflows for this sort of analysis, especially given its integration with the tidyverse. We start by downloading the shapefile for voting locations from the City of Torontoโ€™s Open Data portal and reading it with the read_sf function.

Continue reading โ†’

Our predictions for the recent election in Toronto held up well. We were within 6%, on average, with a slight bias towards overestimating Keesmaat’s support. Now we’ll add more demographic richness to our agents and reduce the geographical distribution of errors www.psephoanalytics.ca/2018/11/r…

We’ve completely retooled our approach to predicting elections to use an agent-based model. Looking forward to comparing our predictions to the actual results tonight for the Toronto election!

Fixing a hack finds a better solution

In my Elections Ontario official results post, I had to use an ugly hack to match Electoral District names and numbers by extracting data from a drop down list on the Find My Electoral District website. Although it was mildly clever, like any hack, I shouldnโ€™t have relied on this one for long, as proven by Elections Ontario shutting down the website. So, a more robust solution was required, which led to using one of Election Ontarioโ€™s shapefiles.

Continue reading โ†’

Elections Ontario official results

In preparing for some PsephoAnalytics work on the upcoming provincial election, Iโ€™ve been wrangling the Elections Ontario data. As provided, the data is really difficult to work with and weโ€™ll walk through some steps to tidy these data for later analysis. Hereโ€™s what the source data looks like: Screenshot of raw Elections Ontario data A few problems with this: The data is scattered across a hundred different Excel files Candidates are in columns with their last name as the header Last names are not unique across all Electoral Districts, so canโ€™t be used as a unique identifier Electoral District names are in a row, followed by a separate row for each poll within the district The party affiliation for each candidate isnโ€™t included in the data So, we have a fair bit of work to do to get to something more useful.

Continue reading โ†’

Election 2008

Like most Canadians, Iโ€™ll be at the polls today for the 2008 Federal Election. In the past several elections, Iโ€™ve cast my vote for the party with the best climate change plan. The consensus among economists is that any credible plan must set a price on carbon emissions. My personal preference is for a predictable and transparent price to influence consumer spending, so I favour a carbon tax over a cap-and-trade.

Continue reading โ†’