# Survival analysis with biased coins

Suppose I have five biased coins $$c1, c2, c3, c4$$ and $$c5$$ each with different probabilities of getting heads.

• Pr. heads for coin $$c1=0.5$$
• Pr. heads for coin $$c2=0.8$$
• Pr. heads for coin $$c3=0.6$$
• Pr. heads for coin $$c4=0.4$$
• Pr. heads for coin $$c5=0.2$$

Each coin is flipped once in numerical order, and it takes me $$10$$ seconds to flip each coin. When you get a head you stop and that cycle is over.

Let $$T$$ be a random variable that describes the time of the event that you get a head; hence, $$T$$ can take on values $${10, 20, 30, 40, 50}$$. I am interested in modeling the problem with survival analysis and I want to calculate the hazard function for each outcome.

The discrete hazard function is defined as follows

$$\lambda_j=Pr(T=t_j|T \geq t_j) = \frac{f_j}{S_j}$$

To illustrate lets calculate the hazard for $$t=30$$ sec - which means that I have to get a head only on the third coin $$c3$$

$$\lambda_j=Pr(T=t_c3|T \geq t_c3) = \frac{Pr(C1=tails)Pr(C2=tails)Pr(C3=heads)}{Pr(C3=tails)Pr(C4=tails)Pr(C5=heads)+Pr(C3=tails)Pr(C4=heads)+Pr(C3=heads)}$$

At first I was confused since $$p$$s were different and I could not use a distribution i.e.: Geometric. So is this the correct approach to this problem I created? Also, is there another distribution or shortcut that I can use? Something vague about renewal processes comes to mind.

Thank you

I will generalise your problem to allow an arbitrary sequence of binary variables with any probabilities. Consider sequences of times $$t_1 < t_2 < t_3 < \cdots$$ and outcomes $$X_1,X_2,X_3,...$$ with respective probabilities $$\theta_1, \theta_2, \theta_3,...$$. (In your game this represents the probability of a head on a coin.) These outcomes are independent with $$X_i \sim \text{Bern}(\theta_i)$$ and the overall time for your game is the time until the first success, which is:

$$T \equiv \min \{ t_i | X_i = 1 \}.$$

The hazard function is:

\begin{aligned} \lambda_T(t_i) &= \mathbb{P}(T=t_i | T \geqslant t_i) \\[6pt] &= \mathbb{P}(X_i=1 | X_1 = \cdots = X_{i-1} = 0 ) \\[6pt] &= \mathbb{P}(X_i=1) = \theta_i. \\[6pt] \end{aligned}

The marginal density is:

\begin{aligned} p_T(t_i) &= \mathbb{P}(T = t_i) \\[6pt] &= \mathbb{P}(X_i=1 , X_1 = \cdots = X_{i-1} = 0 ) \\[6pt] &= \mathbb{P}(X_i=1) \prod_{j=1}^{i-1} \mathbb{P}(X_j=0). \\[6pt] &= \theta_i \prod_{j=1}^{i-1} (1-\theta_j). \\[6pt] \end{aligned}

You can see that the hazard function is extremely simply in this case, and that is not surprising, given that conditioning on $$T \geqslant t_i$$ is equivalent to starting the game at the $$i$$th flip (which does not change the structure of the game very much).

Application to your problem: In your question you are looking for the hazard function at the third time $$t_3$$. You should get:

$$\lambda_T(t_3) = \theta_3 = 0.6.$$

In your own working you have tried to use the representation of the hazard function using the survival function as the denominator. This has been done incorrectly, since the expression you have used in the denominator is not equal to the survival probability (it is missing probabilities for coins 1 and 2).

• Yes thank you - what about my example? Does it match your result? Apr 14 '19 at 3:34
• Ben please - your answer is great - but just so I can get it 100% - why do I need the probability of 1 and 2 if survival is defined as $1-Ft$; so greater or equal than 3. Apr 14 '19 at 3:54
• I the part where you expand out $S_3$, you have included three terms, for $T=3,4,5$, but in each of those terms, the probability of that value of $T$ is not calculated correctly. You have treated each term in $S_3$ as being conditional on $T \geqslant 3$, which it is not. You need to add the probabilities of tails on the first two flips to each of these.
– Ben
Apr 14 '19 at 3:57
• Like this: $$\lambda_j=Pr(T=t_c3|T \geq t_c3) = \frac{Pr(C1=tails)Pr(C2=tails)Pr(C3=heads)}{Pr(C1=tails) + Pr(C1=tails)Pr(C2=tails) + Pr(C3=tails)Pr(C4=tails)Pr(C5=heads)+Pr(C3=tails)Pr(C4=heads)+Pr(C3=heads)}$$ Apr 14 '19 at 4:02
• No, now you have added to additional terms - remove those first two terms from the denominator, but incorporate the probability that the first two flips are tails into the other terms.
– Ben
Apr 14 '19 at 4:39