Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the distribution for the time before K successes happen in N trials?

Suppose there is a telephone center, and N people, each of whom will either call the telephone center in time T with probability p not call the telephone center with probability (1 - p). People can call only once. What is the expected time before K people call? T is distributed as a random exponential variable.

I am solving this computationally in R by drawing N observations from T, discarding samples with probability (1 - p), sorting the remaining observations and picking out the Kth one.

Is there any common way to do it analytically?

share|improve this question
Could you state the model with more detail: Is this correct: Each one of the $N$ persons, independently, makes a call with probability $p$. In the case they make the call, the waiting time until the call is distributed exponentially, with some known parameter $\lambda$. Then we ask for the $k$th order statistic of the calls? – kjetil b halvorsen Jan 18 at 19:27
Yes, that is correct. And then we ask for the time of the Kth call. – Rodrigo Stv Jan 18 at 19:32
And what will you do in the case (presumably of low probability) that $K$ is larger that the actual number of realized calls? – kjetil b halvorsen Jan 18 at 21:13
Rodrigo, Can you include your R code to play with the problem exactly as you are explaining it? – Antoni Parellada Jan 20 at 21:35

Suppose that $X_1,X_2,\dotsc,X_N$ are iid with the unit exponential distribution with density $f(x) = e^{-x}, x\ge 0$. (You can adapt the results to some other rate). But, each $X_i$ (the waiting time before person $i$ makes his phone call) will only be realized with some probability $p$, and with probability $1-p$ the call is not done and we do not observe that $X_i$. The number of realized calls $r$ has the binomial distribution $\text{bin}(N,p)$. So, reorder the variables so the realized calls (conditional on $r$) is $X_1,\dotsc,X_r$. Then, assuming that $K\le r$, you asked for the distribution of the order statistic $X_{K:r}$. Now, the theory of exponential order statistics is especially simple, so, using results taken from the book: Barry Arnold: "A First Course in Order Statistics", which I will not rederive here (but the proofs are really simple, and can be found here:, transform the order statistics to exponential spacings, given by $$ Z_1 = r X_{1:r}, \\ Z_2 = (r-1)(X_{2:r}-X_{1:r}) \\ \vdots \\ Z_r = X_{r:r}-X_{r-1:r}. $$ Then the surprising and simple result is that the variables $Z_1, Z_2, \dotsc,Z_r$ are iid distributed unit exponential.

By some algebra we get that $X_{K:r}$ has the same distribution as $\sum_{i=1}^K \frac1{r-i+1} Z_i$, that is, a linear combination of independent exponential random variables. If all the coefficients in the linear combination were equal, this would be a gamma distribution. Now it is a more complicated distribution which have been studied in, for instance.

Now, you need to decide what you want to do in the case that $K>r$. Barring that problem, what you need now is simply the mixture distribution of $X_{K:r}$ over the binomial distribution of $r$.

share|improve this answer

If N is fixed and K is random, then the number of successes K is such that $K \sim Bin(N,p)$. You are not guaranteed to get K successes for any fixed K if N is also fixed.

Alternatively, if N is random and K is fixed, and you are wondering about the distribution of the number of trials, N, until K successes are achieved, then N $\sim NegBin(K,p)$ (note that different texts have different definitions of the negative binomial -- sometimes they only count failures rather than total trials).

The sum of k IID standard Expos is Gamma(k,1).

Assuming the negative binomial scenario, you have $T \mid N \sim Gamma(N,1)$ and $N \sim NegBin(K,p)$.

I don't know if there is a nice formula for this hierarchical model but you should be able to get the expectation easily using the law of total expectation, conditioning on N. E(T) = E(E(T|N))

share|improve this answer

The time is the $K$'th order statistic of $N'$ iid exponential distributions where $N'$ is binomial distributed with parameters $N, p$. Each order statistic is distributed as in this solution described below, which you mix over the outcomes of $N'$.

Let $\lambda$ be the rate of $T$. Then the first order statistic of $N'$ exponential distributions having rate $\lambda$ is exponentially distributed with rate $N' \lambda$ since it's as if $N'$ Poisson processes race against each other and the winner's time is the same as the waiting time of the superposition. The second order statistic adds on an exponential distribution with rate $(N'-1)\lambda$ since one less Poisson process is racing, and so on...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.