0

I wanted to confirm if the theoretical form outlined below is inline with expectation for a model.

Say we have a coin that is tossed with probability $p$. We are interested in arriving at the pattern T,T,H after continuous tosses, and would like to determine the number of flips, denoted as $Z$ on average before arriving at our desired pattern. I've defined this as follows, conditioning on the path after the first tail $Y$ appears.

$E[Z] = E[Z|Y,t,h](1-p)(p) + E[Z|Y,h,t](p) + E[Z|Y,t,t](1-p)^2$

where

$ \ \ \ E[Z|Y,t,h] = Y + 2$

$ \ \ \ E[Z|Y,h,t] = Y + 1 + E[Z]$

$ \ \ \ E[Z|Y,h,h] = Y + 1 + E[Z]$

$ \ \ \ E[Z|Y,t,t] = Y + 2 + E[Z]$

Solving this for E[Z], however, does not yield the same as the simulated value. Any help in better understanding the error is much appreciated.

Will_E
  • 125
  • What about the case $\mathbb{E}[Z|Y, h,h]$? – sudeep5221 Jan 31 '24 at 03:28
  • For the event $Y,t,t$ you have done $Y+2$ tosses already but you have probability $p$ to get a head on the next toss and be finished in $Y+3$ tosses. You could also finish in $Y+4$ tosses if you get another tail and then a head. The equation $E[Z\mid Y,t,t] = Y + 2 + E[Z]$ seems to be assuming that after the $Y+2$ tosses you have to start all over again from the beginning (so at least $Y+5$ tosses), which is not the case. – David K Jan 31 '24 at 03:38
  • Have edited the expression to include the two head cases, though on the $E[Z|Y,t,t]$ the closest I had to reconstruct the next series was: $Y + 2 + (P*1 + q(1+E[Z,t,t]))$ which didn't quite work out to my sim – Will_E Feb 02 '24 at 00:29

1 Answers1

1

You just need two cases to solve this. As you mentioned, let $Y$ denote the (random) number of tosses till you see the first tail (including the toss on which you see the tail).

On the next toss, if you see a head, you will have to restart the process. Thus, $$\mathbb{E}[Z|Y, h] = Y + 1 + \mathbb{E}[Z].$$ This is simply the combination of your $(Y, t, h)$ and $(Y, h, h)$ cases.

On the next toss, if you see a tail, then you have got the first two tails of your required pattern. All you got to do is wait for a head to appear. This is because until a head appears, you will always have a sequence of two tails before the head. Let $W$ denote the (random) number of tosses till you see the first head (this is similar to $Y$, except now we are waiting for a head). Thus, $$\mathbb{E}[Z|Y, t] = Y + 1 + \mathbb{E}[W].$$

Consequently, \begin{align*} \mathbb{E}[Z|Y] & = \mathbb{E}[Z|Y, t] \cdot (1-p) + \mathbb{E}[Z|Y, h] \cdot p \\ & = Y + 1 + (1-p)\cdot \mathbb{E}[Z] + p \cdot \mathbb{E}[W]. \end{align*}

Since $\mathbb{E}[Z] = \mathbb{E}[\mathbb{E}[Z|Y]]$, we have, \begin{align*} \mathbb{E}[Z] & = \mathbb{E}[Y] + 1 + (1-p)\cdot \mathbb{E}[Z] + p \cdot \mathbb{E}[W] \\ \implies \mathbb{E}[Z] & = \frac{1}{p} \left(\mathbb{E}[Y] + 1\right) + \mathbb{E}[W]. \end{align*}

Plug in $\mathbb{E}[Y] = \dfrac{1}{1- p}$ and $\mathbb{E}[W] = \dfrac{1}{p}$ to get your required answer.

sudeep5221
  • 2,736
  • Thanks, this reduces to a very elegant form and can also extend to my four state equation by replacing the equation $E[Z|Y,t,t]=Y+2+E[Z]$ with $E[Z|Y,t,t]=Y+2+E[W]$ where $E[W]$ is the expected number of steps before arrive at a head (geometric) – Will_E Feb 24 '24 at 17:22