Wednesday, January 30, 2013

Ranking every possible super bowl matchup (and then some)

For those of you paying attention to sports in any way whatsoever you may have noticed that the super bowl is coming up this weekend.  It's pretty easy to find a wide array of articles and analysis about it, and a week or two ago I came across an article at the bleacher report with the title:

Ranking Every Possible Super Bowl Matchup
( )

I was excited by the title because I thought this was going to be a ranking of *EVERY* super bowl matchup between every team to figure out which team would actually be the strongest, and not just a simple rundown of what the situation was from this point onward.

Since that was a disappointment, I figured I'd just do it myself.  Right?

Well, it's easy enough (if not a touch tedious) to pull down the scores from every game of this season.  Luckily, the NFL plays a relatively small number of games so it's a fairly reasonable set of data.  At most a team will play another team twice, so we can produce a somewhat odd 32x64 partially filled matrix containing all the win information in one direction and the loss information in the other direction.

The important thing that this allows us to do is to calculate some means and standard deviations.  Specifically, we can check out the mean score of each team both from an offensive and defensive standpoint.  The offensive score is the score that team was able to produce, and a higher score should indicate a better offense.  The defensive score is the score that the team allowed the other team to produce, and a lower score should indicate a better defense.

Right off the start this gives us some good numbers to check out - what teams performed the best and worst throughout the season as well as how consistent given teams were.

The Patriots showed the best offense this year, coming in just over 34 points a game on average.   

The worst team?  Sorry, Kansas City Chiefs fans.  Do I have any readers who are Kansas City Chiefs fans?  Sorry, your offense only produced a little over 13 points on average.

The best defense goes to the Seattle Seahawks, only right around 15 and a quarter points per game allowed on average, and the worst defense goes to the New Orleans Saints, allowing on average just over 28 and a quarter points per game.

If we compare the average points of every team against every other team we can get a feel for what their records would have been if a) every team played every other team once and b) every team had the same defense.  Obviously one of those is a bit larger of a jump, but let's keep an open mind for the moment.  This is how things would work out:

Team (offense) Count wins Count losses
New England Patriots  31 0
Denver Broncos  30 1
New Orleans Saints  29 2
New York Giants  28 3
Washington Redskins  27 4
Green Bay Packers  26 5
Atlanta Falcons  25 6
Houston Texans  24 7
Seattle Seahawks  23 8
Cincinnati Bengals  22 9
Baltimore Ravens  21 10
San Francisco 49ers  20 11
Tampa Bay Buccaneers  19 12
Minnesota Vikings  18 13
Dallas Cowboys  17 14
Detroit Lions  16 15
Chicago Bears  15 16
Carolina Panthers  13 17
Indianapolis Colts  13 17
San Diego Chargers  12 19
Buffalo Bills  11 20
Pittsburgh Steelers  10 21
Tennessee Titans  9 22
Cleveland Browns  8 23
St. Louis Rams  7 24
Oakland Raiders  6 25
Miami Dolphins  5 26
New York Jets  4 27
Philadelphia Eagles  3 28
Jacksonville Jaguars  2 29
Arizona Cardinals  1 30
Kansas City Chiefs  0 31

Due to the way this works out through mean comparisons, this is actually a ranking of how every team would do in a super bowl against every other team.  The Patriots would beat anyone, the Broncos would beat everyone but the Patriots, etc.  

We can find the probabilities (roughly) associated with this actually being the outcome by taking into account the stability of those means via their standard deviations.  A proxy for this that I'm calling good enough for our immediate purposes is the probability associated with t-tests between these individual means.  The product of these reversed probabilities (due to the fact that a win or loss is more probable when the p-value is small; e.g. .02 should actually be .98) gives us something we can put in a table.  YES I KNOW I'M KIND OF BUTCHERING THE POINT OF P-VALUES. 

Some of these numbers are actually reasonably finite, and we can add to the above table as such:

Team (offense) Count wins Count losses Probability of occurrence
New England Patriots  31 0 0.47089515
Denver Broncos  30 1 0.019777304
New Orleans Saints  29 2 0.000572806
New York Giants  28 3 6.88355E-09
Washington Redskins  27 4 1.22143E-07
Green Bay Packers  26 5 2.99026E-08
Atlanta Falcons  25 6 7.57896E-08
Houston Texans  24 7 8.88084E-10
Seattle Seahawks  23 8 4.09893E-11
Cincinnati Bengals  22 9 1.49184E-09
Baltimore Ravens  21 10 5.36586E-12
San Francisco 49ers  20 11 1.34842E-11
Tampa Bay Buccaneers  19 12 1.50215E-10
Minnesota Vikings  18 13 1.74783E-09
Dallas Cowboys  17 14 4.93673E-10
Detroit Lions  16 15 7.0116E-10
Chicago Bears  15 16 4.6336E-12
Carolina Panthers  13 17 0
Indianapolis Colts  13 17 0
San Diego Chargers  12 19 3.8835E-10
Buffalo Bills  11 20 3.40025E-09
Pittsburgh Steelers  10 21 6.20755E-07
Tennessee Titans  9 22 1.45213E-08
Cleveland Browns  8 23 1.73087E-06
St. Louis Rams  7 24 1.08623E-06
Oakland Raiders  6 25 2.8135E-07
Miami Dolphins  5 26 1.65687E-07
New York Jets  4 27 2.73281E-08
Philadelphia Eagles  3 28 1.04094E-06
Jacksonville Jaguars  2 29 0.000267479
Arizona Cardinals  1 30 0.000383025
Kansas City Chiefs  0 31 0.137665451

You can see that things sort of follow an upside down bell curve (let's call it a valley curve) - the most probable outcomes are those at the ends, while those in the middle have a bit more noise in them.  More of those middle games are likely to be close enough to drop the cumulative associated probabilities.

What we should keep in mind is that there are a lot of potential outcomes here.  There aren't just 31 (31-0 down to 0-31), but every possible combination of individual wins/losses that would get you to that point.  There's only one way to get 31-0 or 0-31, but there are 31 ways to go 30-1 or 1-30 (you could win or lose to any given team, and each of those has a probability associated with it).  If you'd like to kill a bit more time before you get back to work you can start working out the number of ways you can get to each potential outcome.  It also explains at least a little bit of the valley curve that we have going. 

Yes, the clever among you might have just realized that this table is excluding some potentially important information.  This probability isn't the cumulative probability of all situations that would produce a given outcome, but rather the probability associated with the most likely sequence that would produce that outcome.

For example, the Broncos going 30-1 is actually the probability of the Broncos going 30-1 while losing to the Patriots.  There's another probability that they'd go 30-1 while losing to the Giants, or the Saints, or even the Chiefs (the probability of them just losing to the Chiefs *at all* in this metric is 4.57E-07; fairly unlikely).

There's also a strange coincidence here that you might notice - the Panthers and Colts actually produced the same mean score throughout the season.  There's an interesting discussion to be had about how the way points are earned (in chunks) allows this, but it's for another day.  We'll see it happen a few more times when we get to defense.

Overall these probabilities don't really instill a lot of confidence (except for the Chiefs - sorry again Chiefs fans).  We have to keep in mind that this is simply offense, and doesn't consider how difficult any teams' defense might have been.  Now that we've seen how this works we can also produce the same table based on the idea that a) every team plays every other team once and b) every team has the same offense.

Such a situation would mean that a team's defense was the only way to stand out, and we can produce the same table based on how things would play out from there:

Team (defense) Count wins Count losses Probability of Occurrence
Seattle Seahawks  31 0 0.033645703
San Francisco 49ers  30 1 5.72087E-06
Chicago Bears  29 2 3.03016E-05
Atlanta Falcons  28 3 7.53205E-07
Houston Texans  27 4 0
Miami Dolphins  26 5 5.97182E-10
Denver Broncos  25 6 4.65242E-06
Cincinnati Bengals  24 7 1.68938E-11
Pittsburgh Steelers  23 8 5.27437E-11
New England Patriots  22 9 0
Green Bay Packers  21 10 3.75177E-13
St. Louis Rams  20 11 1.21268E-13
Baltimore Ravens  19 12 0
Arizona Cardinals  18 13 5.77952E-13
Minnesota Vikings  17 14 1.17577E-13
Cleveland Browns  16 15 5.5051E-11
Carolina Panthers  15 16 2.73832E-11
San Diego Chargers  14 17 1.6091E-12
New York Giants  13 18 0
New York Jets  12 19 1.07632E-10
Indianapolis Colts  11 20 9.97422E-12
Washington Redskins  10 21 2.72878E-09
Tampa Bay Buccaneers  9 22 6.3485E-09
Dallas Cowboys  8 23 3.63465E-07
Kansas City Chiefs  7 24 9.21125E-08
Buffalo Bills  6 25 7.97968E-11
Tennessee Titans  5 26 2.93401E-05
Philadelphia Eagles  4 27 0
Jacksonville Jaguars  3 28 0
Detroit Lions  2 29 8.82456E-09
Oakland Raiders  1 30 5.65719E-11
New Orleans Saints  0 31 1.93842E-07

The same things about the other charts apply to this one, though it also gives us a picture of how strong different teams' defense was.  Unfortunately, this is also confounded with the fact that different defenses played different offenses.  We could simply look back at offenses, but those were already confounded by the fact that different offenses played different defenses.  You can see we're in a bit of a loop here.

While we're trying to think our way out of that one we can kill some time by taking a look at the average quality of defense that different teams faced throughout the season.  We can do this by averaging - for each team - the average points allowed by their specific list of opponents.   The more points that your list of opponents allowed, the easier it is to score points against them.

Team Opponent Defense
Atlanta Falcons  24.5025641
Pittsburgh Steelers  23.89198718
Cleveland Browns  23.5650641
Tampa Bay Buccaneers  23.50737179
Cincinnati Bengals  23.5025641
Indianapolis Colts  23.46634615
San Diego Chargers  23.40865385
Philadelphia Eagles  23.07948718
Jacksonville Jaguars  23.04807692
Houston Texans  22.96634615
Kansas City Chiefs  22.93269231
Baltimore Ravens  22.91121795
Carolina Panthers  22.88717949
Miami Dolphins  22.88461538
New Orleans Saints  22.86794872
Denver Broncos  22.81730769
Washington Redskins  22.81025641
Chicago Bears  22.76217949
New York Giants  22.67083333
Green Bay Packers  22.60576923
Oakland Raiders  22.55288462
Minnesota Vikings  22.53846154
Tennessee Titans  22.49038462
Buffalo Bills  22.46153846
New England Patriots  22.19230769
New York Jets  22.17788462
Seattle Seahawks  22.07467949
San Francisco 49ers  22.06730769
Dallas Cowboys  21.94230769
Detroit Lions  21.85576923
St. Louis Rams  21.62980769
Arizona Cardinals  21.39903846

Turns out things are actually pretty close when it gets to this level.  The Falcons faced the easiest defenses, with their average opponent allowing 24 and a half points.  The Cardinals - perhaps not enough to account for their fairly weak season - faced the most difficult defenses.

We can look at the same concept in terms of how well defenses performed against their opponents' offenses:

Team Opponent Offense
Arizona Cardinals  23.18269231
Atlanta Falcons  22.5599359
Baltimore Ravens  23.43974359
Buffalo Bills  20.9375
Carolina Panthers  23.58397436
Chicago Bears  22.27403846
Cincinnati Bengals  21.35801282
Cleveland Browns  22.59358974
Dallas Cowboys  23.9974359
Denver Broncos  23.49519231
Detroit Lions  22.05769231
Green Bay Packers  22.73301282
Houston Texans  23.25
Indianapolis Colts  21.77403846
Jacksonville Jaguars  23.12019231
Kansas City Chiefs  23.48557692
Miami Dolphins  22.0625
Minnesota Vikings  22.62980769
New England Patriots  21.67307692
New Orleans Saints  23.35801282
New York Giants  23.96634615
New York Jets  22.07211538
Oakland Raiders  22.34615385
Philadelphia Eagles  23.73301282
Pittsburgh Steelers  21.9974359
San Diego Chargers  22.38461538
San Francisco 49ers  23.44455128
Seattle Seahawks  22.56730769
St. Louis Rams  23.55288462
Tampa Bay Buccaneers  22.97339744
Tennessee Titans  22.73557692
Washington Redskins  23.25224359

At this level of aggregation we again seem to be washing out all useful variance.  

Overall, I'm not sure there's really enough variance here to warrant the meaningful inclusion of it unless things are really pretty close.

Speaking of close, we should at some point probably try to figure out who is going to win the *actual* super bowl.  One last combination before we get to that.  We might be able to get a little more out of offense and defense if we look at them in combination.  We can do this by combining the win/loss records for each team to produce a table like this:

Team (overall) Wins overall Losses overall
Denver Broncos  55 7
Seattle Seahawks  54 8
Atlanta Falcons  53 9
New England Patriots  53 9
Houston Texans  51 11
San Francisco 49ers  50 12
Green Bay Packers  47 15
Cincinnati Bengals  46 16
Chicago Bears  44 18
New York Giants  41 21
Baltimore Ravens  40 22
Washington Redskins  37 25
Minnesota Vikings  35 27
Pittsburgh Steelers  33 29
Miami Dolphins  31 31
New Orleans Saints  29 33
Carolina Panthers  28 33
Tampa Bay Buccaneers  28 34
St. Louis Rams  27 35
San Diego Chargers  26 36
Dallas Cowboys  25 37
Cleveland Browns  24 38
Indianapolis Colts  24 37
Arizona Cardinals  19 43
Detroit Lions  18 44
Buffalo Bills  17 45
New York Jets  16 46
Tennessee Titans  14 48
Kansas City Chiefs  7 55
Oakland Raiders  7 55
Philadelphia Eagles  7 55
Jacksonville Jaguars  5 57
Looks like that helps to put a bit more spread on things, though our apparent best teams aren't the ones in the super bowl.  Not shocking, as randomness can really play havoc with things when you play so few games and leave playoffs and finals up to single elimination matches.  While I'd be a bit more excited to watch a super bowl between the Broncos and the Seahawks (or the Bears and the Jaguars), that's not what we have this year.  
The Ravens and 49ers - going back to the earlier table - put up the 11th and 12th best offenses on average.  They're actually pretty close on that metric - the Ravens averaged 24.875 points per game, while the 49ers averaged 24.8125 points per game.  Given that their pooled standard deviation on those means is 11.70 points there's very little reason to believe that one of these teams has a substantially (or statistically) better offense.

The 49ers scored less than a tenth of a point less than the Ravens on average, though they also faced slightly more difficult opponents.  Their opponents allowed 22.0673 points on average, while the Ravens' opponents allowed 22.9112 points on average.  While this might allow us to tip things *a little* more in favor of the 49ers I'd still be hesitant to say that anything was even close to a sure thing.  I've thought about it a while and don't know if I have any meaningful way to combine points earned and points allowed by specific opponents.  

Let's take a look at defenses - the 49ers did hold up to some of the early promise of a good defense by coming up as the 2nd best, allowing only right around 17 points on average.  The Ravens were somewhat in the middle of the pack, coming up as 13th best defense with right around 21 and a half points on average.

Remember where we got caught in a loop a while ago?  One of the problems was that we had offense and defense to worry about, though at least for this pairing it seems the offenses are pretty close.  The small point difference is also offset by the difference in opponents.

If defense is where the difference is it's hardly enough to be impressed by - the difference in defensive strength is 4 points, while the pooled standard deviation is just under 11 points.

The slight advantage held by the 49ers is also shown in that last table, as they show up as 6th overall while the Ravens come in at 11th.  Even this spread isn't huge, as it's partly due to the fact that a lot of teams are actually incredibly close in terms of mean points scored or allowed.  Forcing things into wins/losses allows for sorting, but carries a lot of error in these close match-ups that could have gone either way.  Let us keep in mind that the teams that are coming up on the top of our charts didn't have perfect seasons, but the games they lost they may have lost by very slim margins. 

All in all I was hoping that one of these teams would have meaningfully distinguished themselves on something, but it seems that these two teams in the super bowl really are pretty close - at least by the numbers.  If pushed it would seem that the 49ers have a slight edge, but what that relates to in terms of a point spread is pretty tricky.  If the 49ers are able to put up a defense that's able to stop 4.5 more points than the Ravens, and both play basically the same offense (with perhaps a slight advantage to the 49ers), then we're talking about less than a one possession spread.  Four to five points is right in that range of being just covered by a touchdown but not covered by a field goal.

If I had to make some guesses, then, the best things to work from are the scores we've seen so far - offensively 24.8125 vs 24.875 points per game, defensively 17.0625 vs 21.5 (49ers and Ravens, respectively).  Opponents of each team also gave up 22.0673 vs 22.9112 points on average, scored 23.4446 vs 23.4397 on average.

So, if team A is trying to score x points and team B is trying to hold team A to y points, the relative importance of offense vs defense would dictate the weighted average that is most accurate.  Given no reason to assume anything else I'm just going to call it an even split and take a normal average.  What that would mean is that the most likely score of this super bowl (still probably pretty unlikely) would be 23.15625 to 20.96875, 49ers.  Okay, so that score is not just unlikely, but impossible.  Silly imprecise sports. 

You might be going straight to the comments to point out that you can't earn 0.00005 points in a game of *normal* football.  More important is the fact that even the rounded score of 23-21 might not be the most common.  If we head back over to my favorite historical archive of all football scores ever ( ) we can see that there have only ever been 46 games with an outcome of 23-21.  Given the amount of error we're playing with here I'm willing to take this prior information into account to some degree, especially given the fact that the *very* similar score of 23-20 is over three times as likely as 23-21.

In all, my best guess would be that the scores are pretty close, and somewhere in the low 20s both.  The 49ers seem to have a slight edge, but it's football and they only get to play one game.  Repeat this super bowl 100 times and then we can talk.

More than anything, it seems that this super bowl might actually be a close game.  I say that's always what I want, sooooooo I guess I'd better watch it.

Maybe I'll record it so I can get rid of the stupid commercials. (<- flame baiting)

Here are the raw numbers for points scored and points allowed as requested in the comments.

Team Points scored Points allowed
Arizona Cardinals  15.625 22.3125
Atlanta Falcons  26.1875 18.6875
Baltimore Ravens  24.875 21.5
Buffalo Bills  21.5 27.1875
Carolina Panthers  22.3125 22.6875
Chicago Bears  22.5625 17.3125
Cincinnati Bengals  25.0625 20
Cleveland Browns  18.875 23
Dallas Cowboys  23.5 25.53333333
Denver Broncos  30.0625 18.0625
Detroit Lions  23.25 27.3125
Green Bay Packers  27.0625 21
Houston Texans  26 20.6875
Indianapolis Colts  22.3125 24.1875
Jacksonville Jaguars  15.9375 27.75
Kansas City Chiefs  13.1875 26.5625
Miami Dolphins  18 19.8125
Minnesota Vikings  23.6875 20.875
New England Patriots  34.8125 20.6875
New Orleans Saints  28.8125 28.375
New York Giants  27.46666667 21.5
New York Jets  17.5625 23.4375
Oakland Raiders  18.125 27.6875
Philadelphia Eagles  17.5 27.75
Pittsburgh Steelers  21 20.25
San Diego Chargers  21.875 21.875
San Francisco 49ers  24.8125 17.0625
Seattle Seahawks  25.75 15.3125
St. Louis Rams  18.6875 21.75
Tampa Bay Buccaneers  24.3125 24.625
Tennessee Titans  20.625 29.4375
Washington Redskins  27.25 24.25

Wednesday, January 23, 2013

Multiple Choice Questions and Trivial Pursuit OR Sig Figs and 'Educated' 'Guessing'

Over the holidays I happened to be playing Trivial Pursuit with some friends.  I don't play Trivial Pursuit that often, and this was a different version than I've played before.  For reference, it was the Trivial Pursuit: Master Edition.

The edition of Trivial Pursuit I have sitting around somewhere is getting kind of old, and it's definitely what I base my Trivial Pursuit worldview on.  Unlike this old version, this Master Edition had a decent number of multiple choice questions come up.  Some were quite easy, and some were tricky but still offered a good chance at guessing them right.

A few questions came up with numbers in them, and the idea was floated that one way to potentially tell the correct answer (if you knew nothing else) might be to look for the numeric choice that had the greatest number of significant figures.

Some of you might be right there with me, but some of you might have just stalled out, so let's have a quick discussion of significant figures.

Put simply, significant figures are a implicit (or explicit) conveyance of a number's precision.  From a scientific standpoint there are a number of very important rules regarding significant figures and how to treat and convey them.  For our purposes we can deal with the more perceptual nature that you might recognize in your day to day use.

The thing that's consistent across both of these standpoints is that significant figures are all the digits of a number that are not: a) non-notated leading or trailing zeros (e.g. all the zeros in the number 10,000; none of the zeros in 1,000,001) or b) some other number that only came about through a derivation of a bunch of those leading or trailing zeros.  For example, the number 500 has one significant digit - the five.  If we divide that by 2 we would seemingly pick up another significant figure by arriving at 250.  If we divide by 3 we get seemingly infinite significant figures by arriving at 166.66666(repeating).

It doesn't work that way, and if you're so inclined I'd suggest reading up on scientific significant figures and calculations involving significant figures.  There's no need to get that deep into it today, so we'll finish this part with a perceptual example.

Imagine that you're wondering how many people there are in the United States.  You go to a friend and ask them if they know how many people there are, and they say 300,000,000.  What does that mean to you?

Well, my read of that situation is that your friend only really has confidence in the hundred millions digit of population.  They have confidence in the precision of that 3(hundred million), but maybe not in any of the other, smaller digits.

Feeling like this friend doesn't know their stuff you find another friend, and they say that the population of the United States is 311,000,000.  This friend might instill in you a bit more confidence, as they've implicitly given you a better sense of precision by giving you two more digits than your first friend.

You're still not happy with the answer from this friend and find a third.  They're spending more time on their smartphone than they are paying attention to you, and when you ask the question they take a moment of typing before they answer: 311,591,917.  They then go back to not paying attention to you.

This friend has - correct or not - given you much more precision in their number than either of your first two friends.  They have done this, in part, by giving you 9 significant figures instead of only 1 or 3.

The idea as it relates to Trivial Pursuit is the idea that correct answers inherently have more significant figures, as they are actual quantities, and wrong answers may have less.

Well, it's testable, so let's take a look.

I was able to code some data from the cards relating to every multiple choice question asked in Trivial Pursuit: Master Edition.  It turns out that there are 245 of these questions in the game.

245 is a pretty nice number, but not all those questions involve numbers.  In fact, numbers are the minority - the vast majority of questions simply involve word choices.  There are 36 multiple choice questions involving count numbers, and an additional 6 involving percentages.  This unfortunately doesn't give us a whole lot to work with in terms of significant figures, but there's other things we can look at in a bit.

It's also the case that the overwhelming number of cards with numbers on them have numbers which all have the same number of significant numbers.  I mean figures, significant figures.  Overall, there are only 10 questions which have a difference we can examine.  These ten cards have answers in numeric form, and there is a difference between significant figures between the correct answer and the other answers.

These are the cards where we can test out if more significant figures mean better answers.

Well, it doesn't seem to.  Of those 10 questions, 9 of them actually have a correct answer which has less significant figures than at least one of the other options.  In only one case does the correct answer have more significant figures than the other answers.

This might mean that the folks over at Hasbro are on to your clever tricks.  They may have set this up on purpose to trip up exactly the type of logic we've just laid out.  There's other places we can look, though - there are a lot of other multiple choice questions. 

In fact, there are two main types of word questions.  There are questions that ask you to pick the correct answer from a number of choices, and there are questions which ask you to pick the answer that is 'NOT' something, or that fits the idea of all of these 'EXCEPT'.

The most common question is the first type, and those of them with three response options to choose from - there are 93 of these questions.  So is there any information we can use to make better guesses in these situations?

Well, it's pretty straightforward in this case, too.  The numbers are really close - the first option is correct 30 times, the second was correct 29 times, and the third was correct 34 times.  If you have absolutely no idea you do have slightly better odds selecting the third choice, though the gains you get from it aren't very large.  These numbers don't significantly deviate from an even split. 

Fortunately, things get a little more interesting as we move on to some of the other questions.

So far we've covered questions with numeric answers, and word questions looking for the correct answer among three answer choices.  There are also some multiple choice questions with four answer choices.

For those questions, the breakdown seems a bit less random.  In fact, of 22 questions, in an even half of them (11) the second answer choice is the correct answer.  The first and last options are the least likely, with each being correct 3 times, and the third option is only a little better - it's the correct choice 5 times.

While the low number of these questions stops us from saying too much on a statistical side (if we wanted to perhaps generalize to other Trivial Pursuit games?), these numbers do give a bit of an advantage to the player forced to guess on one of these questions.  With no other credible information it makes sense to guess the second option any time four are presented for this version - you'll be right by chance half the time.  If you can eliminate one of the other choices you're going to be above 50/50 odds. 

Let's move on to those questions where you're asked to pick the answer that is 'NOT' or 'EXCEPT' something.  There aren't many of those with only three answer choices - 14 in total.  Your odds increase slightly as you move from the first to last choice - the breakdown of times each are correct is 3/5/6.

'NOT'/'EXCEPT' questions with four answer choices are a bit more plentiful, with 46 in total.  You'll again do a bit better going with later answers if you're randomly guessing.  The breakdown in this case is 7 for the first response, 11 for the second response, 11 for the third response, and 17 for the fourth response.

That's not to say that always choosing based on these numbers is going to always get you a correct answer - in the best situations this knowledge might buy you 50/50 odds (in the case of regular questions with four responses).  There's only 22 of those questions out there, which is only about a tenth of even just the multiple choice questions.  Those questions might be a tenth of the total questions in the game, so you're down in some pretty small territory.  You also have to be playing *this* specific build of Trivial Pursuit, so the help actually seems fairly limited.  Help is still help, though, I suppose.   

That is - of course - unless the people you are playing with *also* read this blog, in which case I would advise them to switch around the answer that you read out the answers to these multiple choice questions.  Then you get into some interesting rock-paper-scissors territory, which is something that I should talk about some other week.  

Wednesday, January 16, 2013

This one is about Halo 4 (but also about the association of nominal dichotomous variables)

If you follow video games - and even if you don't - you may have heard of the Halo series.  Halo 4 came out recently, and I've been playing a bit of it.  It's a good game, though that's not really what we're here to talk about today.

The Halo series has always been pretty good at keeping very detailed statistics for everything you do in the game, and Halo 4 is no exception.  The website Halo Waypoint allows you to access a ton of great information about how you've been playing the game.

Now, a major component of Halo 4 is the multiplayer aspect.  Much of the time I spend playing is playing online with friends - in fact, using the game to keep in touch with distant friends is a big part of playing.  There are a number of different game types you can play, and there are also a number of different maps that you can play on.

While playing with different friends I started to notice an odd trend in one game type on a certain map.  Specifically, for those who care, the game type that seems to be producing these odd trends is the objective-based game type of dominion.  When a game is being set up, the way things work is that a number of players are found, and then those players vote on a map to play on.  Once the map is selected, Halo divides the players into teams, assigns them to either red team or blue team, and then starts the game. 

What I started to notice - and initially joked about - was the fact that while I was playing with one friend in particular we would always be placed on blue team on a certain map.  Let's call that friend Brad.  That map - again for those who care - is the map called Longbow.

This started as a joke, but as things progressed it started to seem more and more true that being in a group with Brad meant that the game would always assign us to blue team while playing dominion on Longbow.  This assignment is (seemingly) random, and completely out of our hands.

Like I mentioned, Halo Waypoint allows you to pull down a whole lot of stats about what you're doing in the game.  It was fairly easy to go in to my play history and pull out all the games of dominion that I have played on this map.  I was then able to sort these into games on two criteria: where I was playing with this particular friend and those where I wasn't, and if we were on blue team or red team.

What this produces is a two by two table that looks like this:

With Brad Without Brad Totals
Red Team 2 14 16
Blue Team 14 10 24
Totals 16 24 40

This is called a contingency table, and represents the multivariate frequency distribution of these variables.  Each game can (and must) have one of two values on each of these two variables.  In every game we have to be placed on either red or blue team, and in every game Brad is either there or he isn't.

These variables are special in that each of them has only two values that they can take.  Variables of these type are a special type of nominal categorical variable called dichotomous variables, based on the two values that can be taken.

If you have two dichotomous variables there are a few tests that can be used to look at the relationship between those variables.  What we're going to use today is Fisher's exact test.

This test was devised by R.A. Fisher back in the 1920s.  Anecdotally, he devised this method to test a colleague who claimed that she was able to tell by taste whether the milk or tea was added first to a given cup of tea (a seemingly difficult claim).  Fisher proposed that he would give her eight cups of tea - four of each type - prepared and presented in random order.  The woman (Dr. Muriel Bristol) was able to successfully identify all cups correctly.

Regardless of how successful she was, you can imagine producing a contingency table of this data.  For her specific case it would look like this:

Says Milk First Says Tea First
Actually Milk First 4 0
Actually Tea First 0 4

Long story short, this data can be analyzed with a Fisher's exact test.  A significant result means that there is a relationship between the two variables such that information about one provides you with better than random information about the other.  In the case of the lady tasting tea (as the experiment is known), there is a relationship between what Dr. Bristol said and what was actually the case.  In fact, there is a perfect relationship in this case - each of the 4 times that she said milk was added first the milk was actually added first, and each of the 4 times that she said tea was added first the tea was actually added first.

The lady tasting tea experiment data is significant, but what about our Halo data?   

Well, it's significant too, actually.  If you want to try it yourself there's a good online calculator here:

In order for this to be statistically significant we're looking for a p value below 0.05.  Our p value in this case is actually 0.0074, below 0.05 and thus significant at that level.

What this means is that there is a statistically significant relationship between our two variables.  Our two variables are the presence of Brad, and the assignment of team.  The presence of Brad in my game is actually statistically related to the team to which we are assigned.  This would seem to make it appear that our team assignment is not random on this map.

This got me wondering about other maps.  This effect was only large enough for me to casually pick up on for this one map, but might things be similar on others?  If other maps don't show these relationships then there would potentially be an effect of the map.

The map Longbow gets played a lot for the dominion game type, but there's another map that gets similar (if not a little more) play.  That map is Exile.

So in the same way as I pulled down the numbers for Longbow I went in and pulled down the numbers for Exile.  Here they are:   

With BradWithout BradTotals
Red Team131831
Blue Team161430

You can use the same calculator to run the same Fisher's exact test, but for this map we fail to find a significant result - the p value for these numbers is greater than 0.05 and thus not significant (it's actually 0.4462).

This would seem to implicate that the effect that we're seeing is map specific, and specific to the map Longbow.  Having Brad in my group doesn't seem to impact team selection on Exile - it follows with the fact that unlike Longbow I haven't casually noticed it on that map, or others.

So, there you go - find some other dichotomous variables in your life and put together some contingency tables.  You might be surprised (like I am) at what you find.

343 Industries, maybe you should look into this?  And what more could I find if I had access to your full overall data?  Probably some pretty cool stuff.  =)  

Wednesday, January 9, 2013

On Taxes

The recent news coverage relating to the fiscal cliff and taxes have died down a little in the past week or so, though it's hard to forget how narrowly and inconsistently focused the discussion of it was.  To be fair, I stopped listening at some point, but nowhere in any of it did there seem to be any hint of how taxes really work.  In fact, most discussion used terms and language that foster a simply inaccurate conceptualization of the current tax system.

Now, I'm not going to say I'm an expert on taxes - I'm not.  I'm also not going to to try to explain everything about taxes.  All I want to do is clarify some simple things that you should probably know about taxes in as simple a way as possible.  I plan to be pretty objective about this - I'm not saying taxes are good or bad, or that different types of taxes are better or worse than others.  I'm just trying to let you know what they are. 

I'm also going to just focus on individual taxes, as that's what most people deal with.  If you want to explain corporate taxes feel free to do it in the comments.

It's also the case that I may get some things wrong - bear with me and feel free to correct me in the comments.  

Sales Tax

I was planning on starting with sales tax because it's something that you probably encounter more than any of the others.  Like myself, you also might think that you have a pretty good idea of what sales tax is and how it works.  Unfortunately, like myself, you may very well be wrong.

Sales tax, from a national standpoint, is actually fairly simple yet exceptionally complicated due to the nature of how rates are levied.  From a consumer standpoint, you might know sales tax as something that simply gets added to your bill when you go to the store.  If you don't do a lot of traveling and you live in a place that doesn't make some of the more nuanced distinctions you might even start to think that sales tax is fairly fixed.

Well, kind of.  First off, each state gets to levy a tax, and each state does things a bit differently.  We'll call that the base state sales tax, and here's what that looks like:

So the average base tax is right around 5%, though you can also see that a number of states don't take advantage of state sales tax at all (those states - if you're looking to plan your next vacation - are Alaska, Delaware, Montana, New Hampshire, and Oregon).

Now, in certain states, that's the end of it.  In others, each county also gets a chance to levy taxes.  Beyond that, some states also allow cities to levy taxes beyond that.  You can imagine that there are a lot of these taxes, so I'm not going to go crazy on them right now - I may in a different post sometime though.

From a big picture perspective we can see the magnitude of some of these taxes by looking at the maximum sales tax rate in each state:

You can see that this is a little higher, though there's still two states (Delaware and New Hampshire) that don't levy any sales taxes even at these levels.  While these rates are a little higher (with a mean of around 7.25%), we can figure out even a little more by looking at the paired differences between these rates:

So, you can see that 14 states are happy with the base rate and don't levy anything further (among those are half of the M states: Maine, Maryland, Massachusetts, and Michigan).  Some states, like Alaska, do all their work at this level - Alaska is one of the states with zero base tax, but has a max tax of 7%.

That should be all of it, right?

Well, no.

Some states also make distinctions between different goods, the major categories being: groceries, prepared foods, prescription drugs, non-prescription drugs, and clothing.  Some states exclude these items from general tax (29 states, for instance, exclude groceries from general tax), while some simply (!) tax them at a different (often reduced) rate.  Illinois, for example, has a 1% base rate (instead of 6.25%) for groceries and both prescription and non-prescription drugs.  At the same time, though, they have a increased base tax (8.25% instead of 6.25%) on prepared foods.

Confused yet?  Yeah, this was supposed to be the easy part.

Like I said, I'll probably come back to this one at one point, because there's a lot of fine points here that are actually pretty interesting.

Vice Tax

Vice tax, or sin tax (not to be confused with syntax), is a subset of sales taxes levied against specific taxable goods which are seen or construed as socially undesirable.  The most common targets of vice tax are products such as alcohol, tobacco, and firearms, though vice taxes are also levied against actions such as gambling, and other products such as other types of food or drink.  In fact, the increased tax on prepared foods that I mentioned in the sales tax section is actually more likely and specifically classified as a vice tax.

These taxes function like sales taxes because they basically are sales taxes.  The rationale (sane or not) behind them is that certain goods shouldn't (or realistically couldn't) be outlawed, but should be made to be just a little harder to get.

Well, a 'little' harder to get if you consider a 'little' to be somewhere in the 15-20 billion dollar range annually.  If we assume that only half of the people in the country are sinning in any given year and that the number is closer to 15 billion that would work out to just under $100 a person, per year.  If everyone in the country sinned in a year it would work out to just under $50 a person.  

Other Use Taxes

"Use Tax" is the general term for things like sales tax that can be "avoided" by simply not using the products that are being taxed.  Sales tax (and by extension vice tax) is a use tax because if you don't want to pay it you aren't obliged to actually purchase anything that carries it.  If you went totally off the grid and built your own house, grew your own food, etc, you might be able to get away without purchasing anything that carried use taxes.

The argument that certain things (like groceries) are necessities to life is part of the rationale behind why certain states exclude those items from general sales tax.  If you live in, for example, Maine, you can live off the sales tax grid but still buy groceries.

The majority of use taxes fall into sales tax and are covered above, but there are some things that are not called taxes but function similarly.  The example that I want to cover here is tolls on state owned toll roads.

Now, if you live in a state like Illinois or Indiana or Ohio or Pennsylvania or New England, you might be familiar with toll roads.  If you're not, the idea is simply that drivers pay tolls when they drive on toll roads, based on the distance traveled.  This revenue is often used to upkeep those roads.

A rose is a rose by any other name, and such holds for taxes as well.  Like "true" use taxes, tolls can be avoided by simply avoiding toll roads.  I'm sure this isn't the only case where a tax moonlights as something else, so I'd be interesting in hearing if people can come up with others. 

Property Tax

If you want to vote in an election in 1855 North Carolina you had best own some property.  If you're a bit more 'present' focused, owning property these days will most simply and reliably help you owe some property taxes.

Property taxes are pretty much what they sound like - taxes levied by a jurisdiction on property.  The amount of tax paid is based on a fair valuation of the property in question.  This fair valuation is often first carried out by the property owner, though the taxing authority has the right to formally value the property via a tax assessor if they so desire.

If you thought that sales taxes are levied by a lot of different authorities, spend some time on Google trying to figure out the size of a 'jurisdiction' in relation to property tax rates.  It appears that any authority able to pass referendums or millages carries jurisdiction over those areas to which those apply, and it is through these millages that property taxes are generally fixed (or changed).

What this means is that there are a lot of property tax jurisdictions in the United States.  More than sales tax jurisdictions, it would seem, which precludes doing any sort of more complex analysis without considerable effort.

Estate and Gift Tax

Estate tax, put simply, is a tax levied against the transfer of wealth from a deceased to the beneficiaries of the estate of that deceased.  The gift tax is tied to this due to the ability to avoid the estate tax by simply 'gifting' away all your stuff before you die.  For simplicities sake we can consider them one in the same - a tax levied against person to person (we could also call it peer to peer and then make it P2P) transfer of wealth and/or capital without the reciprocal transfer of goods or services (which would then cover such a transfer with sales tax).

So why not just buy a boat and give that to your kids?  Or ten boats?  Well, let's overlook the fact that boat depreciation might actually devalue your estate to the point that taxes are appreciably less, and instead focus on the fact that this isn't a tax on money alone, but on wealth via the estate.  Houses, boats, cars, copies of Marvel Comics #1, etc.  There's a lot of complexity here, but I'm going to try to keep it as simple as possible.

You might not be familiar with estate tax, even if (or especially if) you're recently deceased.  The reason for this is some fairly high thresholds set for excluded wealth.  As of 2013, the first 5 million dollars of an estate's worth are exempt from federal estate tax.  Beyond this, the estate is taxed at 40%.  The graph that this produces should hardly be surprising by now:  

Income Tax

Some of you might recognize that I've talked about income tax before.  Yes, I'm going to recycle some of that content.

Income tax is really where a lot of the misinformation comes into play when people are talking about taxes.  Part of the problem - it would seem - is that income taxes seem simple enough (they're taxes levied against your income) that people constantly make their own assumptions about how they work.  These assumptions are further substantiated by the language used by a large percentage of those who describe income taxes.

Anyway, let's get to it, shall we?

One of the main components of income tax - and perhaps the most discussed - are income tax rates. 

Tax rates are the percent of your taxable income that is paid in taxes.  Here are the tax rates for 2011 (from

Tax Bracket (Marginal) Married Filing Jointly Single
10% Bracket $0 – $17,000 $0 – $8,500
15% Bracket $17,001 – $69,000 $8,501 – $34,500
25% Bracket $69,001 – $139,350 $34,501 – $83,600
28% Bracket $139,351 – $212,300 $83,601 – $174,400
33% Bracket $212,301 – $379,150 $174,401 – $379,150
35% Bracket Over $379,150 Over $379,150

This table has a lot of information in it, and one of the things that gets a lot of people confused about taxes is what exactly these tax brackets mean.  There are a lot of people who think that crossing into another tax bracket means that your entire taxable income is now taxed at that higher rate.  That's not the case.  If this is the only thing you take out of this post that is the thing you should pick up on.  Here's how it works.

For simplicity's sake, let's say you're filing your taxes as a single person, not a married couple.

Let's say you make $5,000 taxable income.  That income is taxed in the 10% bracket, and you end up giving the government $500 (10%).  Now, let's say you have a friend who is about twice as well off as you, and makes $10,000.  That falls in the 15% bracket, so it should be 15% of $10,000, or $1,500 right?

No.  This is the main misconception of taxes.  People do not fall into tax brackets.  Their money does.

The above is not the rate that a person pays in each of those brackets - it is the amount that the money you've made in each of those brackets is taxed.  This is the idea of a marginal tax code.  Got that?  Here's a graphic to give a better idea of this:

Much better.  Now, imagine that every time you make a dollar over the course of a year you throw it into this big multicolored bucket that you keep in your garage.  You start out the year with your first bit of income, and throw it in the bucket.  As long as you're filling up that very bottom blue section your income is being taxed at 10%.  Pretty nice.

Now, that blue section can only hold so much money, and after a while (about $8500) you can't stuff another dollar in it no matter how hard you try.  Now you have to start filling the red section of the bucket.

Every dollar you throw into the red section is getting taxed at 15%, but the dollars in the blue section have already been taxed at 10%.  The tax you pay on those dollars doesn't change, only the money that you continue to make.

You're having a good year, and pretty soon the red section is filled up, too.  Bummer, the yellow section is taxing at 25%.  Oh well, by the time you've filled it up you have just a little less than $79K profit, even after taxes.

I think you probably have the point by now.  You keep filling up sections until they're full, then move onto the next.  Now, the top light blue section only goes to $500,000 in my graph, because I didn't feel like making an impossible graph.  You see, that light blue section goes on forever.

Thus, when people talk about how the highest tax rate used to be in the ballpark of 90%, what they're talking about the highest marginal tax rate.  What that does not mean is that anyone ever payed in the ballpark of 90% of their income (though I suppose if you made enough money it could get close), but rather that after their income crossed some threshold any additional income was taxed at that rate.  Once a dollar is in the bucket and taxed at one rate that dollar is done.  The first dollar that anyone makes in a year is always in the first tax bracket (unless it's an exception and not in any bracket). 

The trick is also that there used to be a whole lot more brackets (sections of the big multicolored bucket).  In fact:

Those numbers are correct - back when the top rates were really high there were also a lot more brackets.  These top brackets were sometimes referred to as 'millionaire tax' and were meant to set realistic caps on the amount of money that individuals could earn annually.  A number of brackets were added at the start of the Great Depression to help control the economy, and then slowly phased out during the rest of the Great Depression.  The number of brackets was pretty constant from the end of WWII to the 80s, when things were brought down as low as two brackets. 

Now you understand taxes.  Well, simple taxes.  

I've been trying to keep semantically consistent and use words like 'taxable income'.  Everything that we've talked about so far is based on the fact that you make X number of dollars each year.  The tax code isn't quite so simple, though, and the other driver of how much you pay in taxes are deductions.

What does a deduction or exemption do?  Put simply, it deducts or exempts dollars from your taxable income, or exempts you from part of your tax burden.  Do you know what that means?  You sometimes don't have to throw those dollars into our multicolored basket at all.

If I still have your attention, great!  We are almost there.

If you end up saving some of the money you make from going in the bucket, or even if you don't but if you make more than $8500 a year, then you're not paying any standard fixed rate of tax, but rather an effective rate that's specific to your situation.

The effective tax rate is different for everyone, and is a bit trickier to figure out based just on income.  It's this effective tax rate where much more subtle changes can be made.  The overall tax rate can be put in a little table, and it's pretty easy to conceptualize and understand.  Changes to that are things that you can explain away in soundbites on 24 hour cable channels.  You can probably picture that table showing up as a nice simple graphic.

Changes to the effective tax rate take a bit more garrulousness.  

Want to know what your effective tax rate is before any deductions and/or exemptions?  It's a piecewise function, and without belaboring the point here's what it looks like:

There's actually a great discussion of asymptotes and limits to be had here, but that's not for today.  What you should take away is that no person will ever pay 35% of their income in taxes under the current tax policy.  While some of their money (the more they make, the greater proportion) will be taxed at 35%, they always had their first $379,150 taxed at lower rates.   

If you're curious, the formula you should use to figure out the taxes someone should pay if they make more than $379,150 is:

850+3900+12275+25424+67567.5+((TAXABLE INCOME-379150)*.35)

If you're inclined to math you can also probably figure out how to modify that pretty easily to any income level.  If you're not inclined to math perhaps you should take the time to figure this one out as an exercise.  =)

Anyway, that should give you a good base to start with if you'd like to get into any conversations about taxes.  Keep in mind a few simple facts and you won't find yourself being tricked over and over by misleading wordings.