Waiting at a constant rate
Some events arrive at a steady rate (lambda) per unit of time: calls to a help desk, or failures of a machine part. Each moment carries the same small chance of the event, whatever has happened before. The waiting time until the next event then has the exponential distribution, written .
Rule: Exponential distribution
is a rate, in events per unit of time; is a time, in the same unit. The density is 0 for : a wait cannot be negative. The tail , the chance of waiting longer than , falls by the factor each unit of time.
The total area is 1, the exponential tail of lesson 2.6.3: . is the area from 0 to , (lesson 2.5.3), and its slope is again.
A machine part fails at a rate of 0.2 a year. Its life in years has and .
A help desk gets 3 calls an hour. The wait for the next call has per hour, which is per minute. Waiting more than 30 minutes has probability : the same answer in either unit, as long as and agree.
The density starts at its peak, , so short waits are the likeliest. With per hour that peak is 3, above 1: a density, not a probability (lesson 5.4.1).
Case study 2.5.5 used this density for the time until a borrower defaults, with the hazard rate.
Mean and variance by parts
The mean wait is an improper integral (lesson 2.6.3) that needs integration by parts (lesson 2.6.2). Take and , so and :
The bracket is 0 at both ends: at 0 because of the factor , and at infinity because outgrows (lesson 2.1.3). Parts again gives .
Rule: Mean and variance of the exponential
A rate of 0.2 failures a year means a mean life of 5 years. The standard deviation, , equals the mean.
Try it
quad checks the total area, the mean and for , with math.inf as the upper limit (lesson 2.6.3).
Each line prints the integral next to the formula. round hides float noise in the last digits.
Quantiles and the median
Solve with logs (lesson 1.4.4) to get the quantile.
Rule: Exponential quantiles
The median is about 0.69 of the mean: the long right tail pulls the mean up. For a decaying atom the median is called the half-life.
For the machine part, the median life is years, shorter than the mean of 5. Only of parts outlive the mean, whatever is.
Raise : the curve starts higher and falls faster, and the dashed mean moves left. The interval starts as ; it holds 0.6321 at every , since .
Explore
The curve is a density: probabilities are areas under it. Change the parameters, then set an interval and read the shaded area.
The dashed line is the mean.
- Probability
- P(0 ≤ X ≤ 1) = 0.6321
- Mean
- 1
- Variance
- 1, so the standard deviation is 1
Try it
SciPy's expon takes scale , the mean, not the rate. NumPy's rng.exponential does the same.
The last line is the trap: expon(3) shifts the density to start at 3, so its mean is 4. A rate of 3 is expon(scale=1/3).
Memorylessness
A part that has already run for 3 years fails at the same rate as a new one. So the chance it lasts 2 more years is the chance that a new part lasts 2. By conditional probability (lesson 5.1.3), the event "more than 5" is inside "more than 3":
That is exactly. The 3 years already survived drop out.
Rule: Memorylessness
For . Having waited tells you nothing about the further wait. The exponential is the only continuous distribution with this property; the geometric (lesson 5.2.2) is its discrete cousin.
The exponential density with , and its tail beyond 2 moved back to 0 and divided by its area, 0.368. The result is the original density: beyond one more unit lies 0.607 of it, as for a new start.
The rule only fits a constant rate. A part that wears out fails more often as it ages, so its life is not exponential. The formula would understate the risk for old parts.
Try it
One seeded run draws a million lifetimes with mean 5 and keeps the parts still working at 3 years.
Among those, the share that lasts beyond 5 is close to 0.67032, the share of new parts lasting beyond 2. Their mean remaining life is close to 5 years, the mean of a new part.
Exponential gaps make Poisson counts
Calls arrive at rate , so the gaps between them are independent exponential waits. Count the calls in a window of length and you get a Poisson count with mean (lesson 5.2.3). The two descriptions fit together: no call in the window is the same event as a first wait longer than .
Rule: Exponential and Poisson
is the number of events in a window of length , and the wait for the first. The rate links the two: the mean count is , and the mean gap is .
For the help desk, 3 calls an hour, simulate 100,000 hours. Each hour adds exponential gaps of mean hour until it passes 1, and counts the calls.
| calls in the hour | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|---|
| share of simulated hours | 0.05 | 0.1502 | 0.2225 | 0.2254 | 0.1667 | 0.1003 | 0.0517 |
| Poisson(3) pmf | 0.0498 | 0.1494 | 0.224 | 0.224 | 0.168 | 0.1008 | 0.0504 |
The shares are from one seeded run and agree with the pmf to about two decimal places. The mean count is 2.99969, close to .
Try it
rng.exponential(scale=1/3, size=(100_000, 20)) draws 20 gaps for each hour; cumsum turns them into arrival times. More than 20 calls in an hour has probability below , so 20 is enough.
(times <= 1).sum(axis=1) counts the arrivals inside each hour.
Lesson 5.4.3 turns to the normal distribution, the bell curve of lesson 2.6.3.
Common mistakes
- SciPy and NumPy take the mean, not the rate.
expon(scale=1/lam)andrng.exponential(scale=1/lam);expon(3)is a shifted density. - Match the units. A rate per hour needs times in hours: 30 minutes is .
- Half the waits are shorter than the median, , not the mean. Only 0.3679 of them exceed the mean.
- The past does not count. is , not .
- The variance is , not ; the standard deviation equals the mean.
- Only a constant rate gives an exponential. Wear-out, or a rate that changes through the day, breaks memorylessness.
The exponential distribution
0 of 12 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Summary card
- A wait at a constant rate has density for , distribution function and tail . Keep and in the same time unit.
- and , by parts; the median is , and .
- Memorylessness: .
- Exponential gaps at rate give a count in a window of length , and .
- In SciPy and NumPy,
scaleis the mean .