Stopping conditions in coin flipping sequence

Imagine you can flip a coin up to a maximum number of X times. You stop if during this sequence, the coin lands on tails 3 times in a row. Otherwise you keep flipping.

You repeat this game some N number of times.

The "real world" application of this might be a shooter in a basketball game. Say he can shoot up to X=25 times (i.e. 25 potential FGA), and N=82 (games in a season). His coach tells him to stop shooting if he misses 3 in a row.

I simulated this scenario and found that the stopping condition does not affect the overall probability of the coin landing heads. This seems counterintuitive to me, as it "feels" (my intuition tells me) that the stopping condition would somehow bias the results.

Can someone explain to me why the stopping condition here doesn't affect the overall distribution of heads and tails in this scenario?

Edit: This appears to be different from the "birth problem" in that the value of p does not matter (i.e. it does not have to be 1/2). The stopping condition in this case seems to have no effect on the overall probability, regardless of the value of p. It's not clear to me from the answers to the birth problem why this has to be the case.

• Consider that immediately after stopping that one more flip of the coin would be equally likely a heads as a tails. So by stopping short you eliminate equally likely numbers of future heads and tails. Commented Mar 26, 2015 at 17:51
• This is a more complicated version of stats.stackexchange.com/questions/93830, where the stopping condition is about as extreme as possible: terminate the flipping after a single miss. There are many varied analyses in the answers to that thread, one at least of which should suit your tastes. You might also find stats.stackexchange.com/questions/12174 to be of interest: it discusses the expected number of flips.
– whuber
Commented Mar 26, 2015 at 17:57
• possible duplicate of Expected number of ratio of girls vs boys birth
– Tim
Commented Mar 26, 2015 at 18:34

The probability of "success" (heads, making a basket, etc.) is the limiting ratio of the number of successes to the number of trials, $p$.

One way to run your simulation is to generate a very long sequence of independent binary trials with underlying success probability $p$. Scan across the sequence, looking for the stopping sequence $S$ (where $S$ is one success, in the case of the birth problem, or three failures in a row, in the basketball problem, for example). Immediately after the end of each appearance of $S$ declare the beginning of a new experiment.

For example, here is the beginning of such a sequence with $p=1/3$, 1 designating success and 0 failure, with $S$ set to 010:

10010 010 0010 1010 10000011010 11110
|   |    |    |           |


The ticks mark the endpoints of each experiment. The last five results (11110) would be thrown away in this short simulation because the experiment of which they are part did not end, leaving $27$ independent random values comprising five full experiments. Out of these $27$ values, $10$ were successes, in proportion $10/27$ (which is consistent with $p=1/3 = 9/27$ but varies from it due to chance).

Notice that the stopping rule changes the sequence not one whit: it merely marks the boundaries between successive experiments.

In a finite simulation you will have to throw away all the results after the last appearance of $S$, but as the simulation grows ever longer the chance that these abandoned results constitute any appreciable proportion of all the results shrinks to zero.

Consequently, the proportion of successes in your simulation cannot be any different (in the limit as the number of trials grows large) than the proportion of successes in a long independent sequence of results: it will not deviate from $p$ by any more than chance permits.

• Now I understand your answer better. I needed to visualize the sequences and come to that realization on my own though to really let it sink in. :) Commented Mar 26, 2015 at 20:29
• Pictures are good. I added a small example to illustrate the idea.
– whuber
Commented Mar 26, 2015 at 20:45

I thought of an intuitive way to explain this (and answer my own question). It turns out that if you just ignore the stopping and see this problem as a sum of concatenated sequences, it becomes clear that it doesn't matter.

Imagine we get the following sequences stopping after 3 successive misses:

1 0 1 0 0 0
1 0 1 1 0 1 0 0 0
0 0 0
1 0 0 0


Now, you can see if you simply concatenate these sequences, the overall proportion of 1's and 0's is the same as if you flipped all in the same sequence. The "stopping" doesn't matter at all. It's just a mental break in the sequence.

1 0 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0


There you have the same number of 1's and 0's. The stopping condition is a red herring.