Monday, 28 September 2015

Contraceptive Efficacy and Combined Probability

When sex education sources quote numbers on the efficacy of different forms of contraception, they usually report a number like "98% effective". What they really mean is that, on average, 98 out of 100 women using that method of birth control for a whole year won't get pregnant. However, most people don't understand how a seemingly small annual risk of pregnancy might translate to a significant risk of pregnancy over a period of several years. In this post I show you how the probability of pregnancy grows over time and why it's commonly recommended that couples use two forms of contraception.

The annual risk of unintended pregnancy for several different contraceptive methods are given in the table below, taken from the 20th edition of Contraceptive Technology. The effectiveness typically reported by sex education sources is simply 100% minus the annual risk of pregnancy.

I'm not sure how typical use differs from perfect use when it comes to male sterilization...

It should be noted that "typical use" is perhaps misleading because it is an average for the people reportedly using that contraceptive method. For most contraceptive methods, including the condom and the pill, the most common deviation from "perfect use" is conscious user non-compliance (i.e. knowingly not using the contraception). Not using the contraception shouldn't really count in the typical use, but I guess they just do the best they can with the data they get.

So, suppose you're interested in calculating the risk of pregnancy within a period several years. From the table above, we can get the probability of not conceiving during the first year of use, equal to 100% minus the number from the table. We'll call this number p. The probability of not conceiving during a period of n years of use can be taken as p raised to the nth power. The risk of pregnancy is then calculated as


This simply estimates the risk of getting pregnant at least once during an n-year period while using a certain contraceptive method. The graph below compares a few common contraceptive methods for n = 1 to 10 years.

Comparing the risk of pregnancy using different contraceptive methods.

The graph shows that if you are not diligent in using the contraceptive method properly (i.e. you stray from "perfect use"), there's a pretty good chance of unintended pregnancy somewhere down the road. There's greater than 50% chance of unintended pregnancy within 8 years of "typical use" with the pill, within 6 years with the Standard Days method, 4 years with the male condom, and 3 years with the withdrawal method. Even with perfect use, if condoms are the only contraceptive method used, there's still about 18.3% chance of an unintended pregnancy in 10 years. That's 1 in 5.47. If you look at a 10-year period, comparing all the methods from the previous table, you'll find that if you use only a single method, only sterilization or IUDs reduce your risk of unintended pregnancy to less than 1 in 2 (i.e. less than 50%), assuming "typical use".



We can estimate the risk of pregnancy when contraceptive methods are combined by combining probabilities as shown in the following equation:


When two events, A and B, are independent, the probability of both A and B occurring is equal to the product of the probability of A and the probability of B. Applied to pregnancy risk, it means the risk of getting pregnant while using both methods A and B is equal to the probability of A failing multiplied by the probability of B failing. This approach to combining probability assumes that the individual probabilities are independent of each other. Before combining probabilities you should think about whether they actually are reasonably independent. For example, birth control pills and male condoms are probably independent (or nearly independent) because they are unrelated methods and it is unlikely that one method will influence the efficacy of the other. Therefore, the probability of an unintended pregnancy in the first year of use is probably approximately 0.18*0.09 = 1.62% when both male condoms and birth control pills are used (assuming "typical use"). A counterexample is the combination of the Standard Days Method and the TwoDay Method, which are probably not independent because they are both methods of achieving "fertility awareness". It's unlikely that one method negatively influences the other, but combining the two probably has little benefit either. The combination of Standard Days Method with the TwoDay Method is probably only slightly better than either one of them their own. That said, I've calculated the risk of pregnancy with some combinations of contraceptive methods which probably satisfy the assumption of independence in order to demonstrate how using two methods simultaneously dramatically reduces your risk of unplanned pregnancy.


Comparing the risk of pregnancy using different combinations of contraceptive methods.

As you can see, combining contraceptive methods reduces the risk of unintended pregnancy by a pretty significant margin. If using a single contraceptive method, assuming "typical use", only IUDs or sterilization were effective enough to reduce the risk of unintended pregnancy to less than 50% in 10 years. Combining 2 methods very effectively reduces the risk of unintended pregnancy without resorting to invasive or irreversible medical procedures.

Thursday, 27 August 2015

Gambling and Expected Value: NHL Lotto (OLG)

In this post on Gambling and Expected Value, we look at the "NHL Lotto" lottery offered by the OLG.
Click here to find similar posts on other lotteries and games of chance.

NHL Lotto (OLG)

NHL Lotto a lottery offered by the Ontario Lottery and Gaming Corporation (OLG). 

How the Game Works

To play NHL Lotto, the player selects a combination of 5 numbers chosen from 1 to 30, and an NHL team (of which there are also 30 options). Numbers cannot be repeated and the order is not important. The player also has the option of having the computer generate a random selection instead (known as "Quick Pick" in lottery vernacular). The game involves two portions, the "Instant Win" and the "Nightly Draw". In the Instant Win portion, you watch a computer-generated animation of a hockey player take three shots at a net with targets and hope that you've been randomly selected to be a winner. The system has been programmed to randomly mete out prizes based on OLGs predetermined odds of winning. In the Nightly Draw, prizes are awarded based on correctly matching the winning numbers and NHL team. It costs $2 to play NHL Lotto. 

Probabilities and Prizes

There are 13 different ways to win a prize in the Instant Win portion of NHL Lotto, ranging from $15,000 down to $2. The prize awarded corresponds to the targets hit by your computer generated hockey player, but it's not clear how exactly that translates into calculable probabilities. I'll have to assume the odds reported by the OLG are the exact probabilities programmed into their computers. But here's the summary of the Instant Win prizes and probabilities for NHL Lotto:

Summary of prizes and their probabilities in the Instant Win portion of NHL Lotto

There are 142,506 unique combinations of five numbers that can be chosen from the numbers 1 to 30. The number of combinations of items you can choose from a set without repetition is calculated using the following formula:

 \binom nk = \frac{n!}{k!(n-k)!},

where k is the number of items chosen, n is the total number of item to choose from, and ! denotes the factorial function. In this case, n = 30 and k = 5. But you also choose one hockey team out of 30 possible choices. You could repeat the above calculation for n = 30 and k = 1, but it should be intuitively obvious that there are 30 possible ways to pick one hockey team out of the 30. So in total there are 30 times 142,506 = 4,275,180 unique combinations of one NHL team plus 5 numbers chosen from the numbers 1 to 30.

The probability of matching some number of the winning 5 can be calculated from the hypergeometric distribution. The formula looks like this:

Equation 1 (general lottery prize probability formula)

where p is the probability of winning, n is the size of the set of numbers the winners are drawn from, k is the size of a combination, and r is the number of matching numbers required to win the prize. For example, to calculate the probability of matching four numbers in NHL Lotto, r = 4, k = 5, and n = 30. Plugging in the numbers gives the probability of approximately 0.088%, or about 1 in 1,140 (note this probability reflects the combined probability of winning either the 3rd or 4th prizes).

We can treat the NHL team matching as a bonus number drawn from a separate pool of numbers. The formula to calculate the probability of matching r out of k winning numbers plus a bonus number that is drawn from a separate pool of m numbers is a slight modification of Equation 1:

Equation 2 (general lottery with separate bonus number prize probability formula) 

Here is a table summarizing the payouts of the Nightly Draw portion of NHL Lotto and their probabilities:

Summary of prizes and their probabilities for the Nightly Draw portion of NHL Lotto.

Since for some of the prizes matching x out of 5 numbers has two different prizes depending on whether or not you match the NHL team, the probability has to be adjusted for overcounting. The probability of matching with the bonus is calculated from Equation 2 (m = 30). The probability of matching without the bonus is calculated from Equation 1 minus Equation 2.

So there's roughly 66.7% chance you lose on the Instant Win game and 94.5% you lose on the Nightly Draw. The combined probability of losing both games is calculated by multiplying the two probabilities together, which works out to a 63.1% probability that an NHL Lotto player has just thrown his money away.

Expected Value

Expected value here is pretty straightforward to calculate, just multiply each of the possible prizes by its respective probability, sum all the products, and then subtract the cost of the ticket. For example, the $100,000 prize in the Nightly Draw multiplied by the 1/4,275,180 probability of winning contributes an expected value of $100,000/4,275,180 (about 2.34 cents) to the overall expected value of an NHL Lotto ticket.


Summary of expected values of the prizes in the Instant Win portion of NHL Lotto

Summary of expected values of the prizes in the Nightly Draw portion of NHL Lotto
with overall expected value and house edge of NHL Lotto

From the tables, you can see there's a house edge of about 41.3%, meaning an average of 41.3 cents from every dollar spent on NHL Lotto goes straight to the OLG.

It's interesting to compare the two games. The total expected value of the Instant Win prizes is more than 4 times the expected value of Nightly Draw prizes. Similarly, the probability of getting a payout in the Instant Win portion is about 6 times the probability of getting a payout in the Nightly Draw. The OLG cleverly use a little computer animation, which is probably slightly entertaining to watch, and the fact that you get a payout about a third of the time, to hook people on the game. Most people appreciate that the chance of winning exists only if they buy a ticket, but don't really appreciate how minuscule that chance might be. The Nightly Draw is there to give players hope. The thinking is that if you lose the Instant Win game, well at least you've got another shot at free money. Too bad your chance of winning anything in the Nightly Draw is much lower than in the Instant Win. The Nightly Draw is even assigned a bigger top prize, because when the payout gets bigger, people tend to be more willing to make bad decisions (like buying another ticket).

From our analysis we can draw the following conclusions:

  1. NHL Lotto has a house edge of about 41.3%, which is a little better than a 50/50 draw. In other words, on average, OLG keeps 41.3 cents of every dollar spent playing NHL Lotto. Better than a lot of lotteries, but worse than casino games.
  2. The Instant Win portion of the game is significantly better than the Nightly Draw portion, both in terms of the expected prize value (about 4 times that of the Nightly Draw), and the odds of winning a payout (about 6 times higher chance of winning than in the Nightly Draw).
  3. The combination of flashy animation, small and relatively frequent payouts, and a second chance game that has a bigger top prize (but rarely pays out to anyone) is purposefully crafted to attract and hook gamblers on NHL Lotto.