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

27 June 2010

Odds of Winning the Lottery

I received a newsletter from a prominent financial and risk services firm where it was stated that the odds of winning the lotto are:

  1. 0,0000072 % with an average pay-out of R2,25 million

  2. The chances of picking five correct balls and one correct bonus ball are only slightly better at 0,000429 %, with an average payout of R173 130,22

  3. Not playing could make you R804 000 better off over your lifetime


This seemed a bit optimistic to me so I investigated the odds of winning the lottery while listening to Cryptopsy and Origin on the Jewtube Relapse Records channel.

How does probability work?


You divide the amount of desired outcomes by the total amount of possible outcomes. If you are casting a dice, you want one number out of six possible numbers. Thus, your odds of getting any one number of a dice are 1/6 or 0,166666667, times 100 to give you 16,6666667 %. For more on probability, see my Bayesian analysis post.

What are the chances of winning the lottery?


This problem could be sub-divided into a few smaller, easier problems using the infamous divide and conquer technique. These sub-problems are:

  1. How many balls are there in total?

  2. How many numbers are there?

  3. How do the combinations work?



How many balls are there in total?


In the South African lottery, or Lotto, there are 49 balls in total. That is, you start off with 49 balls.

How many numbers are there?


The South African lottery has six numbers, plus a bonus ball. Someone who guesses the first six numbers correctly wins over someone who has six numbers correct that includes the bonus ball. For our purposes, I shall exclude the bonus ball because we definitely want the jackpot.

Upon drawing the first ball (or number), there are 49 balls in the pool. You desire one ball out of 49 possible balls (though most guys prefer having two balls, but that's another story). Your odds of drawing this number are 1/49 or 0,020408163.

After the first ball is drawn, there is one less ball in the pool. This means that your odds of drawing the second ball are 1/(49 – 1) , which is 1/48 or 0,020833333.

When drawing the third ball, there are 47 balls left in the pool. This means that your odds of drawing the third ball are 1/47 or 0,021276596.

You get the picture. We can work out the chances of drawing all six balls in a similar way. Since drawing each ball does not depend on drawing a previous ball and we already compensated for having less balls at each round, the event of drawing any ball is discrete. Having discrete balls is awesome because we can multiply each ball event with each other to get the total chances of drawing 6 correct balls. The result is:

1/49 x 1/48 x 1/47 x 1/46 x 1/45 x 1/44 = 1/10068347520

Or one in 10068347520 possible numbers that can be constructed from six numbers each consisting of a number between one and 49.

How do the combinations work?


In order to win the South African Lotto, you do not need to guess the numbers in the correct order. This means any combination of the six numbers could win you the Lotto. In order to work out the number of combinations, we need to work with factorials.

Since there six possible numbers, we need to know how many combinations of six numbers we can possibly have. In other words, in how many different ways may you choose six numbers? This is the factorial of six, or 6!. The answer is 720.

What are the chances of winning the lotto?


The chances or odds of winning the South African lottery or Lotto are one over the total number of possible numbers divided by the total number of combinations of six numbers.

This means your chances of winning the lotto are not even a snowball's hope in hell, but a snowflake's hope in hell. You really want the number? Ok, the answer is 1/13 983 816 or one in roughly fourteen million. Another way to express this is 0,000000072, times 100 to yield 0,0000072 %.

Back to the newsletter



  1. The chances of winning the lottery are not 0,0000072 % but 0,000000072. Update: which of course you have to multiply by 100 to get the percentage, so that's where the 0,0000072 % comes from. Mystery solved!

  2. Using the same method above, the chances of picking five correct numbers out of a possible five are 0,000000524, times 100 to give 0,0000524 %. I'm not sure how the bonus ball would impact this but it seems to me that picking 5 + 1 numbers amounts to picking six correct numbers, since the possible number of numbers and the possible number of combinations remain the same. Thus, provided that I am right, your chances of picking five numbers plus a bonus number are equal to the chances of picking six correct numbers, so that remains 0,0000072 %.

    If I am wrong and the correct answer is 5 correct numbers out of 6, then this becomes the combinations of 6 taken as 5. In other words, 6!/(5!), which is 720/120 or 6. Thus, your chances of picking 5 correct numbers out of a possible 6 are 0,000000429, times 100 to yield 0,0000429 %. Which has one more digit than their number, but it's closer so I guess this is the method that they used.

    I might also be wrong in that 6 combinations plus a bonus ball out of 7 balls were chosen for the original odds. In this case, the answer is the amount of combinations made with 7 numbers, divided by the factorial of 7 taken as 6. The answer is a 0,000000039 or 0,0000039 % chance of winning the Lotto with six correct numbers out of a possible seven, one of which is a bonus.

    This is a bit far from their estimate, so I guess they used the same method I used, except they got a few digits wrong. This might be due to the accuracy of the calculator or spreadsheet application that they used.

  3. The not playing figure assumes that ticket prices remain at R3,50. The playing time is 35 years (between the ages of 25 and 60). Interest is calculated annually at 10 %. This means that not playing Lotto and saving your change, if you played twice a week, yields the handsome sum of roughly R98 991,65 (I am uncertain if this is calculated at simple interest or at compound interest), which is nowhere near R804 000.

    I used a financial calculator, with the values as indicated. I assumed that one ticket is bought for each draw, meaning two draws per week. I multiplied this R7 with the amount of weeks in a year (roughly 52,178571429 weeks) which gave me a yearly investment of R365,25.

    In order to reach their amount of R804 000, you'd have to invest roughly R83 366,52 per year over a period of 35 years at 10 % interest. This amounts to spending roughly R1597,98 per week on the Lotto, which is about R800 per draw or 228 tickets per draw.


Apparently this is a miraculous financial and risk services firm because they can turn R96 552.43 into R804 000 over the same period and using the same interest. Guess I should consider investing with them.

Where do their numbers come from?


Their numbers and my numbers differ by a factor of 100. This is very peculiar, so I found this page on lottery maths that explains the difference.

In the first case, despite their statement that you only play twice per week, they must've bought a total of 100 tickets per lottery draw. This would increase the odds from 1 in nearly 14 million to 100 in nearly 14 million to win a six number lottery, without any bonus. Update: unless of course they were working in percentages, in which case their number is correct.

In the second case, they must've bought a total of 100 tickets per lottery draw. This would increase the odds a thousand times for a five ball plus bonus draw, which gives the ratio between our different numbers.

To put this in perspective, an ordinary calculator cannot even display the minute numbers in question. Regardless of whose method you use, you're likely to end up with 0. In other words, your odds of winning the lotto are as good as 0. The only way to have a noteworthy chance of winning the lotto is to buy a couple of million tickets per draw. But if you could buy a couple of million tickets per draw, you wouldn't need to win the lotto.

Lastly, I multiplied my weekly amount by 100 and worked out the future value of such an investment. This means instead of not spending R365,25 per year on the lottery, you don't spend 100 tickets per week x R3,50 per ticket x weeks in a year per year on the lottery. In other words, you invest this R18 262,5 per year for 35 years at a 10 % interest rate. This investment would be worth about R4 949 582.53 at the end of 35 years. This is again a far cry from R804 000, only this time I am missing about R4 145 582,53.

It appears that this financial and risk services firm does business like FIFA.

19 June 2010

The Demon of Laplace

South African author Joan De La Haye offers Demon Friday. Surprisingly, it's each Friday and it involves a demon from one grimoire or another. She also greets us as 'freaky darlings', similar to Vampira. Top class!

This is my own take on Demon Friday, except it's not always on Fridays and it doesn't feature real demons or pictures of real demons. Sorry.

These are all my posts on demons:

  1. The demon of Laplace, regarding probability.

  2. The demon of Maxwell, regarding thermodynamics.

  3. The demon of Descartes, designed to invoke skepticism.

  4. The demon of Morton, designed to make one aware of confirmation bias.




Inspired by this medieval motley crew, I decided to offer a grimoire of demons closer to my heart. Or perhaps closer to my head.

Pierre Simon Laplace image on Wikipedia

Pierre-Simon Laplace as captured by the Wikipedia paparazzi.

Laplace's Demon


Pierre-Simon Laplace is famous for being both French and smart simultaneously. In this rare combination, he managed to contribute to the development of mathematics and statistics. His contributions to statistics include an early version of Bayesian analysis.

Laplace was so impressed with the success of statistics and probability to determine guesstimates of the occurrences of events that he proposed the notion of Laplace's demon.

What is Laplace's Demon?


Laplace's demon is a hypothetical creature that - instead of hiding in your broom closet or underneath your bed - knows the exact location and momentum of each atom of the universe. Armed with this knowledge, Laplace claimed that his friendly demon would be able to predict the exact future location and momentum of each atom of the universe. In effect, Laplace's demon would know the past, the present and the future from analysis.

Pierre Simon Laplace demon

Pierre-Simon Laplace's demon as captured by the Wikipedia paparazzi.

Should we believe in Laplace's Demon?


Heisenberg's uncertainty principle states that there are difficulties with knowing both position and momentum of a body simultaneously. This means that we're stuck with at best half a demon at any given time. Perhaps Laplace's demon may give us the odds, but it can't give us certainty as to the causal outcome of a given event. Laplace's demon may fail due to interpretations of quantum mechanics. A more accurate description of Laplace's demon may then perhaps be Laplace's bookmaker of the universe.

28 June 2009

Bayesian Analysis: To probably be, or probably not be, depending on something else's probability

That man of science, Urikalish, loves to torment us superstitious, intuitive mortals who adore the Secret and the Law of Attraction with logic. This is his latest riddle:

Urikalish's Riddle


Let’s assume there’s a deadly disease that affects 1 in every 10 people.

Let's say there’s a pretty good test for this disease which is 90% accurate (that means that if a person is sick – the test will say he’s sick in 90% of the cases, and if a person is healthy – the test will say he’s healthy in 90% of the cases).

Now, assuming you took this 90% accurate test, and got a positive result that implies that you are sick - what are the odds that you are really sick?


Bayes's Theorem


The key to solving this riddle is Bayes's Theorem. Don't ask me why. I'm an elitist and I don't need to explain myself to the likes of you. Especially when I have no idea what I'm talking about.

Bayes's Theorem from Wikipedia

  • P(A|B): This is the probability of A, given B. This is what you are looking for. This is the posterior or revised probability that you have the disease, given the fact that you test positive.

  • P(B|A): This is the conditional probability, or the probability of B given A. In other words, the probability that you test positive, given that you have the disease.

  • P(A): This is the prior probability of A, or the prior probability that you have the disease, regardless of whether your test is positive or not.

  • P(B): This is the prior probability of B, or the prior probability that you test positive, whether you have the disease or not.


Smart people can fill in the data directly from Urikalish's riddle into Bayes's Theorem and get a result. Unfortunately, I played more with the glue and crayons than with the abacus and the clay when I was a kid, so I need something simpler.

An Intuitive Explanation of Bayes's Theorem


Eliezer S. Yudkowsky, that boy genius who tells us about his AI (that is, Almost Implemented) research, has the remarkable ability to make some really, really smart stuff seem really, really simple. This is Yudkowsky's explanation of Bayes's Theorem, which still went over my head (must've been toxic glue), so I tried something that is even more simple and more familiar to me, namely decision trees.

Using Decision Trees in Bayesian Analysis


Start at the beginning and make a split for those who have the disease, and those who are healthy. Branching of each node of the tree has to add up to 1, otherwise you're cooking Dutch books. Proceed up the tree, splitting each node into all the possible scenarios, and you'll eventually cover your entire sample space and thus have a visual representation of your full joint distribution.

decision tree Bayesian Analysis

Explanation


The probability of having the disease is equal to the amount of people who have the disease and test positive, divided by the total number of people who test positive.

If you said 90%, you are stating the probability that the test is right. This is a different probability than having the disease. If you said 10%, you are stating the probability that anybody has the disease, regardless of taking the test or not. The probability of having the disease is affected by both the probability that the test is right and the rarity of the disease.

The total number of people who have the disease here is 0,1, which is 10 %, or 10 out of the 100. The total number of people who test positive is 0,1 x 0,9 for those who have the disease (or 9 out of the original 100), and 0,9 x 0,1 of those who do not have the disease (also 9 out of the original 100). This means the total amount of people who test positive in the original population is 18 out of 100.

Finally, your answer 0,5 ie 50%. You get this from the 9 who test positive and do have the disease divided by 18 who test positive in the total population. The decision tree makes it visible who tested positive, so you are less likely to get confused. How likely? I don't know, draw your own damn tree.

Google sucks piles I'm moving to Steemit

Short and sweet, Google isn't allowing me to post ads on my blogs here on blogspot any longer. Not that I provide my angry nerd rants fo...