1
$\begingroup$

I'm trying to calculate an appropriate timeout time for a real time simulator that I'm writing:

For p = probability of success, the time for a successful request = m, and the time for a failed attempt = f. What is the average time for 5 successful requests?

  • 0
    can you be more specific about the problem? when you say "time for a successful request=m" what does that mean?2012-10-26

1 Answers 1

0

Assume requests are independent. Denote the number of unsuccessful requests until the $r$th success by $X$. Then $X$ has a negative binomial distribution, $P(X=k) = {k+r-1 \choose k} p^{r-1}(1-p)^kp $ because in the first $k+r-1$ attempts there are $k$ failures and $r-1$ successes, while the $(k+r)$-th attempt is successful.

$X$ has the same distribution as the sum of $r$ independent geometrically distributed random variables, thus its expectation is $\mathrm{E}X= r\cdot(1-p)/p$.

Now for the waiting time $Y$. Clearly $Y = rm + Xf$. Thus $\mathrm{E}Y = rm +\mathrm{E}Xf$. Plugging in $\mathrm{E}X$ gives $\mathrm{E}Y = rm + (r(1-p)/p)f$. Plug in $r=5$ to finish.