Thursday, October 2, 2014

McDonald's Monopoly Stats

Man, was I ever excited when I saw that McDonald's Monopoly was back this year! I had a blast looking at the Roll Up the Rim stats last year, and hoped I could do the same for Monopoly this year.


Then I was pretty disappointed to realize that Business Insider had done their own analysis. I was all set to just read theirs contently, until I realized that they just copied and pasted their same article from the year before (hint: the prizes changed this year, dummies). So yay - I get to do my own!


(By the way, a less fun breakdown of the stats is done in the official McDonald's rules, so feel free to check my sources as we go along).


So how this all works is that whenever you buy certain food items (like a medium fountain drink, medium coffee, Big Mac, etc), you win two game stamps. Stamps either have a property, an instant win for food, or an instant win for some sort of other fancy prize. The breakdown for how this looks is approximately this:


A total of 1,303,683,256 stamps were printed. McDonalds' claim that one in four purchases will result in an instant win is bang on then, which is nice. The reasons these numbers may not line up 100% (unfortunately) is that some of their prizes are listed for the U.S. only, and they haven't indicated the exact distribution for Canada.

So one quarter of the time you buy anything, you'll win something. That's kinda nice. I mean, chances are it'll be medium fries (they're 50.2% of all food items, after all), but you could always hold out for that rare Royale with Cheese (you have a 2.2% chance any given time you go!).

The other three quarters of the time, you'll get a property, and if you collect all in a property group, you win big! The problem is that McDonald's doesn't distribute their properties in an even manner, instead they distribute them in such a way as to give you hope. Each colour group has a handful of very common properties (typically a 1 in 11 chance of getting them for any purchase), and one property that's very nearly impossible to get.

Bit tough to make out the really valuable prizes...
For instance, McDonald's has printed off approximately 60,670,043 Baltic Avenue stamps, so the chance of getting at least one any time you play (remember, 2 stamps per play) is 9.09%. Those are pretty good odds - it won't take you very long to get yourself a Baltic Avenue stamp. They only printed off 1,000 Mediterranean Avenues though - so your odds of getting one of those any time you play are only 0.00015%. A wee bit tougher - and don't forget, that's only for the cheapest property prize ($50).

Similarly to how I looked at Roll up the Rim, we can take a look at just how many times you'd need to play Monopoly to have a reasonable chance (>50%) of winning any given prize. The average price of eligible McDonald's items ranges from $1.00 (hashbrowns) to $4.49 (Bacon Clubhouse), but I'll use the average of all eligible items as $3.17 for calculations (because who wants to eat millions of hashbrowns?). If we start with the properties, we'd get:

Mediterranean Avenue: Need at least 451,666 plays to have a shot at getting... a $50 gift certificate! In the process you'll likely win about $170,000 worth of prizes, but it'll result in a net loss of $1,300,000. Maybe not worth it.

Vermont Avenue: Need at least 112,955,548 plays, but you just might win gas for a year! Never mind the net loss of $316,000,000.

Virginia Avenue: Better get ready for 90,364,438 hash browns (or equivalent), for your very own chance at $5,000! Fortunately, by that point you'll likely have had 4 million each of the other two properties for that group, so you're good to go!

Tennessee Avenue: Pretty easy with only 1,895,651 plays needed, and you just might get a Samsung Galaxy! Fun fact: the caloric value of 1,895,651 hashbrowns is enough to feed you for about 415 years in a row.

Kentucky Avenue: Enjoy the necessary 22,591,110 plays you're likely going to need to win your very own 5-night Delta Vacation for Two! If you got that in medium fountain drinks, it would fill five and a half Olympic swimming pools (everyone's favorite measurement of volume).

Ventnor Avenue: Another relatively easy one - only about 6,024,296 plays for a 50% shot at nabbing a Beaches Resort Vacation for your family! If you bought all your plays with bacon clubhouse sandwiches, that would only cost you about $27,049,089, which is actually a pretty good deal (sarcasm).

Pennsylvania Avenue: A bit tougher, but it'll take about 225,911,096 tries for a reasonable chance at a trip in a Cessna private jet! You might think that's tricky, but wait until you put effort towards:

Boardwalk: Approximately 451,822,158 plays needed, but you'd have a glorious chance at nabbing A MILLION DOLLARS $817,572*! Even at the lowest rate of $1.00 per play for hashbrowns, this effort would require your Monopoly opponents to land on your Boardwalk 225,911 times (in original Monopoly, assuming you had a hotel there).

(* Also - the million dollar prize is misleading. Because it's paid out in $50,000/year installments over 20 years, the present value of the money is much less than a million dollars once you take inflation into account.)

Adding everything up, the total value of all prizes offered in Monopoly is $488,423,499.28. With a total of 651,841,628 plays, that means that the expected return of any given play is about $0.75. This may be pretty reasonable if you're buying $1 hashbrowns (get a hashbrown, plus an expected loss of only about 22 cents), but at an average eligible food item cost of $3.17, the loss to McDonald's on each purchase is about $2.42 or 64%, giving it a worse house edge than Lotto 6/49.

So, much like Tim Horton's Roll Up the Rim (or any large promotions, for that matter), I wouldn't recommend McDonald's Monopoly from an investment point of view. If you're already out there gobbling up hashbrowns, carry on though!

Friday, September 12, 2014

Edmonton's (by)Lawbreakers

Before I get to the fun stats, bear with me while I rant for a bit.

The Edmonton Police Service offers a handy-dandy little tool known as the Neighborhood Crime Map, that shows where crimes take place across the city, and gives some insight into past crime behavior. I was all set to do an analysis of the data, and was pretty excited about what I was going to be able to show, but then more carefully read the terms and conditions which include:

While it is acceptable to pass the website link on to others in your community, you will not share the information found on the website with others other than with members of the Edmonton Police Service or other law enforcement agencies
Seeing as others have explicitly asked for permission to share the data and were turned down, and the EPS has "dealt" with others who used it without permission, I've decided not to publish any of my analysis. But shame on them. The site isn't so user-friendly that it's perfectly optimized to give the best information possible, and offering data to the public but forbidding them from discussing it doesn't really count as "open data."

* * *

That being said, the City of Edmonton publishes open data that's actually open. This includes my new favorite data set: Bylaw Infractions!

The bylaw infraction data set includes heinous crimes like "Weeds" and "Unsightly Property", but also things people are actually concerned about like "Unlicensed Businesses," "Graffiti," and "Snow/Ice on Walk". So lets do everything I would have done for actual crimes, and instead look at people who let their grass grow too long.

Weather!

Weather, unsurprisingly, has a decent effect on bylaw infractions that are reported. On the one hand, it's not at all surprising that people report weeds in the summer, and snow on sidewalks in the winter:


On the other hand, a similar graph for infractions for unlicensed businesses makes, as far as I know, no sense. For some reason, every January or February a lot of people get fined for unlicensed businesses. Most likely kids selling off their Christmas presents, I reckon:


At least the new year stings seem to be getting less intense over the years... yay?

Finally, we also have graffiti and unsightly property, which look something like this:


Apparently properties are more unsightly during the summer - who knew? More reasonably, the complaints probably are easier to make when there isn't snow covering a poorly-kept lawn (or whatever "unsightly" means...). As for graffiti, there's a fairly consistent double-peak pattern every year, where graffiti artists seem to take a bit of a break around September. Maybe it's something to do with them hooligans getting busy going back to school? Who knows...

Neighborhood!

Graffiti



Looks an awful lot like graffiti is concentrated downtown and in Strathcona. I'd comment on how that may or may not be associated with actual crimes, but I'm not allowed to by the EPS Terms and Conditions. Instead... it seems correlated with tall buildings...?

Snow/Ice on Walk



Unlike graffiti, snow and ice left on sidewalks seems to be a bit more spread out around the city. Apparently the southern suburbs are either better at shoveling, or better at hiding ice, than their northern neighbors.

Unlicensed Businesses




If you want to run a business but don't have a license, I wouldn't go downtown or to West Edmonton Mall. That's just what they'll be expecting.

Unsightly Property




Mirror, mirror, on the wall, where's the unsightliest property of them all? Well, the most violations happen in Alberta Avenue, and in general just north of downtown. Keep looking sharp, suburbs!

Weeds



Not super surprisingly, the neighborhoods with high weed violations tend to correlate quite well with unsightly properties. It would really suck to get a double-whammy for both at once, wouldn't it? At least some of the oh-so-pretty suburbs (like Windermere and Summerside) are getting caught on weeds too!

Nosy Neighbors

Take a look at this:


When it comes to who's actually reporting these bylaw infractions, it's almost a perfectly even split between bylaw officers and everyday citizens for "tattle-tale" infractions like not shoveling, ugly houses, and weedy gardens. On the other hand, I'm solidly impressed that the vast majority of unlicensed businesses are reported by citizens. I guess people don't like being ripped off? On the other hand, nobody much seems to mind graffiti apart from the bylaw officers...

So there ya go. Not quite the crime post I wanted, but still fun to look at nonetheless. Thank you to the City of Edmonton for having actual open data, no thank you to the EPS Crime Map, and special thanks to my friend Daniel for suggesting the bylaw infractions as an alternative!

Tuesday, September 2, 2014

Edmonton's Census Correlations

Back in May, a lovely website went viral that listed a number of spurious correlations between unrelated sets of data. It was loads of fun to read, and a lovely reminder that correlation doesn't imply causation.

Edmonton's 2014 census data was released last week, in a glorious Christmas-like occasion for people like me who are into that sort of thing. The census asked a couple fun questions and broke the results down by neighborhood, and I originally figured it might be a fun idea to comb through the data for ridiculous correlations like the Spurious Correlations website.

Unfortunately nothing super ridiculous stood out. Regardless, take a look at some of the more fun findings from the Census that maybe haven't been picked up on by other sources:

Married people don't like renting



I mean, really, nobody really likes renting, but it seems like married people especially don't.

Low apartments make you lazier



In general, living in an apartment correlates with transit alternatives that aren't driving, but people in high-rise apartments walk to work way more than people in shorter apartments. Sure, this is maybe because most of the people who walk to work live downtown and that's where the high-rises are, but it's more fun to think that short apartments compel people to bus...

This fun graph



Basically, as neighborhood populations change, people's jobs change too. For instance, the most common time to have a family member in preschool is when you have people in your house under age 5 (duh), but the second most common is when you have people aged 35-40. That double-peak pattern gets shifted over by 10 years and flattened out for grade 7 kids.

Other moderately interesting (but less pretty to graph) correlations include:


  • Full-time workers like driving their own cars, but only really post-secondary students bother consistently taking transit to work
  • People who've been in their house a long time tend to pay attention to the newspaper and radio more for their city info, but people who've been there for less than 3 years seem to prefer the city website
  • People who go to Catholic school seem to like driving more 
  • People working part-time are more likely to have lived in their house for more than 5 years than people working full-time (but less likely than if there are high school kids in the house!)
  • 25 to 40 year olds tend to move around the most, after then they seem to stick in the same house for a while

Wednesday, August 27, 2014

Population of Canada by Longitude

A couple of months ago a friend of mine on Facebook shared a post with me that graphed the population of Canada by latitude. They also challenged me to come up with a similar graph of Canada's population, but by longitude.

And I promptly forgot. Until now!

Like the original post mentions, finding geographical data that matches up with population data from Statistics Canada is quite tough, largely because the postal code data is intellectual property of Canada Post, and they don't much like sharing. I managed to find the 2011 Census data sorted by Forward Sortation Area (the first three digits of your postal code), and the geographical data for all postal codes (which was an unreasonably large file), and combine the two to get a fairly precise view of the data. To make sure what I had was close enough to the original graph, I redid his work by latitude first:

Close enough. Around the north some things get wacky because postal codes are so large and we likely used different ways to approximate the centers of each FSA, but I'm still reasonably satisfied with the result.

It's a fun graph, and deservedly the original got a nice amount of HuffPo press. It's pretty weird to think that about half of Canada lives below the northern suburbs of Montreal, and only 31% of the country lives above the 49th parallel section of the border.

Sure, Canada's tall, but lets talk about how wide it is. It's really wide. It stretches from 52°37'W at Cape Spear to 141°0'W at Boundary Peak, which covers nearly a quarter of the longitudinal values on earth. Yay us.

If we do the same analysis as the previous graph, but for Longitude, we get the following (you can click on the image to zoom and enhance, spy-movie style!):


So really, nothing too surprising. The majority of people tend to live somewhere between Toronto and Qu├ębec City, and in both British Columbia and Alberta the major cities tend to fall more or less along the same line north-south.

I was planning on combining both maps into a generic heatmap for Canada, but then I stumbled on this, and it's way cooler than anything I'd have been able to do, so I'll just share it with you instead. Try not to get too mesmerized...

Friday, August 15, 2014

The Great Oven Mitt Review of 2014

So I've got some cool friends.

A little background: when I first moved into my apartment (one year ago today exactly!), I only remembered to buy oven mitts at the last minute. I grabbed the quickest and cheapest one I could, which was a single oven glove appropriately called the "Ove' Glove." The night I moved in, we made pizzas and the Ove' Glove was the source of much entertainment and complaints, as it appeared to be a very good conductor of heat instead of an insulator. Whoops.

To remedy this, a two weeks ago at my birthday party my friend Cassandra decided it would be a great gag gift idea for everyone to bring oven mitts for me. As a result, I am now in possession of 16 oven mitts, ranging in colours, sizes, and materials.

So on this, the anniversary of me moving in, I've decided to work with these oven mitts the way that I know best: test them and write a report.

My set-up was pretty basic - I made a system to hold the oven mitt a fixed distance away from a medium-heat element, stuck a meat thermometer inside, and took heat measurements for up to ten minutes. A check without oven mitts showed that this setup subjected the oven mitts to a temperature of approximately 70 degrees.

Test Setup (highly technical)
 So without further ado, I present to you my rankings for oven mitts from worst to best. Starting with:

#9 Blue Mitts of Death


  • Brand: Dollar Store
  • Value: $3
I suppose at this point it's worth pointing out exactly how I'm ranking them. First and foremost, I'm looking at how long it takes the mitts to actually burn you. According to this source, 55 degrees is hot enough to give second-degree burns after 17 seconds. Holding onto a 70 degree heat source, this means you'd burn your hand in less than 5 minutes using this oven mitt. Sure, that's not how normal people use these, but hey - you gotta compare them somehow. Since these have the highest potential for burning, I rate them the worst.

#8 Pink, Flowery, and Painful



  • Brand: Dollar Store
  • Value: $2.50
Though these are by far the prettiest, they're also quite deadly. If my hand had been in them for the experiment, I would have gotten a burn about 5:20 into the test. Not nice. It's also worth pointing out that throughout all tests, these oven mitts got the closest to 70 degrees (67.6 after 10 minutes). Yikes!

#7 Black Cuisinart


  • Brand: Cuisinart
  • Value: $15.95
Hilariously, I got these as a Christmas present from my parents before any of these birthday shenanigans went down. Sadly, they're also apparently the type of oven mitt that likes to burn your hand off. Their redeeming factor is that they only increased in temperature 1.2 degrees within the first 30 seconds of the test, which is more than enough time for most oven extractions. Would likely have burned my hand about 5:40 into the test.

#6 Green Silicone

  • Brand: Ming Wo (?)
  • Value: $9.99
Man, these silicone ones look so fancy, but really like burning your hands to crisps. This is very similar to #7, in that it has one of the lowest heat gradients at first, but by 7 minutes into the test would have made you very unhappy. I'm sure there's some materials science point to be made here, but that would involve actual science.

#5 Languages of Pain


  • Brand: Dollar Store
  • Value: $2.50
Awesomely enough, I got two pair of these for my birthday. These were pretty decent for a language lesson, but woulda burned your hands at about 7:20 into the test. An excellent example of Dollar Store quality oven mitts holding their own against their expensive counterparts though...

Here are pretty graphs of the worst five oven mitts:

Again, the pink and blue oven mitts both had high initial rates of heat pickup, and ended up with the highest heats (the ranking order is a bit different from the graph because I tested the pink one on a colder day. I know, terribly unscientific of me...). The silicone mitts did much better for the first two minutes, but then took on heat at a similar rate to everyone else. Tsk tsk. 

The rest of the mitts happily didn't ever hit 55 degrees within their tests, so I'll rank them based on their total heat gain over the 10 minutes:

#4 The Ove' Glove


  • Brand: No clue
  • Value: $18.99
In a stunning come-from-behind near-podium finish, the Ove' Glove turns out to be a contender! And if you don't believe me, check out this totally awesome super cool consumer video (sarcasm). The Ove' Glove gained heat at an average rate of 2.95 degrees per minute - not shabby!

#3 The Alien

  • Brand: Dollar Store
  • Value: $2
Put this sucker on your hand and you've got great alien chestburster puppet! Alternatively, use it to take hot things out of an oven and not burn yourself. By far the best bang for the buck, somehow it combines the silicone and fabric and makes a decent oven mitt, gaining an average 2.82 degrees per minute.

#2 Better Barbeque

  • Brand: CTG Brands
  • Value: Weight in gold?
Wowza. This one is hefty, basically goes up to my elbow, and can hold its heat, only gaining an average of 2.66 degrees per minute. Very nice. These also won the contest for lowest heat pick-up in the first minute, and didn't even register a temperature change until 30 seconds into the test. 

#1 President's Choice

  • Brand: PC
  • Value: 7 unicorn hairs?
These guys were the bomb, only gaining 2.61 degrees per minute. They're also flexible enough to use regularly, unlike the silicone ones. 
Graph of the top 4 oven mitts:


Again, some very smooth curves here. The CTG oven mitt was by far the steadiest heat increase, but lost out to the PC mitt over the full length of the test. I know that my ranking has been more-or-less arbitrary this whole time, but I'm comfortable with declaring the CTG mitt to be my favorite (because really, who uses a mitt for 10 minutes at a time?).

Thanks again to everyone for pitching in on the oven mitt present. I hope I've used them in an appropriate manner! 

Wednesday, August 13, 2014

Mud Heroes Aren't Normal

Last weekend I went ahead and did something I never thought I'd do: the Mud Hero race down in Red Deer.

Mud Hero, for those of you who are blissfully unaware, is a crazy obstacle course/race/endurance sport/mud bath and spa/general day of chaos that follows in the ever-growing trend of mud runs for the athletically-inclined. There are dozens of similar events to this around Canada each summer, and the Mud Hero appears to be one of the most popular with over twelve thousand participants over the three days of heroing in Red Deer last weekend.

The event attracted people from all backgrounds and fitness levels, and has likely inspired wonderful stories of perseverance, raising money for charity, and teamwork through adversity. To all this, I say nonsense. The most interesting part of the Mud Hero is the statistics, and, much as though readers of this have likely figured out already, the inescapable conclusion that Mud Heroes just aren't normal.

In an attempt to ostensibly appear as much like a legitimate race as possible, all participants were given timing chips to track their racing - and all results are posted online for people to show to their friends and family and brag about just how slowly they trudged through the muck. Since this involves thousands of numbers, it's pretty easy to salivate over the possible statistics of said numbers. So I did. Here's a graph of everyone who ran on the last day of the Alberta Mud Hero:



Right off the bat that may look quite like a normally-distributed bell curve - there's certainly a lovely peak right around the middle, and it tends to taper off at either end. The reported average time for the course was 1:25:22 (85 minutes), and that seems to be reasonably around the middle of the peak.

It isn't just enough to assume that that's a normal distribution though - a normal distribution is a rather precisely defined curve that doesn't necessarily include all bell-like shapes. The results from Sunday's Mud Hero had a mean of 85.37 minutes and a standard deviation of 29.90 minutes - as these are the two parameters you need to develop a normal distribution curve, we can compare Sunday's results to the normal assumption and get the following:



That's not really all that close at all. These are two bell curves that have the same mean and standard deviation, but are not identical, leading to the fun conclusion that Mud Hero runners are not normal (well, normally-distributed at least). Mud Heroes tend to be positively skewed (the mean is higher than the median), and have shorter and bounded tails.

This isn't really all that surprising - in fact a normal distribution would have been surprising as there are necessarily cut-offs to the data (nobody can do the race faster than 0 minutes, for instance), and it was a relatively short race. Often people tend to view all bell-shaped curves as normally-distributed, even though there are an incredible amount and diversity of probability distributions out there.

So Mud Heroes aren't normal. What else can we learn from the data? Fortunately the results are broken down into genders, ages, and hometowns, so let's look at those!

First of all, gender:


Fascinatingly enough (for an event whose purpose is explicitly to get dirty), women outnumbered men 2 to 1! That's pretty awesome. A quick Analysis of Variance test shows that the men were statistically significantly faster than the women were this time around though, which I suppose is the trend in races like this. Shame...


Bam. Age graph. I'm not entirely sure why the men aren't as consistent as they age, but then again, who is? (marriage joke)

And finally, home city:


Turns out there's no reasonable statistical difference between participants from Red Deer, Calgary, and Edmonton. These box plots for their results suggest they have almost identical distributions for time, and an ANOVA test suggests that they can all be considered to be drawn from the same population. So really, even though the average time for Calgarian Heroes was two minutes faster than Edmontonian heroes, it's not significant enough for them to brag. So ha!

All in all though, Mud Hero was definitely a fun experience. If you're looking for a good excuse to get tired and muddy, I'd highly recommend it for next year!

Friday, July 4, 2014

Optimizing your Coffee Fix

Canadians like their coffee. In fact, the average Canadian drinks 55% more coffee per day than the average American, and Canadians are ranked 9th in the world for overall coffee consumption. Because of this, it's hardly a surprise that coffee shops are literally all over the place in Canadian cities.

Pretend for a moment that you're out and about in Edmonton one day, and absolutely need your coffee fix. So badly, in fact, that you're only willing to travel the absolute shortest possible distance to your nearest Tim Hortons or Starbucks (Canada's two most popular coffee shop chains). If you made a map of the city based on where the nearest Tim Hortons is, it would look something like this:

Similarly, a map based on where the nearest Starbucks is would look like this:

(If your browser doesn't like Google maps, check out images of the maps for Tim Hortons and Starbucks. Please note that the maps are only as accurate as Google's knowledge of the world is.)

These are called Voronoi diagrams, which split up the city based on where the closest relevant coffee shop is. Each region corresponds to a single coffee shop, and everywhere within that region is closer to that coffee shop than any other.

It turns out that Edmonton has about one Tim Hortons for every 10,000 people, and about half as many Starbucks. Not too surprisingly, coffee chains tend to be clustered quite a bit downtown and near the U of A campus, leaving the industrial parks to the east rather desolate and missing out on a good brew. The extremely even distribution of Tim Hortons locations in Sherwood Park seems a bit too good to be true, though.

Apart from helping you out with your coffee purchasing optimization, Voronoi diagrams actually do have plenty of real uses. Diagrams like this were famously used in 1854 to show that residents who lived closest to one particular well were dying of cholera, which lead to the discovery that diseases can be spread by contaminating water.

In the case of coffee shops in Edmonton, they can be helpful in city planning or for businesses choosing where to establish new franchises. And, of course, if your caffeine priorities are straight, they can help you get the fastest fix.