View Single Post
  #5  
Old 10-18-2007, 08:41 PM
pzhon pzhon is offline
Senior Member
 
Join Date: Mar 2004
Posts: 4,515
Default Re: Average longest winning streak

I used the second method. It took a few hours of computation, which might have been saved if I had done the calculations numerically instead of exact arithmetic.

Here is part of the distribution of the lengths of the longest losing streak, assuming 18% losses and no ties.

0: 7x10^-67
1: 4x10^-13
2: 0.00719
3: 0.41464
4: 0.43443
5: 0.11577
6: 0.02240
7: 0.00408
8: 0.00074
9: 0.00013

The average length of the longest losing streak is 3.7463922433208756643 .

If this were important, it would make sense to check by a Monte Carlo test, or by using the first method as well.

Mathematica code:
<ul type="square">
Clear[prob];
prob[streak_, length_, p_] := prob[streak, length, p] =
If[length &lt; 0, 0,
If[streak &gt; length, 0,
If[length == streak, p^length,
p^streak (1 - p) Sum[prob[i, length - streak - 1, p], {i, 0, streak}] +
Sum[p^k(1 - p)prob[streak, length - k - 1, p], {k, 0, Min[length - 1, streak - 1]}]]
]
][/list]
Reply With Quote