Suppose buses arrive at a stop after independent random intervals of minutes, where is uniformly distributed between 10 and 20. It is natural to wonder how long one is expected to wait from some random point in time until the first bus arrives. For example on the one hand the bus could arrive immediately, or one could be unlucky with time just after the previous bus left and we could wait as many as 20 minutes for the next bus. Interestingly this waiting time is no longer uniformly distributed.
In general if interarrival times have (cumulative) distributive function and mean , the following is true.
The probability density of waiting time is
Applying this formula to the above bus example, we have and
Using (1), the probability density function of waiting time is plotted below.
We see that the density function is a rectangle (centred at and having 2/3 of the total probability mass) appended to a triangle (having centroid at and 1/3 of the total probability mass). From this we can say the expected waiting time is minutes. This is more than half the mean interarrival time of 15/2 = 7.5 minutes that one might initially expect.
To prove (1), we shall first look at the length of a particular inter-arrival period that contains a given point , and the waiting time can then be the part of this after time . We make use of the following result from alternating renewal process theory :
Proposition: Consider a system that alternates between on and off states where:
- the on durations are independent and identically distributed according to random variable , and
- the off durations are independent and identically distributed according to random variable .
(However it may be that and are dependent in general.)
Let be the probability that the system is in the on state at time . Then if has finite mean and is non-lattice (i.e. takes on more values than just an integral multiple of some positive number), then
This result is easily understood: the probability the system is on at a given time is the mean on time divided by the mean total cycle time. However it is based on the key renewal theorem, a limit theorem which is not so straightforward to prove.
Now consider a random process with independent and identically distributed interarrival times with common distribution with probability distribution function . Consider the length of the particular interarrival period that contains some point . We shall determine the distribution of . We define an on-off system as follows.
- If is greater than some given , let our system be on for the entire interarrival period (i.e. ).
- If the length of the interarrival period is less than or equal to let our system be off for the interarrival period (i.e. ).
Equivalently, , and if has probability density , differentiating both sides of this equation gives the probability density function of the length of interarrival period containing a point :
Intuitively, longer periods are more likely to contain the point , with probability in direct proportion to the length of the interval. Hence the original density is scaled by the length and then normalized by to make a valid probability density. defined by (3) is known as the size-biased transform of .
Note that the length of the particular interarrival interval is stochastically larger than any of the identically distributed interarrival times . In other words,
This is the so-called inspection paradox, which can be proved by the Chebyshev correlation inequality (a form of rearrangement inequality) which states than when and are functions of the random variable having the same monotonicity (i.e. both non-increasing or both non-decreasing), then and are non-negatively correlated:
Applying this result with the non-decreasing functions and (which is 1 when and 0 otherwise):
The inspection paradox is a form of sampling bias, where results are modified as a result of a non-intended sampling of a given space. Another example is the friendship paradox, where in a graph of acquaintances with vertices having some differing degrees (number of friends), the average degree of a friend is greater than the average degree of a randomly chosen node. For one thing a friend will never have degree zero while a randomly chosen person might! The degree of a friend is an example of sampling from a size-biased distribution.
How about the distribution of the waiting time for the next arrival? For fixed we consider another on-off system where this time the system is in an off state during the last units of time of an interarrival interval, and in the on state otherwise. That is,
Alternatively this form can be found by imagining our time to be uniformly distributed within the current interarrival interval, thus partitioning our inspection interarrival interval into and , where is the uniform random variable . Hence the distribution of is found by integrating over the distribution of and using the fact that from (3):
Differentiating both sides of (8) or (9) with respect to leads to (1), the probability density function of waiting time .
Finally, if we wish to find any moments we write where and is independent of the size-biased variable :
Hence we can say that the mean waiting time for the next arrival from any given point in time is more than half the mean interarrival time, unless (i.e. zero variance in , meaning is deterministic).
For example, in the initial bus example where :
so and . Hence the waiting time has mean 7.78 and standard deviation of .
 S. Ross, Stochastic Processes, John Wiley & Sons, 1996.
 R. Arratia and L. Goldstein, Size bias, sampling, the waiting time paradox, and infinite divisibility: when is the increment independent? Available at arxiv.org/pdf/1007.3910.
 This answer by Did on math.stackexchange.