Elad Segment 5

From Computational Statistics Course Wiki
Jump to navigation Jump to search

Segment 5 Problems

1) There are 5 prime numbers in range 1 to 12 (2,3,5,7,11). There are 15 possible dice rolls to get any of these numbers (1 + 2 + 4 + 6 + 2, respectively). So for a pair of fair dice, the chance of getting a prime number at a single roll is exactly . I'm not sure I follow the question otherwise. Given that we haven't seen any data yet, the question "if you roll the dice 10 times, what's the chance of getting exactly 5 prime numbers" seems to trivially be ...

2) What we're after is . I have no idea how to compute this explicitly in python or probably any other platform, due to numerical and computational limitations...I guess it can be approximated using the normal distribution, but we haven't covered this material yet so I have no idea if that's what you intended...

Segment 5 "think about" Problems

1) This question is tricky. It would seem like now we have a Markovian process where each step is dependent on the previous one. But that's misleading. Let's actually consider what's the chance of a success (say, getting tails) at a coin toss in such a setting. say the chance of getting tails is P and we have a chance of Q to get an independent trial, else we just use the result from the previous trial. The chance of getting tails at the i-th step is then [chance that the(i-1)-th experiment was tails]. The chance of the (i-1)-th experiment being tails is [chance that the(i-2)-th experiment was tails]. This goes on, recursively, until the first trial (which I guess is simply independent by default). It would seem like the chance of getting tails on the N-th trial should be dependent on Q, but that's actually wrong. An intuition comes from the following fact - if Q=0, then we only toss a coin once and that stays our choice forever, meaning the chance of getting tails on the N-th trial is simply P (the chance of that first coin toss). If Q=1, we have an independent trial at each time and again the chance is P. Here's a proposition - the chance of getting tails at the N-th trial is always P. Let's prove by induction on the length of N. For the base case, N=1, it's just one trial, so the chance is obviously P. Let's assume it's true for (N-1) and show for N - if we go back we see we've already shown that the chance of getting heads at the N-th trial is [chance that the(i-1)-th experiment was tails]. By the induction assumption, the chance of getting tails in the (i-1)-th trial is P. So we get , and we're done. So in fact, nothing's changed.

Segment 5 class activity

part 1

We note that in this stochastic process, each step affects your current sum multiplicatively. If you bet f and win, your value is increased by a factor of (1 + 2f). If you bet f and lose, it is modified by a factor of (1-f). The meaning of this is that if f is fixed the order of successes and failures doesn't matter. We just need to find the f that minimizes the number of trials needed to reach the goal of a billion dollars. . So we need to isolate . Some algebra:


I guess the most logical thing to do at this point would be to derive by f and find the minimum. Once we find that minimum we can compute P based on the chances of getting successes at a binomial experiment (we can obtain that from the CDF of the binomial distribution...). Using a python script for numerical analysis it seems that any value in f=[0.13,0.165] would lead to N_{heads} = 432 which is the minimum. The chance of becoming a billionaire is 0.99999283618671364 (thank you, scipy.stats.binom).

part 2

Numerically, the only thing that changes here is that now we need to swap 2f for Mf and run a double loop for both M and f. Analytically we would need to derive and find a minimum with respect to both f and M. We also note that since the function is convex, we know the lowest value of M has to be between 1 (anything less than that and you lose more on losses than you win on winnings) and 2 (a value for which we know it is possible to become a billionaire with near certitude).