Help please on calculating probabilities of certain coin-flip outcomes

#1
Hi all,

(Note: this is not a request for help with "homework"; I'm 51 years old and am trying to learn on my own, through my own "assignments" to myself.)

I'm pretty new to / weak in statistics and am trying to learn more about probability. I have built a simple coin-flip simulator in Excel using VBA. It uses this formula:

=IF(RAND()<0.5, "Heads", "Tails"), where the RAND function generates a random decimal between 0 and 1 every time the sheet recalculates.

I'm experimenting with up to 20,000 flips per simulation. Judging by the results, it seems to correctly simulate the tosses of a fair coin, because as the number of tosses increases, the Heads and Tails results as a portion of the total each approach 50%.

I am observing what kind of "streaks" I get. By "streaks" I mean consecutive, identical outcomes. For example, a Heads streak of 5 means I get Heads 5 times in a row.

I understand (or think I do ; please correct me if I am wrong), that if you flip a fair coin, you calculate the probability of a given streak as (1/2)^streak size. For example, the probability of getting Tails 3 times in a row is (1/2)^3 = 1/8, or 12.5%; the probability of getting Tails 4 times in a row is (1/2)^4 = 1/16, or 6.25%; etc.

That's all fine ( I hope). But...

-- let's say that after a simulation I observe, among other things, that I get 4 separate streaks of 7 consecutive Heads. The chance of getting one streak of 7 consecutive Heads is 1/128, or 0.78125%; but what is the chance of getting 4 separate streaks of 7 consecutive Heads?

-- suppose further that I get, in the same simulation, not only 4 separate streaks of 7 consecutive Heads, but also 2 separate streaks of 7 consecutive Tails? How do I get calculate the probability of all this happening?

I'd be grateful for any layman-friendly advice!
 
#3
Does a streak of 8 or more also count as a streak of 7? or only exactly 7?
The latter. I define a streak by its maximum ordinal number. A streak of 8 counts as only one streak, and not as a "nest" of streaks i.e. one of 8, one of 7, one of 6 ... one of 1.
 
#4
This may help with an approximate solution.
https://math.stackexchange.com/ques...-of-coin-tosses-to-get-five-consecutive-heads gives the expected number of throws to get a streak of n is 2(2^n-1). So in a long run of say r, the average number of runs would be r/(2(2^n-1)). This won't be exact because of end effects and longer streaks taking some of the space, but it seems to give quite good results. These streaks will happen more or less at random through the run, so the number of streaks in any given run will distributed approximately Poisson and probability of particular numbers of streaks these can be calculated in Excel using the POISSON function.
Cheers, kat
 
#5
This may help with an approximate solution.
https://math.stackexchange.com/ques...-of-coin-tosses-to-get-five-consecutive-heads gives the expected number of throws to get a streak of n is 2(2^n-1). So in a long run of say r, the average number of runs would be r/(2(2^n-1)). This won't be exact because of end effects and longer streaks taking some of the space, but it seems to give quite good results. These streaks will happen more or less at random through the run, so the number of streaks in any given run will distributed approximately Poisson and probability of particular numbers of streaks these can be calculated in Excel using the POISSON function.
Cheers, kat
Thanks, kat. But -- probably due to my weakness in this area -- I'm struggling to use this to answer questions like, what is the chance of getting 4 separate streaks of 7 consecutive Heads?:confused:
 
#6
Let's say you have a run of 2000 flips. How many 7-streaks?
The average number of 7-streaks is 2000/(2*(2^7-1) = 7.9.
The probability of getting exactly 4 7-streaks in 2000 flips where the average is 7.87 =POISSON(4,7.87,0) = 6.1%