Concept map / Exponential distribution
Share
The exponential distribution
Read the chance of waiting longer than a given time in a constant-rate process, compare the mean wait with the median, and test memorylessness.
1How long until the next request?
The Poisson page counts events that arrive at a constant rate λ. The same process also fixes how long you wait from any moment to the next event. That wait has an exponential distribution, a continuous distribution on positive times whose density is highest at zero and falls from there.
At 0.5 requests per minute, how likely is a wait of more than 3 minutes, and is a typical wait as long as the mean? Set λ and a wait t. The shaded area right of t is the chance of waiting longer. The height of the curve is a density, not a probability.
At a rate of 0.50 requests per minute, the mean wait is 2.00 minutes. The chance of waiting longer than 3.0 minutes is 22.3%. Half of all waits are shorter than 1.39 minutes, the median, and 63.2% are shorter than the mean.
More controls
2Three quiet minutes: is a request now due?
Requests arrive at a constant rate of 0.5 per minute, so the mean wait is 2 minutes. You have already waited 3 minutes with no request. What is the chance that you wait more than 2 further minutes?
3The chance of waiting past t
The distribution is set by its rate λ, the events per minute, which is also what the rate argument of R's dexp() takes. The mean wait is 1/λ. Point at a term and the matching part of the chart in section 1 lights up.
Now: P(T > 3.0) = e−0.50 × 3.0 = e−1.50 = 0.223. The mean wait is 1/0.50 = 2.00 minutes and the median is ln 2/λ = 1.39 minutes.
Why a quiet stretch changes nothing
After s quiet minutes, the chance of waiting t more is the chance of waiting t from the start. This is called memorylessness. Under a constant rate, no request is ever overdue.
4Check yourself
The tasks use the sliders and buttons in section 1 and tick themselves when you meet them.
- Set the rate so that the mean wait is 4 minutes.Now: rate 0.50 per minute, mean wait 2.00 minutes
- Find a wait t for which the chance of waiting longer is between 45% and 55%. Compare that t with the mean wait.Now: P(T > 3.0) = 22.3%, mean wait 2.00 minutes
- Simulate at least 1,000 waits and check that about 63% are shorter than the mean: get the share between 61% and 65%.Now: no waits simulated yet
5Simulate waits in R
R’s dexp(), pexp() and rexp() take the same rate λ through their rate argument, and the mean wait is 1/λ. At the page’s default λ = 0.5 the snippet prints a 0.223 chance of waiting more than 3 minutes, a median of 1.386 minutes, 0.632 of waits below the mean, and the memoryless check 0.368 = 0.368.
Exponential waiting timesShow the code
# Rate lambda = 0.5 requests per minute, as on the page.
# R's dexp() and pexp() take the same rate; the mean
# wait is 1 / rate = 2 minutes.
rate <- 0.5
# Chance of waiting longer than 3 minutes
round(pexp(3, rate, lower.tail = FALSE), 3)
# Median wait, and the share of waits below the mean
round(c(median = qexp(0.5, rate),
below_mean = pexp(2, rate)), 3)
# Memorylessness: P(T > 5 | T > 3) equals P(T > 2)
surv <- function(t) pexp(t, rate, lower.tail = FALSE)
round(c(after_3 = surv(5) / surv(3), start = surv(2)), 3)
# Simulate 1,000 waits
set.seed(5)
waits <- rexp(1000, rate)
round(c(mean = mean(waits), below_mean = mean(waits < 2)), 3)Uses base R only.
What a constant rate implies
- With events arriving at rate λ, the mean wait is 1/λ, so doubling the rate halves it.
- The chance of waiting longer than t is e−λt, the area under the density right of t. At λ = 0.5 a wait past 3 minutes has probability 0.223.
- The median wait, ln 2/λ, is about 0.69 of the mean, and 63.2% of waits are shorter than the mean. A few long waits pull the mean up.
- Time already spent waiting tells you nothing about the time left. This memoryless property is the continuous version of the geometric one, and it fails once the rate changes over time or one event makes the next more or less likely.
- Response times on test items rise from zero to a peak before they fall, since almost nobody answers in the first second. Response-time models therefore use the lognormal distribution, and the exponential stays the reference model for waits between independent events.
Recommended reading
- Introductory Statistics 2eBarbara Illowsky and Susan Dean§5.3, waiting times and the memoryless property