Quiz #4 solutions 1. (Comic from xkcd.com) See the comic to the side. The machine is able to correctly detect whether or not the sun has gone nova. It then rolls two six-sided dice, and if both come up 6, it lies and if not then it tells the truth. Suppose you initially believe that there is a probability of .00001 that the sun will have gone nova at the moment when you ask the machine. Then when asked, the machine says that yes, the sun has gone nova. a. So, use Bayes’ Rule to find the probability P(N|Y), the probability the sun has in fact gone nova (N), given that the machine says that yes it has (Y). | | . . . . … b. Now, suppose you then quickly ask the machine a second time if the sun has gone nova, and it replies “yes” a second time. Using the answer for (a) as the new “prior probability”, use Bayes’ Rule again to find the updated probability the sun has gone nova. Replace .00001 and .99999 with .00034988 and .99965012 respectively to get .01210187. c. How many times would the machine have to answer “yes” consecutively for you to conclude there is at least a 50% probability that the sun has gone nova? If you want to use R efficiently, you could do something like this: > p = .00001 > p = (35*p/36)/(35*p/36 + (1-p)/36) >p [1] 0.000349881 > p = (35*p/36)/(35*p/36 + (1-p)/36) >p [1] 0.01210187 > p = (35*p/36)/(35*p/36 + (1-p)/36) >p [1] 0.3000896 > p = (35*p/36)/(35*p/36 + (1-p)/36) >p [1] 0.937525 After about three consecutive “yeses”, I’d start getting concerned, and if the machine answers “yes” four times in a row, you’ve got about 9 minutes to make your peace with whatever you need to make peace with. 2. If you follow sports, it can be extremely difficult to differentiate skill/ability from random chance. NFL teams play a 16-game regular season. Over the last five years the New England Patriots, coached by Emperor Palpatine (Bill Belichick) have won approximately 63.5% of all the games they have played. So, assume that next year, the Patriots would win any given game that they play with probability .635, and each game is independent. a. Find the probability the Patriots would win 8 or fewer of their 16 games. > pbinom(8, size=16, prob = .635) [1] 0.1928697 b. Find the probability the Patriots would win 12 or more games. Either > pbinom(11, size=16, prob=.635, lower.tail=FALSE) [1] 0.2480011 or > 1-pbinom(11, size=16, prob=.635) [1] 0.2480011 gives the solution. c. Find the probability the Patriots would win all 16 of their games. > dbinom(16, size=16, prob=.635) [1] 0.000698843 d. Imagine replaying the upcoming NFL season 100 times. Use R to simulate the number of games won by the Patriots in each of those 100 seasons. In how many of the seasons in your simulation did the Patriots win 8 games or fewer? Show the output and mark those seasons clearly in some way. Answers will of course vary here, but use > rbinom(100, size=16, prob=.635) to generate the data. [1] 7 12 8 12 8 11 9 9 11 10 9 9 10 11 10 14 12 13 12 9 12 10 9 11 11 [26] 9 9 14 10 10 12 10 10 10 11 10 10 9 9 13 12 13 9 9 8 11 7 14 9 10 [51] 10 9 8 9 13 7 10 11 11 11 11 11 9 9 7 8 8 6 13 11 8 11 11 13 9 [76] 14 9 11 10 12 14 11 10 11 9 9 11 5 7 10 11 9 12 14 10 In this particular sample, I count 14 seasons where the Pats won eight games or fewer. 3. Powerball is a lottery which can be played in Georgia among many other states. On 5/18/2013, the jackpot for top prize reached an amazing $591 million. That week, approximately 232,000,000 people played (i.e. that many tickets were bought). Since the probability of winning the jackpot is 1/175,223,510, and it costs $2 to play, it is tempting to think that playing the game would be a good deal ($591M times 1/175,223,510 = $3.37, which is higher than the cost of a $2 ticket). However, as we’ll see, this reasoning is not quite correct. Here’s the short version of the solution. Generate the probabilities of having 0,1,2,3,4,5 winning tickets. > part3 = dbinom(0:5, size=232000000, prob=1/175223510) > part3 [1] 0.266062710 0.352273214 0.233208962 0.102924695 0.034068672 0.009021543 Add to that data the probability of having 6 or more winning tickets. > part3 = c(part3, 1-sum(part3)) > part3 [1] 0.266062710 0.352273214 0.233208962 0.102924695 0.034068672 0.009021543 [7] 0.002440205 Find the average value of a winning ticket by taking the payoffs and weighting them with these probabilities. > payoffs = c(328333333, 164166666, 109444444, 82083333, 65666666, 54722222, 46904762) > weighted.mean(payoffs, part3) [1] 182005915 Expected value of a $2 ticket: > 182005915/175223510 [1] 1.038707 Thus, even when the jackpot is announced at $591M, the odds for playing the game are still not truly favorable, as the expected value of a $2 ticket is only $1.04. BONUS: Assuming 232 million people play as in this problem, how much does the announced jackpot have to be to make a $2 Powerball ticket “worthwhile”?
© Copyright 2025 Paperzz