For example: $“THHTHTTHHHTHTHTTHHTHT”$ contains 1 run of heads of length 3, 2 runs of length 2, and 4 runs of length 1.
Assuming $P(H) = p$ and $P(T) = (1-p)$, calculate (using properties such as conditional probability and Bayes’ Rule) the probability of runs of $H$eads of length $n$.
Where:
$P(H)$ is the probability of heads $(p)$
$P(T)$ is the probability of tails $(1-p)$
The implication that conditional probability and Bayes' Rule can be used would imply that this solution is much more simple than I am making it. That being said, numerous searches have returned complex solutions containing recursive functions, often the Fibonacci series. Furthermore, none of the solutions I have seen are consistent with one another.
From the derived equation, I know that I can then use the linearity of expectation to quickly solve for the probability of runs of length $k = 1, 2, ... 10$ for a total number of events (flips) $N >> 1$
What I could use assistance with is calculating runs of $H$eads of length n given the probabilities for heads $(p)$ and tails $(p-1)$.
What follows looks at the last two of these, with $N$ being the total number of flips:
– Henry Oct 03 '13 at 20:54If $n = N$ then the expected number of runs of $n$ Heads is $2^{-n}$.
If $0 \lt n \lt N$ then you have a run at the beginning with probability $2^{-n-1}$ or at the end with the same probability or in the middle starting at some particular point with probability $2^{-n-2}$ and there are $N-n-1$ possible middle locations, so the expected number of runs of $n$ Heads is $2^{-n-1} + (N-n-1)2^{-n-2} +2^{-n-1} = (N-n+3)2^{-n-2}$.
– Henry Oct 03 '13 at 20:55