+ Reply to Thread
Results 1 to 6 of 6

Thread: Help please on calculating probabilities of certain coin-flip outcomes

  1. #1
    Points: 16, Level: 1
    Level completed: 31%, Points required for next Level: 34

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help please on calculating probabilities of certain coin-flip outcomes




    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!

  2. #2
    Points: 2,000, Level: 26
    Level completed: 40%, Points required for next Level: 150

    Location
    New Zealand
    Posts
    228
    Thanks
    3
    Thanked 48 Times in 47 Posts

    Re: Help please on calculating probabilities of certain coin-flip outcomes

    Does a streak of 8 or more also count as a streak of 7? or only exactly 7?

  3. #3
    Points: 16, Level: 1
    Level completed: 31%, Points required for next Level: 34

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help please on calculating probabilities of certain coin-flip outcomes

    Quote Originally Posted by katxt View Post
    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. #4
    Points: 2,000, Level: 26
    Level completed: 40%, Points required for next Level: 150

    Location
    New Zealand
    Posts
    228
    Thanks
    3
    Thanked 48 Times in 47 Posts

    Re: Help please on calculating probabilities of certain coin-flip outcomes

    This may help with an approximate solution.
    https://math.stackexchange.com/quest...secutive-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. #5
    Points: 16, Level: 1
    Level completed: 31%, Points required for next Level: 34

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help please on calculating probabilities of certain coin-flip outcomes

    Quote Originally Posted by katxt View Post
    This may help with an approximate solution.
    https://math.stackexchange.com/quest...secutive-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?

  6. #6
    Points: 2,000, Level: 26
    Level completed: 40%, Points required for next Level: 150

    Location
    New Zealand
    Posts
    228
    Thanks
    3
    Thanked 48 Times in 47 Posts

    Re: Help please on calculating probabilities of certain coin-flip outcomes


    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%

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats