This month on Mean, Median, and Moose, we’ll look at the Ontario election in three different ways: fundraising, districts, and trolls on social media.
Political financial contributions
Elections Ontario collects and reports on all contributions to political parties and campaigns in Ontario. You can see the data at this link. We decided to take a look at the political contributions over the last few years to see if any patterns emerged.
In 2021 until May 2022, the Progressive Conservatives managed to earn the most in political contributions, followed far behind by the NDP and then the Ontario Liberals.
It’s also interesting to note that the Ontario Greens punch above their weight compared to the number of seats they earn in the elections and their vote share.
Now, this is the total value of contributions, but not the number of contributors or contribution events. When looked at in that way, the NDP has far more support than the other parties. Of course, these contributions are by and large a lot smaller than the PC contributions.

We’ve also placed some heat maps below to help show what the fundraising looks like over time. It appears that the NDP have very successfully end-of-year fundraising in terms of reaching contributors compared to their peers (although all parties appear to get a end-of-year bump). Also, the PCs had an incredible fundraising month in March 2022 heading into the election.


Ontario Polling Divisions
In 2018, Elections Ontario increased the size of polling divisions within ridings. There may be administrative benefits to the new, larger, polling divisions, but it makes data analysis of past election results far less granular.
This has an impact on the development of election strategy. Two of the key pieces of information that strategists use to plan the canvass and other campaign activities are voter turnout and past results for the party. Coalescing hundreds of small polls into forty or fifty larger ones makes this a less-viable approach, as neighbourhoods with very different demographics and voting patterns get lumped together into a single entity.
One way to help interpret data is to look at the demographic features of neighbourhoods. Census data from Statistics Canada is very useful for this purpose – census profiles provide an overview of many characteristics of communities at different levels of aggregation. A gold mine of information for campaign strategists, unfortunately census profile data is not available at the level of aggregation of the riding or the poll at federal or provincial levels.
To help address this gap, Doug built a SQL database that aggregates census data given at the Dissemination Area level and provides estimated values per Ontario provincial poll. Users of this tool can identify key demographic information that is important to them and get an estimated per-poll value based on geographic overlap.
Elections Ontario and Statistics Canada do not provide geographic information in a form that is usable in SQL Server, so Doug created a set of CSV files for Ontario Polls and Census Dissemination Areas (”DAs”) containing coordinates in Well-Known Binary (“WKB”) format, imported them into Microsoft SQL Server and built an ETL process to load them and create a concordance table matching up polls to DAs. You can find the code here. Included in the repository is code for a stored procedure that takes a riding name and census demographic measure as arguments and returns poll-by-poll aggregated values for that measure.
Those aggregated values can be used to create maps, either using the spatial data embedded in the SQL database or by exporting query results into a flat file for use with GIS software like QGIS.
For example, here’s a map of Parry Sound-Muskoka Ontario polls coloured based on the percentage of single family dwellings:



How Toxic is the campaign?
A research project out Samara Centre for Democracy uses a “bot” called “SAMbot” to monitor the toxicity of a campaign on social media. The tool was used on the 2021 Federal Election and is currently assessing the Ontario Provincial Election. During the campaign they provide a weekly snapshot and then a post-campaign summary.
The bot scans twitter looking for “toxic tweets” by following over hundreds of party candidates as well official party accounts. The methodology is published academically here.
The goal of tools like this is examine how toxicity and gender on social media impact elections. By building ongoing tracking of who is the target of toxic tweets and the types of message it gives insights into the overall health of democracy and highlights barriers faced by candidates who do run for office. The bot scans hundreds of thousands of tweets looking for signed of toxicity based on 7 criteria listed below.

At this point there are only 2 weeks worth of data (week 1 and week 2), it will be after election day before we see the final levels of “toxicity” but this in progress snapshots allow us to see trends as the campaign progressed.
In week 1 over 133k tweets were analyzed while in week 2 over 146k tweets were reviewed so there is a significant sample of data being viewed. Over those weeks over 19k and 17k tweets were identified as toxic respectively – a slight week to week decline despite the amount of tweets increasing.
Somewhat surprisingly to me Doug Ford and the PC party were the leader in being targeted by the greatest volume of toxic tweets. If you are going by the stereotypical perspective of right wing internet trolls the fact that the premier and his right-of-centre party is being targeted. Interestingly in week 2 of the campaign the Ontario Party tied the PC party in proportion of toxic tweets at 16.5% but this represented 8,000 toxic tweets for the PC party and only 345 for the Ontario party. During week 2, Steve Del Duca made comments on vaccination mandates and COVID-19 being added to the list of required vaccines for kids to attend school, this was accompanied by a spike in toxic tweets.
Individually the major party leaders – Ford, Del Duca and Horvath were are the primary targets of toxicity. Stephen Leece received the 4th most toxic tweets and Lisa MacLeod as high profile cabinet ministers also faced their fair share of toxicity as well. A few liberal candidates from large urban centres were also the target of toxic messages but only totalling a few hundred tweets per week. Derek Sloan leader of the Ontario Party had his account banned along with a few hundred toxic tweets during week two of the campaign.
Once the campaign completes the final report on the overall toxicity of this election will be created so keep an eye out on SAMbot in future elections.