We’ve been using our agent-based model to analyze the upcoming Federal election here in Canada. Now that we’ve generated our predictions, we’re going to explore how best to explain the outcomes. πŸ—³πŸ‡¨πŸ‡¦

My “Best Dad” mug has been recalled. Apparently it may break when filled with hot liquid, which is exactly its function. Hopefully this isn’t some metaphor for my parenting

Using Agent-based modeling to explain polls

Modeling to explain, not forecast

The goal of PsephoAnalytics is to model voting behaviour in order to accurately explain political campaigns. That is, we are not looking to forecast ongoing campaigns – there are plenty of good poll aggregators online that provide such estimation. But if we can quantitatively explain why an ongoing campaign is producing the polls that it is, then we have something unique.

That is why agent-based modeling is so useful to us. Our model – as a proof of concept – can replicate the behaviour of millions of individual voters in Toronto in a parameterized way. Once we match their voting patterns to those suggested by the polls (specifically those from CalculatedPolitics, which provides riding-level estimates), we can compare the various parameters that make up our agents behaviour and say something about them.

We can also, therefore, turn those various behavioural dials and see what happens. For example, what if a party changed its positions on a major policy issue, or if a party leader became more likeable? That allows us to estimate the outcomes of such hypothetical changes without having to invest in conducting a poll.

Investigating the 2019 Federal Election

As in previous elections, we only consider Toronto voters, and specifically (this time) how they are behaving with respect to the 2019 federal election. We have matched the likely voting outcomes of over 2 million individual voters with riding-level estimates of support for four parties: Liberals, Conservatives, NDP, and Greens. This also means that we can estimate the response of voters to individual candidates, not just the parties themselves.

First, let’s start with the basics – here are the likely voter outcomes by ridings for each party, as estimated by CalculatedPolitics on October 16.

As these maps show, the Liberals are expected to win 23 of Toronto’s 25 ridings. The two exceptions are Parkdale-High Park and Toronto-Danforth, which are leaning NDP. Four ridings, namely Eglinton-Lawrence, Etobicoke Centre, Willowdale, and York Centre, see the Liberals slightly edging out the Conservatives. Another four ridings, namely Beaches-East York, Davenport, University-Rosedale, and York South-Weston, see the Liberals slightly edging out the NDP. The Greens do no better than 15% (Toronto Danforth), average about 9% across the city, and are highly correlated with support for the NDP.

What is driving these results? First, a reminder about some of the parameters we employ in our model. All β€œagents” (e.g., voters, candidates) take policy positions. For voters, these are estimated using numerous historical elections to derive β€œnatural” positions. For candidates, we assign values based on campaign commitments (e.g., from CBC’s coverage, though we could also simply use a VoteCompass). Some voters can also care about policy more than others, meaning they care less about non-policy factors (we use the term β€œlikeability” to capture all these non-policy factors). As such, candidates also have a β€œlikeability” score. Voters also have an β€œengagement” score that indicates how likely they are to pay attention to the campaign and, more importantly, vote at all. Finally, voters can see polls and determine how likely it is that certain parties will win in their riding. Each voter then determine, for each party a) how closely is their platform aligned with the voter’s issue preferences; b) how much do they β€œlike” the candidate (for non-policy reasons); and c) how likely is it the candidate can win in their riding. That information is used by the voter to score each candidate, and then vote for the candidate with the highest score, if the voter chooses to vote at all. (There are other parameters used, but these few provide much of the differentiation we see.)

Based on this, there are a couple of key take-aways from the 2019 federal election:

In our next post, we’ll look at some scenarios where we change some of these parameters (or perhaps more drastic things).

Task management with MindNode and Agenda

For several years now, I’ve been a very happy Things user for all of my task management. However, recent reflections on the nature of my work have led to some changes. My role now mostly entails tracking a portfolio of projects and making sure that my team has the right resources and clarity of purpose required to deliver them. This means that I’m much less involved in daily project management and have a much shorter task list than in the past. Plus, the vast majority of my time in the office is spent in meetings to coordinate with other teams and identify new projects.

As a result, in order to optimize my systems, I’ve switched to using a combination of MindNode and Agenda for my task managment.

MindNode is an excellent app for mind mapping. I’ve created a mind map that contains all of my work-related projects across my areas of focus. I find this perspective on my projects really helpful when conducting a weekly review, especially since it gives me a quick sense of how well my projects are balanced across areas. As an example, the screenshot below of my mind map makes it very clear that I’m currently very active with Process Improvement, while not at all engaged in Assurance. I know that this is okay for now, but certainly want to keep an eye on this imbalance over time. I also find the visual presentation really helpful for seeing connections across projects.

MindNode has many great features that make creating and maintaining mind maps really easy. They look good too, which helps when you spend lots of time looking at them.

Agenda is a time-based note taking app. MacStories has done a thorough series of reviews, so I won’t describe the app in any detail here. There is a bit of a learning curve to get used to the idea of a time-based note, though it fits in really well to my meeting-dominated days and I’ve really enjoyed using it.

One point to make about both apps is that they are integrated with the new iOS Reminders system. The new Reminders is dramatically better than the old one and I’ve found it really powerful to have other apps leverage Reminders as a shared task database. I’ve also found it to be more than sufficient for the residual tasks that I need to track that aren’t in MindNode or Agenda.

I implemented this new approach a month ago and have stuck with it. This is at least three weeks longer than any previous attempt to move away from Things. So, the experiment has been a success. If my circumstances change, I’ll happily return to Things. For now, this new approach has worked out very well.

Stranger Things season 3 is fun with 80s nostalgia and familiar characters. Not as delightfully creepy as season 1 though.

Nick Cave’s song Hollywood is quite potent, particularly given the recent death of his teenage son 😒🎧 Ghosteen cover art

RStats on iPad

Among the many good new features in iPadOS, β€œDesktop Safari” has proven to be surprisingly helpful for my analytical workflows.

RStudio Cloud is a great service that provides a feature-complete version of RStudio in a web browser. In previous versions of Safari on iPad, RStudio Cloud was close to unusable, since the keyboard shortcuts didn’t work and they’re essential for using RStudio. In iPadOS, all of the shortcuts work as expected and RStudio Cloud is completely functional.

Although most of my analytical work will still be on my desktop, having RStudio on my iPad adds a very convenient option. RStudio Cloud also allows you to setup a project with an environment that persists across any device. So, now I can do most of my work at home, then fix a few issues at work, and refine at a coffee shop. Three different devices all using the exact same RStudio project.

A screenshot of RStudio Cloud on the iPad

One complexity with an RStudio Cloud setup is GitHub access. The usual approach of putting your git credentials in an .REnviron file (or equivalent) is a bad idea on a web service like RStudio Cloud. So, you need to type your git credentials into the console. To avoid having to do this very frequently, follow this advice and type this into the console:

git config --global credential.helper 'cache --timeout 3600'

Thanks to Run the Jewels 3 for providing a much-needed boost on today’s run πŸƒβ€β™‚οΈ

Fall has arrived

Thanksgiving weekend begins with the traditional excessively long and slow drive on the 401

With Category Theory, Mathematics Escapes From Equality - Quanta Magazine

Ultimately, you will build an infinite tower of equivalences between equivalences. By considering the entire edifice, you generate a full perspective on whatever objects you’ve chosen to represent as points on that sphere.

Thanks to a recommendation from @verybadwizards I read and very much enjoyed Ted Chiang’s short story “Anxiety is the Dizziness of Freedom”. Plenty of deep implications for free will and morality in a fascinating story.

After 20 years and four cars, the Darwin Fish on the back of our car has disappeared. Hopefully it wasn’t ripped off by a zealot!

Replacements are surprisingly expensive (~$50). But the car looks wrong without one.

An unexpected and welcome surprise in the latest Byword update #rstats

I enjoyed The Dark Forest by Cixin Liu. Very inventive, though definitely some grim parts, as you might expect for the second book in a trilogy. The dialogue can be a bit clunky, so the emphasis is on the science. πŸ“š

As Canada’s federal election campaign gets increasingly ridiculous, I’d like the political parties to know that I’ll vote for whoever has the most credible and ambitious climate change plan. This includes a carbon price, otherwise it isn’t credible πŸ‡¨πŸ‡¦ πŸ—³

Two great Mindscape episodes in a row about climate change overcast.fm/+S_7kXRI8…

I enjoyed Borderline by Mishell Baker. A good mix of fantasy and realism with compelling characters πŸ“š

All Armed on Nils Frahms’ Encores 3 EP revived my (barely) dormant obsession with his music. His work rewards focused and patient listening. Hard to do these days, but worth the effort music.apple.com/ca/album/…

Our family data plan was close to the limit, so I called Rogers to temporarily add some data. They ended up offering unlimited data for $15 less per month! A nice surprise and good reminder to call every year or so to check on better deals.