Showing posts with label Edmonton. Show all posts
Showing posts with label Edmonton. Show all posts

Monday, April 22, 2019

Alberta 2019 Election Post-mortem

Well that was fun!

How did I do?

For more than a year now I've been tracking Alberta election polls with the hope of developing a reasonably accurate prediction model. Overall, I'm happy to report that the party I predicted in the lead won in 80 out of 87 races, and my riding qualifiers broke out as follow:

  • "Solid" lead: 65/65 (100%)
  • "Likely" lead: 12/15 (80%)
  • "Lean" lead: 2/5 (40%)
  • "Toss-up" edge: 1/2 (50%)
I think this is a decent proof of concept, small "lean" sample size notwithstanding, and I want to talk a bit about what went right and what went wrong, and how I can improve if I want to keep doing this sort of thing.

First of all, the polls leading up to election day didn't turn out to be too accurate. Take a look at the province and regional splits:







Edmonton was remarkably accurate, Calgary was close, but the rest of the province and the top line results were off significantly. This is possibly a cause for concern, as it could suggest that my model was taking inaccurate data as inputs but then claiming credit for an accurate output, which it wasn't designed to do.

The NDP ended up under-performing relative to their polling numbers, and likely the only reason this didn't mess up too many election prediction models is because they under performed mostly in areas like rural Alberta, where they were predicted to lose anyway. If the polls had been that wrong about the NDP in Edmonton, say, the predictions could have been far worse.

Similarly, my model and others like me likely wouldn't have fared too well if the NDP had overperformed their polling rather than underperformed. The same amount of polling error as actually occurred, applied the other direction, could have had the NDP win the popular vote across the province.

My takeaway from this is that I need to adjust my topline polling tracker. Right now it runs under the implicit assumption that errors in individual polls will cancel each other out. This seemed reasonable given that polls are produced by different companies with different methods. That led to my full Alberta tracker having a low confidence interval for the NDP in particular, though, as several polls in a row provided the same result. If I instead make the assumption that at least part of the polling error is correlated between polls, perhaps due to something beyond their control, then the final result from election night would have still been a surprise, but far less of one. Certainly something I'll take into account next time.

Other Metrics


Overall on a riding-by-riding level, I had an error of 6.4% vote share. That's not superb, but also not far from what my testing beforehand suggested, and was factored into my uncertainty. Comparing my final projection to actual results on election night doesn't look too bad:


If we ignore the Alberta Party and the Liberals, this leads to an overall R-squared value of 0.79, which I consider respectable. It's handy to ignore the low parties because they don't have much of a spread, and will skew the coefficient of determination calculation.

Very fortunately for me, if I input the final actual regional results as though they were a poll result, my model does improve. This is a good hint that my model is behaving decently, especially so since this hasn't been the case with all other forecasters.


With the correct Calgary, Edmonton, and Rural results input as large polls, my model improved to 83/87 seats correctly predicted and an R-squared for party support per seat of 0.91. Very encouraging - too bad the polls weren't more correct!

Finally, I also provided an expected odds of winning each seat for each party. It's one thing to count a prediction as a success if you give it 100% odds of winning and it comes true, but how does one properly score oneself in the case of Calgary-Mountain View, where I gave the Liberals (10.8%), UCP (16.2%) and NDP (73%) different odds of winning, and only one (NDP) did?

In this case I've scored each riding using a Brier score. A score of 0 means a perfect prediction (100% to the winner and 0% predicted for all losers), a score of 1.0 means a perfectly wrong prediction (100% to one of the losers), and because of the math, a score of 0.19 for a complete four-way coin toss (I only predicted the four parties represented in the debate).

Overall, I scored a 0.027, which is considerably better than just guessing. It's hard to get an intuitive sense of what that score really means, but it's mathematically the same as assigning an 83.5% chance of something happening and having it come true. Not a bad prediction, but there's room to be sharpened.

How did I stack up?

So like I said, there were a lot of us predicting the election this time around. I've tried to find as many as I can, and I apologize profoundly if I've missed anyone. I've only included forecasts that had either a vote breakdown per seat or anticipated odds of winning each seat for comparison purposes.

I've reported on three main measures (seat accuracy, R-squared per seat, and prediction Brier score), and I'll present as many of those for each forecaster as I was able to determine. Different forecasters win at different categories, so it's not necessarily a clear picture as to which one of us is the "best", so I'll mostly leave room here for interpretation:



I'm not claiming to be the second best, but it's important to note that being best in one measure doesn't necessarily mean best overall. There are also harder-to-evaluate measures in play here - for instance VisualizedPolitics and TooClosetoCall allow you to input poll values to see reactions for yourself, and both improved when given more accurate data (VisualizedPolitics also got to 83 seats accurately predicted, though still with a low R-squared value).

338Canada probably rightly can claim to have been the strongest this time around, but I given the polling errors we were faced with I think it'll take several more elections to determine if anyone is really getting a significant edge consistently. This isn't the first time we've compared ourselves to each other, and I think it's an important exercise in evaluating our own models and whether there's a need for more.

Monday, October 23, 2017

Edmonton Election 2017

Another election has come and gone, and apart from a handful of new faces the biggest news is all the new stats! Let's take a look:

First of all, turnout was abysmal. A total of 194,826 people voted, resulting in a voter turnout of 31.5%. The best (blue) and worst (red) areas of the city in terms of voter turnout are shown here:




The colouring of the map is a bit funky since the mean and median are rather far apart, but it gives a decent impression of what happened. In general, it looks like neighborhoods around the river valley voted more often than neighborhoods away from it, which is interesting. The massive difference between the high (66.9%) and low (9.3%) turnout is absolutely astounding to me, and might suggest fairly significant challenges with connecting with voters in certain areas (especially if they can't see the river, apparently...).

Voter turnout can also be measured in a few other ways, including attrition along the ballot. For instance, of everyone who voted, 1.5% neglected to vote for a mayoral candidate, and 1.9% neglected to vote for any council candidate. 26.3% of voters picked a Catholic schools ballot vs. 66.6% Public ballots, and even then 6.5% of Catholics and 9.8% of Publics didn't end up voting for a school trustee anyway. Oddly enough, the total number of Catholic + Public voters doesn't equal the total number of voters, so I'm not entirely sure where the remaining 7.1% of voters did for school board...


Lighter colours represent 'under votes', or people who didn't make a pick for that particular round of voting.
Don Iveson was re-elected mayor with a solid victory. His support levels in Edmonton aren't dissimilar from last election, and are shown here (darker colours meaning higher support).






Iveson's support in general seems very solid in the center of the city, and a bit weaker in the north and southeast than the rest of the city. All that being said, his support ranged from 59.5-85.9% so he has a strong mandate from every part of the city.

Finally, similar to last election, I've taken a look at which councillors' support correlates most or least with the mayor's. Last year, it turned out that a general pattern emerged where the councillors whose support most often correlated with high mayoral support also generally agreed with the mayor on votes. This year, the correlations between councillors and the mayor are:


I'd say this supports the theory from last election - last term, McKeen, Esslinger, Knack, Walters, and Henderson all voted alongside the mayor on more than 80% of non-unanimous votes, while Banga, Caterina, and Nickel (76%, 75%, and 46%, respectively) agreed with the mayor less frequently. While the mayor has had a strong track record of gaining majority support for non-unanimous bills, it does seem as though the candidates who do better in polls where the mayor does worse to tend on average to disagree with him more often than not.

That suggests that perhaps this council will be a little bit closer in voting record than the last one - the four new councillors all showed up in the middle of the pack for mayoral correlations, so likely either they are wildcards for agreement with the mayor, or as new candidates their reputation hasn't yet been tested. Only time will tell!

Monday, June 26, 2017

Edmonton City Council Gender Parity

Back in October I took a quick look at the success rates of female candidates getting into city council. In 2013, 22% of candidates were female, but only one out of the twelve council seats ended up being held by a woman. The aim of that post was to investigate some of the source of the gender disparity on council - namely whether the distribution of female candidates in different races was causing the issue, or whether there was an inherent bias against female candidates.

Ultimately, I determined that the relative lack of successful female council winners was more likely due to distribution of candidates across races than individual bias - without accounting for incumbency, there was no evidence of anything other than relative equal chances of winning between female and male candidates (i.e the number of female winners since 2004 is more or less what you'd expect assuming all candidates are equally likely to win).

That was a pretty positive sign, as it suggests that the biggest factor holding back a demographically-balanced council is the availability of under-represented candidates to run (which is totally outside of the scope of this blog to discuss), and perhaps more importantly, the avoidance of clumping of under-represented demographics into the same few races.

One of the biggest issues with the 2013 election was that five wards had no women running at all, and half of all women were clustered into two ridings. This drastically reduced the expected number of women into council, regardless of the relative proportion of candidates who put their names forward.

So with all that said, I've been keeping track of candidates for the 2017 civic election which are being tracked at Daveberta. For each candidate, I've tried to ascertain their gender in order by how they refer to themselves (political candidates love speaking in the third person), or how they're referred to in third party posts, and if all else fails by name and presentation assumptions. If you notice any errors, please let me know.

(Last updated September 19, 2017)

Based on the current 71 candidates, 23 are female and 48 are male (female ratio of 32.4%, up from 22% in 2013). However, based on the distribution between wards, an expected 3.89 seats will be won by female candidates, which could be considered a relatively inefficient allocation of seats based on the ratio of candidates. wards have no women running at all.

Overall, it's most likely that the number of female councillors after the election will be between 2 and 6 (90% confidence).

Edmonton Council (32% female candidates)


Edmonton Catholic School Board (65% female candidates)


Edmonton Public School Board (39% female candidates)

Now that the official nomination deadline has passed, these numbers ought to be pretty official! All in all, women running for city council are still a bit poorly distributed, leading to an expected under-representation of about 0.15 seats. On the other hand, men tend to be poorly distributed in the school board races, leading to expected over-representations of 0.28 and 0.86 seats for Catholic and Public boards respectively. All in all, the candidate distributions are fairly balanced though, and this is certainly a fairer election gender-wise than 2013.

Thursday, October 27, 2016

Edmonton City Council Gender Equality

In the 2013 civic election, 79 candidates ran for mayor and city council, 17 of which were women. The election resulted in one woman getting elected out of a council of 13. Though women represent 51% of the city's population, they represented only 22% of candidates, and resulted in 8% of council seats. With results like this, it's little surprise that groups like Equal Voice are calling for improvements to our system, including encouraging a larger diversity of candidates and promoting a more balanced and representative city government.

Taking a deeper look at these results shows some interesting trends though. For instance, in 5 wards in 2013, there were no women running at all, and half of all female candidates were clustered in races in two highly contested wards. This suggests that, while 22% of all candidates were female, the distribution of female candidates may have already been predisposed to a lower number of female winners in the end. Let's take a look.

There were 12 wards and one mayoral race in 2013 for city council, and the proportion of female candidates per race ranged from 0-43%. Assuming any given candidate has an equal chance of winning any given race (an assumption we'll check later), this is the expected distribution of female winners:


As previously mentioned, there was absolutely no chance of there being anywhere from 9-13 women on council, as 5 races were contested solely by men. Based on the uneven distribution of candidates in the remaining races, there was an expected 2.01 female councillors last year, or 15% of council. So while the number of women on council was still less than expected, it was closer than what we might have expected based on the total number of female candidates. Instead of being 14% lower than what we might expect from candidate distribution, we were 8% lower.

So does this mean that female candidates are 8% less likely to get elected than male candidates? That's really hard to say, and it turns out we don't have enough data yet. One way we can check is by looking at the p-value of our outcome - what's the chance that we could have gotten something as bad as the result we did, assuming our null hypothesis (that women are as likely to get elected as men) is true? In this case, the p-value is 0.37. Essentially, our data set is small enough that any result between 0-4 female councillors wouldn't have been all that much of a surprise (and in fact, 6-7 would have been an indication of an opposite effect). So let's not worry about significance yet, and instead look at more elections!

Edmonton's civic elections elect people to mayor, council, and public and catholic school boards. If we do the same analysis for all three councils for the last four elections, we get a chart that looks like this:


This suggests a lot of things, including:

  • City Council results over the last 4 elections haven't shown more than a 10% deviation one way or another. More importantly, the p-values for each election have been totally reasonable.
  • There's a lot of variation in the Public School Board elections. This is partially explainable based on how small the Board is, so any variation will be magnified from a percentage basis. On the other hand, that level of variation isn't present in the (smaller) Catholic Board...
  • Catholic School Board elections haven't shown an anti-woman bias in this data set.
So, interestingly enough, of the 12 discrete votes that I looked at, 4 had a slight anti-woman bias, and 8 were perhaps slightly pro-women. Essentially, what this suggests is that female candidates are just as likely to get elected as male candidates. If we add up all the results since 2014 into one graph (of 402 candidates running for 114* positions over the last four years), we get the following distribution:


Overall, 46 women have been elected to 114* electable seats, where the candidate distribution and chance would expect us to have elected 42.5. The p-value assuming an equal electability between women and men is 0.22, so no, meninists, there isn't a pro-woman bias either. These results are pretty much what we'd expect given the candidate distribution we've had. This general conclusion holds true across city council (p=0.29):


And Public Schools (p=0.19):


Though intriguingly enough breaks down at Catholic Schools* (p=0.03):

*: Here it's worth mentioning that before 2010, the Catholic election system was really weird and had a wildcard winner from whoever had the most votes but wasn't elected in their ward. This was particularly silly seeing as not all wards were the same size, so I've ignored the wildcard seat and victor for the purposes of this analysis.
The fortunate summary of all of this is that there's no evidence that any system is rigged against female candidates. That being said, the proportion of women elected to civic office in the last years is just under a third of total offices filled, which isn't even remotely balanced. The best way to get a more representative council is to have more under-represented demographics put forward their candidacy, so if you know anyone who might be interested or qualified (of whichever underrepresented group you choose), I strongly encourage you to encourage them to run.

Wednesday, August 17, 2016

Edmonton Bike Safety

Bicycles in Edmonton have been in the news quite a bit recently, particularly given the success of new bicycle development in Calgary. Bicycle lanes in Edmonton have been proposed, installed, removed, illegally painted, removed again, and blocked in council quite a bit in the last few years. Frustrations between cyclists, city planners, and drivers have gotten to a boiling point recently, and I think it's safe to say that whichever side of the debate you're on you're likely sick of it all. But please keep reading!

With all that said, things have recently gotten a bit more interesting from a data point of view. A month ago I was made aware of a data set of cycling injuries and incidents from 2009-2014 from the nice folks at Spacing Edmonton, which were analyzed by them as well as (more recently) the group over at Slow Streets.

Specifically, the people at Slow Streets made the claim that injury hot spots indicate where more cyclists are travelling, showing cyclist 'desire lines' which would be prime targets for bicycle infrastructure. However, a quick look at the map suggests that the streets with supposedly lots of bicycle traffic are also the roads with lots of vehicle traffic. Hypothetically, even if all streets had the same bicycle traffic, we might expect a similar distribution since one might think that more cars might lead to more interactions with cars.

So let's take a look and check this hypothesis. Fortunately, Edmonton has a nice map of average annual weekday traffic for major roadways. I combined the map data of all 1,070 cyclist injuries from 2009-2014 with the map of all streets that had traffic volume stats, and ended up with this result:

Error bars represent the 95% confidence interval for injury rate.

It looks as though there is a decisive link between vehicular traffic on a road and the number of cyclist injuries. As the city doesn't seem to have any specific information on bicycle ride distributions, it's hard to say with any certainty if the Slow Streets analysis is correct. Either way, it's clear that wherever cyclists mix with lots of cars, we get lots of injuries. This analysis ended up looking at 571 km of major roads with traffic data, which were responsible for 760 of the injuries recorded from 2009-2014.

But hey, that's not all! Edmonton also has a map of everyone's favorite (or least favorite) things - bike lanes!

From the map, Edmonton's road bike-friendliness can be broken down into four different types. There are separated shared use pathways, painted on-road bike lanes, signed on-road bike lanes, and plain old normal streets. So what does my previous analysis look like if we split road types up by their bicycle infrastructure? Why, this:

Again, error bars are the 95% confidence interval. Basically, ignore the green bars...

What are some takeaways from this? Well, first of all, major roads very infrequently have signed on-road bike lanes, so there's far too much variability for a proper analysis of them (green on the graph). Far more common are roads with separated shared bike paths (red), or no infrastructure at all (grey). From this, we get the firm (and hopefully not unreasonable at all) conclusion that biking on separated, wide, shared pathways for bikes is safer than biking on a normal road with traffic, by a factor of about 2.

From the City of Edmonton bike map

However, an interesting conclusion from this is that it's extremely hard to make the argument that painted bike lanes are safer than normal roads. In fact, in some cases, it looks quite a bit safer to bike on non-bike-laned roads. Weird.

What might cause this? Well, first of all I'd say that this analysis is a few factors short of anything scientific. For instance, the bike lane map for Edmonton likely includes lanes and paths that haven't existed for the entirety of 2009-2014, or have since been removed, so some of the injuries from my analysis are likely classified inaccurately. As well, other researchers, when investigating bike lane safety, controlled for the presence of parked cars on the side of the road, which I did not. So while I wouldn't necessarily go so far as to say that my analysis shows Edmonton bike lanes are more dangerous than streets without bike lanes, I stand by the assertion that bike lanes aren't safer than streets without them. I embrace the subtlety of that distinction.

Regardless, the data is quite clear about the effects of vehicle traffic on bike incidents, and the effects of physically separating bike paths from roads. Namely, separating vehicle and bicycle traffic may reduce bicycle injuries by a factor of 2 on busy roads, and up to a factor of 6 on quieter roads.

Again this is not surprising at all - I can't stress just how intuitive and likely boring the main finding here is. But this data set of cycling injuries from 2009-2014 does seem to show that painted bike lanes have not had the effect that was perhaps intended.

In my opinion, having decent bicycle infrastructure is absolutely important to having a vibrant and healthy city. Hopefully future bike lane decisions are made keeping injury prevention and statistics in mind, in such a way that we can expand our biking infrastructure as effectively as possible.

Sunday, July 3, 2016

Edmonton City Council Votes (Part 2)

A year ago I did a short piece looking at Edmonton city council voting patterns. It was pretty fun and showed some cool blocks in city council, but since then we've had a monster by-election, so it seemed like now is a good time to take a second look at this analysis.

Since council as a whole got elected in 2013, there have been 5763 votes performed, according to the city's Open Data catalogue. Of course, many of these are procedural matters, and the vast majority of them are unanimous. If we restrict the votes to non-unanimous votes to see how the councillors interact, we're actually only left with 358 votes to look at.

Of those 358 votes, we can come up with this result, showing how often each member of council agreed with each other member of council. I've colour-coded it to make the numbers seem a little less daunting:


The major update here, of course, is the addition of Councillor Banga to the mix. He seems to generally follow the Iveson/Esslinger/Walters group that we identified last year, though generally less so than his predecessor Amarjeet Sohi did. He also seems to disagree with Councillor Caterina disproportionately relative to anyone else. Again, much like a year ago, Councillor Nickel is a bit of an outsider, who agrees with his colleagues far less than anyone else does.

Another way of looking at this is to make network graphs. This first one shows all connections with councillors that agree with each other at least 67% of the time (this number was chosen so that Councillor Nickel isn't left out). Feel free to play with it, it's rather fun!



Alternatively, we can generate a network graph based on who agrees with who the most frequently. Orange arrows (when you hover over them) indicate the most frequent agreements for each councillor, blue arrows indicate that another councillor most frequently agrees with the first, but that it isn't reciprocated.



This shows a bit more clearly how potential groupings look at city council. Five councillors agree with Mayor Iveson more than anyone else, and two other councillors most frequently agree with two of those five. On the other hand, the remaining 5 other councillors tend to spread out from Councillor Caterina.

Of course, these two groups aren't all that different - Councillor Caterina and Mayor Iveson still vote the same on 75% of contested motions, so realistically they agree 98% of the time on all motions, but the above network graph is a nice way to dramatize it!

Finally, we can also take a look at how often each member of council ends up getting the result they voted for on each motion. Again, only looking at non-unanimous votes, we have:


Impressively, Mayor Iveson ends up on the winning side of a council vote 95% of the time. In fact, of all 5763 votes performed since 2013, Mayor Iveson has only been disappointed 17 times. There are certainly many conclusions that can be drawn from that, but at the very least nobody can say that Don Iveson has difficulties instituting the agenda he wants on council.

So there you go. I plan to do another analysis like this before the next election, so stay tuned for that one!

Tuesday, April 26, 2016

Which Edmonton City Councillor are You?

Since the Ward 12 by-election just a few months ago, Edmonton city council has gotten into quite a few rather contentious votes. Most recently the Mezzo Building decision left quite a few observers rather upset, but earlier council decided to scrap the proposed Hawrelak Park Water Play Feature (worst name ever, by the way) after being faced with price increases, and has had to face some struggles with the proposed green development in the Blatchford area.

With that all being said, since Councillor Banga has taken on the role, Edmonton's open data suggests that there have been 25 votes of council that have been non-unanimous, which it turns out is more than enough that no two councillors have voted the same way on everything over the last two months (even though Councillor Oshry and Mayor Iveson gave it their best shot at 24/25). That means that, with only a few questions, we can generate a choose-your-own-adventure game in the style of a Buzzfeed quiz to see which councillor you agree the most with over the last term!

Which Edmonton City councillor are you? The answer will surprise you!

Friday, April 22, 2016

Edmonton Zone Map

Earlier this week, there was a bit of a kerfuffle raised at City Council when they contentiously passed a motion to allow a new 16-storey building near Whyte Avenue. In order to allow the new building, they had to change some of the zoning around the area.

I was curious about exactly what the distribution of zones in Edmonton look like, so I decided to see if I could find a map. Oddly enough, despite the data being available on the city's OpenData portal, there wasn't a readily-available one to be found via Google.

And maybe there's a good reason - it turns out there are over 85 different zone descriptors that the city uses, and many of the individually set zones are actually rather tiny (small parks count as their own zone, for instance). If you coloured a map based on all the different types of zones, it would be a scary kaleidoscope that wouldn't be terribly useful.

So instead, I've reverted to the tried and true Sim City method and labelled things broadly as either Residential, Commercial, or Industrial zones. Take a look:



If you've lived in Edmonton for more than a couple minutes, I'm sure that this map isn't surprising to you at all. I find it still cool to actually see things laid out like this though - it really shows you the industrial moat that surrounds Mill Woods, for instance, and specifically locates all of the strip malls we seem so fond of. (If your favorite strip mall isn't coded blue, it's most likely because many areas tend to end up as 'Site Specific Development Control Provision', which is essentially bylaw code for 'none of the above'. I didn't end up colour coding them all because there 650 of them, mostly all for different reasons...)

One final thought: I'm not so sure I like the sounds of the Anthony Henday being an agricultural zone. Hopefully they keep the agriculture and the four lanes of speeding gas guzzlers a little separated...

Tuesday, March 1, 2016

Edmonton 2015 Federal Election Results

As you might remember, that big old scary 2015 Federal Election happened way back in October. However, the Government only released the official results of the election just yesterday - go take a look at them, they're quite cool!

In the meantime, here's the final official map of how each poll in Edmonton voted, in a similar format to my post regarding the previous Alberta election. Each poll is coloured by which party had the most votes there (red is Liberal, blue conservative, and orange NDP), and then darker colours indicate the party had greater than 50% support.

Enjoy!

Wednesday, February 24, 2016

Edmonton Ward 12 By-Election Results

Edmonton's Ward 12 by-election took place this week, and it had a historic 32 candidates running to sit on council. There were a couple of fun outcomes from this election that are worth taking a quick look at:

Winning Vote Total

I didn't bother doing a full write-up on this, but I was curious at the beginning of the race about just how many votes it would require to win this election. With 32 candidates, technically the winner could have won with 3.125% +1 votes, which is terribly low, but I had a hunch that there would be a few front runners, and lots of trailing candidates. I decided to take a look at historical civic elections in Edmonton and Calgary, and posted this graph on twitter:


Obviously it was a long shot extrapolation, as very few past elections have had even half the number of candidates as this one.

How well did I do? The winner, Moe Banga, got 17.76% of the vote, which adjusts our graph to this:


I'd say that looks pretty decent. Sure, it was a long shot estimate, but it was certainly a lot less dire than the worst-case guess would have been.

Vote Distribution

Sadly, because of its by-election status, there were only seven polling stations in this election, which means that mapping voting data is a bit silly. Here are the results of the winner in each poll anyway, though.


Again, not much to write home about. This map is a lot more boring than it could have been largely because all the vote totals tend to be quite close together, and each poll represents several neighborhoods. 7 data points just isn't enough to have fun with.

That being said, we can see that Moe Banga had fairly wide-ranging support, which will be encouraging for him going into council. Irfan Chaudhry, who came in fourth, had a narrow lead in Charlesworth, Walker, and Ellerslie neighborhoods, and Laura Thibert, who came in second, had a decent lead in Larkspur and Wild Rose.

Election Strategies

Finally, when we look at the total vote breakdown a little more closely, we can get a bit of an idea as to how some of the campaigns prioritized.

Take advance voting, for example. Advanced votes accounted for 27.3% of all votes cast, but were prioritized by some candidates more than others. Moe Banga, the winner, was clearly quite organized and got 37% of his vote in advance (these advance votes of his were enough to beat the total votes of 26 other candidates even). Other high-ranking candidates, like Balraj Manhas, Arundeep Sandhu, Yash Sharma, and Rakesh Patel all got over 35% of their vote in a similar way. Candidate Sam Jhajj was a clear outlier though - getting 70.3% of his votes from advance voting.

And finally, special ballots only accounted for 1.1% of all ballots, and are reserved for people who can't vote in either advanced or normal ballots. Strangely enough, three candidates (Moe Banga, Rakesh Patel, and Balrash Manhas) combined had more than half of these votes. Kudos for grabbing the out-of-towners, I suppose!

That's it! And we won't have another election in Edmonton for 18 months! See you after the next one.

Tuesday, January 26, 2016

Taxi Stats for Edmonton

The fight in Edmonton for Uber vs Taxis has finally reached its head today, with the final vote for the  updated Vehicle for Hire bylaw to be debated by the end of the day (barring any disruptions to council).

Potentially complicating matters is that this takes place during the very beginning of the Ward 12 by-election, meaning one seat on council is vacant. This is perhaps extra complicating matters as some of the candidates for the by-election are either directly involved with the United Cabbies Association of Edmonton or calling for a postponement of the debate, under the understanding that Ward 12 contains a disproportionate number of taxi drivers relative to other wards of the city.

Of course, taxi drivers are only one half of the equation, and taxi users are also important to consider. While the stat on the previous link that 35% of cabbies live in Ward 12 is only sourced to the Nav Kaur campaign, there is plenty of other information from the cab users from a 2014 city survey that reveals some data from the consumer side of things. This first map, for instance, indicates the percentage of people who regularly take taxis in each ward*:


Green: higher taxi usage; Red: lower taxi usage
*Postal codes T5C, T5S, and T6P had low survey turnout and probably should be disregarded in this map.


As may be expected, taxis are more commonly used in the interior of the city, and less commonly used to the west and east. Councillors who might be more concerned than average about their constituents' access to taxis could include McKeen (ward 6), Henderson, (ward 8), Walters (ward 10) and Nickel (ward 11).

The survey also looked at the perceived importance and satisfaction for taxis in Edmonton. Both questions were rated from 1-5, with five being the most positive (extremely important and very satisfied, respectively). The averages for each ward are:

Importance:


Green: High importance; Red: Low importance

Satisfaction:

Green: High satisfaction; Red: low satisfaction

 On average, Edmonton citizens tend to view taxi services as somewhere between moderately and very important (3.86/5), and are somewhere between somewhat dissatisfied and neutral about their experiences (2.79/5).

This post is mostly not to provide opinions, but to share some of the data that the city has on taxi users in Edmonton. There are parts of the city where people regularly take taxis and think they are important, but also aren't satisfied with the service they receive, and regardless of the outcome of today's vote hopefully opening up the discussion around taxi alternatives results in a better user experience overall.

Thursday, June 25, 2015

City Council Analysis

Back after the 2013 Edmonton municipal election, I did a quick analysis to see if I could predict who some of the new mayor Don Iveson's friends on council would be. My thought was that councillors with similar platforms to the mayor's, and who are potentially more likely to agree with him on votes, were also likely to get voter support in the same neighborhoods due to their similarity. It seemed plausible enough so I did a correlation analysis.

It's now been a decent enough time since the last election that I've decided to check if my guess was accurate or not. Let's take a look!

Edmonton's Open Data has a log of the voting record for the 2013-2017 council, and it is fairly long. All told, there were 2,757 different motions that had been voted on so far. One issue with taking a look at all of these combined is that plenty of the votes are for procedural matters in council that get passed quickly and unanimously, and they're kinda boring from an analysis point of view. Of the 2,757 motions that have been voted on, 2,611 were unanimous one way or another. So let's ignore those, and focus on the remaining 146 contentious votes.

If we compare how each councillor and the mayor voted for every contentious vote they were present for, we can see how often any given pair end up voting the same way. The end results look like this:

(Click to zoom and enhance)
One of the first things to notice is that mayor Iveson does seem to have a fair bit of support on council - 7 councillors tend to vote the same way he does more than 80% of the time, and that's enough for a majority on most votes. These same 7 councillors (Knack, Esslinger, Henderson, Walters, Sohi, McKeen, and Loken) all tend to agree very consistently with each other too (with the possible exception of councillors McKeen and Loken). I wouldn't go so far as to say that they act as a voting block, but there certainly is evidence that they get along very well professionally, to say the least.

Other interesting observations include that councillors Loken, Caterina, and Gibbons all vote together quite a bit, with councillors Caterina and Gibbons agreeing more with each other than with the mayor. Councillors Anderson and Nickel quite clearly do not see eye-to-eye with most of the rest of their council colleagues.

One way we can check out my previous analysis is to compare the frequency councillors agree with the mayor with the correlation values I had previously obtained. If we do that, we can generate a graph like this:


Back when I did the original analysis, plenty of people (including myself) were surprised at the fact that councillor Walters ranked so low on the list. It turns out they were surprised with good reason, as he is one of the most notable outliers on the graph. It looks as though the analysis was alright, but nothing to be proud of. It is perhaps better than a random guess, but not necessarily something that provides critical or accurate insight immediately following an election.

One last graph for you. Each member of council had a fellow councillor who they tended to agree with the most. If we pretend that this coincides with who influences who, we can draw a graph like this:

This shows that for seven councillors, the person they agree with the most is mayor Iveson. The remaining councillors tend to split off in a group where they agree with the Caterina/Gibbons group that I mentioned above, though the frequency with which they agree with either of those two councillors is significantly lower than how often the rest tend to agree with the mayor.

The results from this analysis could exist due to a large number of different reasons. It's possible, for example, that this is an example of mayor Iveson's abilities to gain support from his councillors, and it's equally possible that it shows his ability to listen and accommodate the views of his councillors. Either way, it is his job to be the leader of city council, and so far the data seems to suggest he's doing just that.

Monday, April 20, 2015

Edmonton's NHL Draft Lottery Luck

This weekend, the hockey world lit up with the news that, for the fourth time in six years, Edmonton got the first overall pick in the NHL draft lottery. This year was extra special, as the projected first-round pick Connor McDavid is supposed to be the chosen one who will lead us from our years of darkness (...or something).

The question I was faced with is just how unlikely is it that Edmonton came first 4 times in the last six years. After all, it is a lottery. The fact that the team who gets the first overall draft pick is randomly determined each year is good because it hopefully reduces the chances of a team tanking on purpose to be the worst team in the league in a given year, and keeps games interesting for fans.

Over the last six years a few different odds distributions were offered for the 14 lottery teams that didn't make the playoffs. Until 2012 only the five worst teams had a chance of getting the first draft pick (the absolute worst team had a 48.2% chance), but since 2013 all 14 of the worst teams have some chance or another.

Edmonton and Carolina were the only two teams to not make it in the playoffs over all six of those years, so it stands to reason that they had the best shots at getting the first draft picks at least once or twice in that period, right? This is what happens if you actually crunch the numbers though:


It turns out Edmonton's chances of getting four first-round picks over the last six years was actually around 1.9%. This is certainly low, but not necessarily anything impossible.

There are two reasons that this may be higher than you'd think. First of all, I was looking at the chances of Edmonton winning any four of the last six drafts, not specifically the first three, losing two, and then winning the sixth. Those odds are astronomically low, but deceptive since nobody is up in arms about the lotteries Edmonton didn't win. Secondly, Edmonton's chances were so much higher than Carolina because the first three years Carolina was in the draft lottery, they weren't in a position where they could have won first pick overall (as before 2013, a team winning the lottery could only move up a maximum of 4 positions).

All told, this gives Edmonton an expected return of 1.456 overall first picks over the last 6 years, where they actually got 4. To put that in perspective, they were expected to get almost twice as many overall first picks as the next worst team over the last six years. Of the 27 teams who made at least one appearance in the draft lottery over the last six years, we have:


Realistically, this means that the luckiest teams in the draft have been Edmonton, Florida, and Colorado, and the unluckiest has probably been Columbus. The four teams at the bottom happened to have their bad seasons in years where they weren't quite bad enough to have a shot at first overall pick (poor guys).

So yes, Edmonton has gotten lucky with draft picks over the last six years, but it's not quite as impossible as it would have otherwise seemed. We were helped out by being the worst team in the league in two years where we had nearly 50% chances of winning the draft, and by generally being terrible in the rest of the years to keep our chances high. We've gotten lucky at the draft, but only by being genuinely terrible over the last six years, and I sincerely hope that trend starts to reverse soon.

Tuesday, April 14, 2015

Edmonton Air Quality

This morning, I read an Edmonton Journal article that claimed that Edmonton's air quality was worse than Toronto's, even though we have five times less population than Toronto. The article's subtitle reads: "Particulate readings 25 per cent higher on some winter days."

I'll admit that my initial reaction to this was skepticism - the language used in the article seemed pretty wishy-washy and I wasn't sure what all the fuss was about. It's not terribly unnatural for some days in some cities to be worse than some days in other cities. Also, if pollution levels are particularly low on certain days, being 25% higher than another city is pretty easy and still reasonably healthy. So I decided to look into the numbers a little bit more.

The article continues, saying "pollution from particulate matter exceeded legal limits of 30 micrograms per cubic metre at two city monitoring stations on several winter days in 2010 through 2012." Ok, that sounds pretty bad, but what do these limits correspond to, and how bad is "several", really?

First of all, let's take a look at what makes air unhealthy. The Air Quality Health Index used by Environment Canada looks at three factors: Ozone at ground level, Particulate Matter (PM2.5/PM10), and Nitrogen Dioxide. Exposure to Ozone is linked to asthma, bronchitis, heart attack, and death (fun), nitrogen dioxide is pretty toxic, and particulate matter less than 2.5 microns is small enough to pass right through your lungs and play with some of your other organs. These aren't things you really want to be breathing a whole lot of. The AQHI for Edmonton today is a 3 out of 10, considered ideal for outdoor activities, but at a 10 out of 10 level people are pretty much encouraged to stay inside and play board games.

The report in the Journal article referenced PM2.5 only, which is particulate matter that's smaller than 2.5 microns. The maximum allowed levels for PM2.5 in Alberta are 80 micrograms per cubic meter (ug/m3) in a single hour, or 30 ug/m3 over a day. According to the Journal article, these levels were exceeded "several" times between 2010 and 2012. How many is several?

Data from the Clean Air Strategic Alliance

I don't know about you, but exceeding government safe levels for air quality on one day out of every eleven in 2010 is not what I'd call "several." There was over a combined month of air quality limits being broken in 2010 in central and east Edmonton.

I strongly disliked the phrase "25 percent higher on some winter days" due to its vagueness, but the idea of comparing Edmonton to Toronto seemed fun. Based on the CASA values for Edmonton, and the Air Quality Ontario values for Toronto, here's a comparison of the two cities from 2006-2012:


That's... not even close. Edmonton was 25% higher than Toronto for pretty much all of 2012, not "some winter days." This is enough to make me feel like perhaps the sources referenced in the Journal were using different data, or perhaps I'm mistaken, but the sources I used are all publicly available and I encourage you to check them out yourself.

But what about the other major air quality indicators? Turns out that, fortunately, exceeding their limits has proven to be much tougher. The maximum one-hour limit for nitrogen dioxide is 0.159 ppm, over 10 times the daily average for both Toronto and Edmonton recently:


Similarly, the one-hour limit for Ozone is 0.082 ppm, about four times the recent daily averages:


Again, these levels are much safer than the particulate levels were, and in general Edmonton is about the same or slightly better than Toronto for these indicators.

So all in all, I started out today thinking the article was being alarmist, if vague, and I've ended up thinking that it's well-meaning but presented oddly. Edmonton definitely does seem to have a problem with one of the major indicators of air quality, and if it takes a city-pride fight with Toronto to get that sorted out, so be it.

Tuesday, January 27, 2015

Pro Sport Team Mobility

Oh, the Oilers...

As of today, with a little less than half of the 2014-2015 NHL season remaining, the estimated odds of the Oilers getting into the playoffs are approximately 0.008%. They're currently last in their division, and the estimated chance of them staying there is 70.7%. Congratulations on another wonderful season!

The only thing the Oilers have going for them is that the NHL draft system gives a bonus to teams that do badly, with the hope of eventually balancing things out. Of course, the Oilers have supposedly been on the receiving end of this for a few years without success, but maybe this time it'll actually work?

But exactly how well does does the draft system work for helping the worst teams out in future seasons? I decided to find out.

The NHL has only had 30 teams playing since the 2000-2001 season, so I decided to stick with the years since then. I started by looking at the teams that ended up in either the top or bottom quintile (20% of teams), and tracking how likely they were to make it into either category over the following five years:


For example, the above graph shows that a team that finishes in the top 20% of the NHL one year has a ~50% chance to make it back in the top 20% within one year, and an 80% chance to make it within 5 years. On the other hand, the worst teams in the league only have a 7% chance to make it to the top within one year, and only a 50% chance to make it within 5 years. Cool, right?

Reversing the situation looks like this:


This results in somewhat of a different trend. Teams that do poorly have a 2/3 chance of being in the bottom fifth of the NHL again within 3 years, but after that it plateaus and there doesn't seem to be much increased risk of them doing terribly. Also, it's about half as likely for a great team to end up doing terribly at any point within the subsequent 5 seasons as it is for a poor team to do awesomely.

These results lead into a discussion of how closely correlated a team's performance is year-to-year. Plotting how successful they are one year against the subsequent year looks like this:


Definitely a correlation, but nothing worth placing a bet on. This says that, in general, the teams that did well one year are likely to do well the next. No huge surprise there. Looking further down the road:


Five years later, and there's almost no correlation at all. This is the sort of thing that ought to make Oilers fans happy, if only it weren't for the fact that they've been in that bottom 20% for four of the last five seasons. Ugh.

The change in correlation between seasons is shown pretty well by this:


Which is an excessively pretty and smooth trend between seasons. This apparent regression to the mean for teams on the whole, though, also applies really well to the teams on the extremes (the best and worst of any season):


Suggesting that, surprisingly, the best and worst of the league will be statistically equivalent after only 3-4 seasons.

So does this give us much of a prediction for when the Oilers will finally start showing up to play real hockey? Not really, though historically the trend has been that they ought to have a 50% chance of making it to the top of the league within 5 years, and that they'll be about the same as today's best in the league (eg Anaheim?) within about 3 years.

The final question then becomes just how much of this effect is caused by normal luck and regression to the mean, and how much is influenced by player trades and the draft system? Turns out that it's likely quite a bit - comparing four major pro sports leagues on of the charts above gives the following:

(Chart was made using 13 NHL seasons, 12 NFL seasons, 10 NBA, and 15 MLB for consistent league sizes)

The fact that there's such a variation between sports suggests that there's more to inter-season variation than just random chance, which is certainly promising news for all those coaches and general managers out there. It isn't terribly surprising that the correlation values for NFL are consistently low, since the number of games each team plays is drastically lower than the other three pro sports leagues. On the other hand, the results for the NBA are rather surprising - teams tend to do almost the exact same one year as they do on the next, but tend to have an inverse correlation five years down the road. If the Oilers had been an NBA team, they wouldn't expect to stay at the bottom for very long.

So while this year looks like another dud for the Oilers, there's always hope. Plenty of teams have broken their slumps before, and it's hopefully only a matter of time before the Oilers have their chance.

Friday, October 31, 2014

Women's Inequality in Canada

About 5 months ago the Canadian Centre for Policy Alternatives released a report that compared the "best and worst place to be a woman in Canada." I wasn't a huge fan of the report - in fact, I thought the analysis wasn't too dissimilar from my zombie post, and disagreed with how strict rankings were compared across broad categories. I also thought that calling Edmonton the "worst place to be a woman" in Canada to be a bit of a jump from the findings as reported - Edmonton was instead (by their standards) the lowest-ranked city out of 20 in terms of equality.

Just recently, the World Economic Forum released its very own report on worldwide gender inequality, and I liked it much better. It measures a similar number of quantitative results, but weighs factors appropriately based on statistical measures, and compares them based on scores instead of their rankings between categories. Though the merits of the specific measures used are open to interpretation, I'm satisfied that they're representative of inequality across the world.

These stats were so well prepared and presented, in fact, that I figured Canadian cities deserved the same treatment in their rankings. If we take (approximately*) the same approach as the World Economic Forum, and apply it to Statistics Canada results for our top 20 cities, this is what we get:



Rank City Score
1 Victoria 0.836
2 London 0.817
3 Sherbrooke 0.783
4 Ottawa-Gatineau 0.777
5 Vancouver 0.773
6 Québec 0.772
7 Toronto 0.766
8 Saskatoon 0.756
9 Montréal 0.747
10 Oshawa 0.746
11 Halifax 0.739
12 Winnipeg 0.730
13 Hamilton 0.727
14 St. Catharines-Niagara 0.726
15 St. John's 0.720
16 Kitchener-Cambridge-Waterloo 0.713
17 Regina 0.711
18 Windsor 0.708
19 Calgary 0.693
20 Edmonton 0.692

So there's good news and bad news here. Good news: some cities are pretty much in the same rank as the CCPA study (especially around the bottom of the list). Bad news: some cities moved over 10 spots (London and St. John's basically traded places). In general there's a weak correlation between the two analyses.

The World Economic Forum model looks at four major categories: Economic Participation, Health and Survival, Educational Attainment, and Political Empowerment, all weighted the same. Within each category are up to 5 differently weighted sub-categories - statistical measures that are typically converted into ratios of female:male success, with 1.00 being perfect equality, and 0.00 being complete inequality. Weights within each category are distributed based on the overall variance of that measurement, so that a 1% change within one sub-category is worth the same as a 1% change in another.

There are a couple of advantages to using the World Economic Forum model when looking at Canadian cities. Comparing inequality scores to each other allows for a better overall picture of how the city is doing, compared to a strict rank of cities between each other. Also, by following an internationally accepted standard, we can compare these numbers directly to the results of other countries to get a better idea of exactly how good or bad any given city is.

Some fun findings:

Victoria, the best city in this ranking system, has an inequality index of about 0.836, which indicates that it is more or less as equal as the entirety of Norway. It mostly got this due to being very strong across all categories, but particularly for having the closest to balanced city council participation out of any city in the country.


Montréal was approximately equal in terms of female-to-male equality to Canada on average. Much like the country on average, women in Montréal do just as well or better than men in terms of health and education, but are still trailing behind from an economic point of view and are drastically far behind in terms of political representation.


Edmonton, sadly, still has a lot of ground to cover and I'm afraid there's now way of looking at the stats that doesn't rank it last in terms of equality. Our score puts us approximately equal to Russia in terms of inequality.


Edmonton suffers mostly from having had very little female political representation, as well as significantly fewer women working than men, while earning much less than they do.

None of this is saying that Edmonton is particularly bad place to be a woman - certainly I'm sure that most women feel safer in Edmonton than they would in Russia, and the standard of living is likely much better on average. It is simply the case that Edmonton men have it as much easier than Edmonton women do as Russian men to Russian women.

As a country in general, we still have a long ways to go, and I'm certain Canada can climb from 20th in the world. But that change starts here in our cities, and an analysis like this is (in my mind) much more useful for telling us where we stand than the report by the CCPA five months ago.




*Minor changes from WEF report include:
-Political Empowerment: "Head of state" was changed to "mayor", ministerial positions were combined with members of parliament and replaced with current members of council.
-Wage equality for equal work data wasn't available for cities, so it was combined with estimated earned income.

Spreadsheet available upon request

Sources: 
Education
Health 1, 2
Economy 1, 2, 3
Political: Individual city websites