Showing posts with label probability. Show all posts
Showing posts with label probability. Show all posts

Thursday, June 2, 2011

You're positive

So you go to the doctor and get a test for a disease, and they tell you the test is 99% accurate. Then the phone call comes, your test came back positive. What is the probability you have the disease? Chances are it's not 99%.

If a test is said to be 99% accurate what they are referring to is the probability of the test coming back positive if you do have the disease. What you are interested in is the probability of having the disease if your test comes back positive; these are not the same thing. With all things that are not 100% accurate there is a chance of a false positive, being told you are positive when you are not, and a false negative being told you are negative when you're not.

Let's assume the disease is fairly rare and only occurs in only 2% of a population. For a population of the size of Canada, 24 million, that means 480,000 people have it and 23,520,000 don't. Since our test is 99% accurate that means that of the people that are positive 475,200 will come back positive and only 4,800 will be be told they are not, ie a false negative. At the same time, of the people that are not positive 23,284,400 will be told they don't have the disease and 235,200 will be told they do.

This leaves percetage of people that are positive out of the number that are tested positive is 67%. Since the disease is so rare the number of false positives is almost half as much as the number of people who actually have the disease, this makes telling a false positive from a real one very difficult. The rarer the disease the worse this effect. In many cases a test like this is used to screen patients since although it may scare a few people, very few sick people slip through the system. From there they can perform more expensive accurate tests to determine the results for sure.

Tuesday, May 24, 2011

If there's a 1 in 3 chance of winning, I'm guaranteed to win if I buy 3 tickets, right?

This year the Heart and Stroke Lottery had a 1 in 3 chance of winning. Actually they said 1 in 3, best odds ever. 1 in 3 is not actually an odds ratio, but the 1 to 2 odds are still the best odds ever. Odds are the ratio of wins to losses. Either way, technically there are 71,653 prizes and 250,000 tickets which are a 28.66% probability of winning, much less than the reported 33.33% chances of winning. But let us assume that the 1 in 3 is correct for the sake of simplicity. So you if bought 3 tickets at 1 in 3 odds you would have to win, right?

The probability of the first ticket wining is obviously 1 in 3. The probability of the second ticket winning is close to 1 in 3 but not exactly since the probability would have gone down in the first prize won, or up if it had not, but this is a tiny difference in 250,000 prizes so we'll ignore it. So by that the third ticket also has a 1 in 3 probability of winning. Since we are ignoring the effect of the missing tickets we are essentially assuming independence amoung the tickets, therefore we can multiply the three probabilities. That gives us that the probaility of just less than 4% of all three tickets winning. Which is not great, but it's not what we are looking for either.




So what about just winning one prize in 3 tickets. Well you do double your chances of winning, but those chances are still not that great. The probability of winning one or more prizes if you bought only three tickets = the probability of winning 1 or 2 or 3 prizes = 1- P(no prizes)=1-(2/3)^3. Which is about 70% chance of winning which is double the original 33.33%, but clearly not a guarantee.  If you double the number of tickets to 6, then you get all the way to 91% chance of winning a single prize. Of course the only way to guarantee you will in a prize is to buy 178348 tickets, one more than the number of non-winning tickets.


But then again the fact that you are supporting a good cause changes the game completely. This way you get to donate money to a good cause, gamble (which is always fun), and get a tax break all in one. What could be better. 

Friday, January 21, 2011

Let's make a deal

Back in the 1970s there was a game show called Let's Make a Deal, hosted by Monty Hall, which created quite a stir when statistics got involved.

The game show went like this. There are three doors; behind one of the doors is a brand new car (Or similarly nice prize) and behind the other two is a goat. And no you don't want a goat. The contestent is then asked to pick a door. Monty Hall would then "reveal" one of the two remaining doors to show one of the goats. This left two unopened doors.
File:Monty open door.svg
The challenge now is, "would you like to stay with the door you first chose, or switch to the other unopened door". The statistics question is; what is the probability that the other unopened door has the car behind it?

Initially people thought that it was a simple 50:50 bet. There are two doors, one has a car, one does not. But this is why we have statistics, to go beyond common sense and discover strange underlying probabilities. The real controversy started when Marilyn vos Savant's "Ask Marilyn" column in Parade magazine in 1990. She stated that one should always switch. Numerous readers including PhD's and respected statisticians wrote in to her "switch tactic was wrong. Here's why she is right.


Let's say you pick door number one. The probability the car is behind it is then 1/3, since one door has a car, and two have goats. Therefore the probability that the other two doors (2 or 3) contain the car is 2/3. When a goat is revealed to be behind door number 2, that probability does not change. Thee is still a 2/3 probability that the car is behind door number 2 or 3. Obviously don't pick 2, so the probability of door number 3 having the car is 2/3.

Seen another way. All possible setups of doors are  (C=Car, G=Goat)
CGG 
GCG
GGC 
If we pick the first door, then Monty would open these doors

So if we switch our door in the first setup, we loose. If we change on the second we win, and the third we win. Therefore we wind 2/3 of the time. If you don't believe me here's a link to an applet, http://math.ucsd.edu/~crypto/Monty/monty.html. You can play the game until your hearts content, and as you'll notice, you'll win 2/3s of the time if you switch your door. Ain't Stats fun.

Thursday, January 6, 2011

The Probability of High Dice

So my bother wanted to know. What is the probability of getting a particular value on a number of different dice. With one catch. He wanted to know how many dice would have to be thrown to be almost positive to get the highest face value to be a 6, or no bigger than a 5, or a 4 etc. In essence when r dice are thrown, what is the probability of getting no number greater than k. 


As he found, this is fairly easy to do by hand for small numbers of dice, about 3 or less. However after three it's almost impossible, without destroying a small forest, to list all possibilities of combinations for say 4, 5 or more dice. The catch is that at least one of the dice has to attain the desired value and the rest can be equal or smaller than that. Initially I didn't realize this contraint and simply added probabilities of every possible combination of dice including triples of that value. Although we did come up with a stack of other interesting setups, and a number of cool points, we finally got the following:

Once you had the setup right it isn't to hard. Essetially all possible combinations of the dice, minus the combinations that don't include k, the highest number. The interesting point though, is that although you are more likely to get a 6, good for initiative addition or something in the game, the probability of getting the smaller numbers drops of dramatically as the number of dice increases. producing a rather cool graph. Which for the math nerds contains a saddle point if you consider the numbers on the real line (i.e. less than 1 on a die)

From left to right we have r, the number of dice, increasing from 1 to 20; From front to back is k, the maximum value on the dice, increasing from 1 to 6. The upshot, and possible cool rule to add is what we dubbed the Clouseau multiplier. 


A advanced experienced character with 10 dice to roll has a whopping 83% chance of rolling a 6 and a 13% chance of a 5, so we can be assured that the character will score a 5 or a 6. Unlike a lowley newbie with only a 18% of getting a 6, or any number for that matter. However, there is almost 0 possibility of getting all ones if you roll 10 dice. So if a player does succeed in getting 1 as their highest value make it a critical hit. "What does "self destruct" mean?" 
And for those that are awed by those rare occasions. Lets say your character is super powerful and has managed to get to level 42 where you can roll a total of 21 six sided dice. The probability that you get at least one 6 is only.. wait for it... 98%. It's high, but that means that once every 50 games you won't get a single 6. Which is probably every day!