Interactive Supplement · Bayesian Inference

The Surge
Decision Explorer

Adjust the prior, distributions, fares, and your observed wait time to see exactly how each parameter shifts the posterior surge probability and your optimal decision. The key insight is often surprising: the wait time tells you less than you think.

The model

Wait times follow exponential distributions under each hypothesis. The exponential is the natural choice for arrival processes — it is memoryless, meaning the time you have already waited contains no information about how much longer you must wait.

P(S | w) =  f(w|S) · q
                f(w|S) · q + f(w|¬S) · (1−q)
where f(w|S) = λ1e−λ1w and f(w|¬S) = λ0e−λ0w

Closed-form posterior

For exponential likelihoods the posterior simplifies to a logistic function of the wait time:

P(S|w) = 1 ⁄ [1 + C · e−(λ0−λ1)w]
where C = [(1−q)/q] · [λ01]

The decay rate (λ0−λ1) is always positive when surge slows arrivals, so longer waits always increase the posterior toward 1.

The decision rule

Book the ride if the expected total cost is below the alternative. The threshold wait w* is where the two are equal — an implicit equation solved numerically because the posterior itself depends on w.

Drag the sliders to explore how the threshold moves when fares, time value, or prior surge probability change. You may be surprised how robust the decision is to changes in prior belief, and how sensitive it is to changes in time value.

Interactive Explorer

Surge Decision Calculator

Adjust parameters; the posterior and decision update in real time.

Prior P(surge)30%
5%80%
Mean wait — no surge5 min
2 min15 min
Mean wait — surge12 min
5 min30 min
Normal fare$9
$5$25
Surge fare$18
$10$50
Time value ($/min)$0.50
$0.10$2.00
Alternative total cost$13.00
$5$30
Observed wait time8 min
1 min30 min
P(surge | wait)
31.2%
E[ride cost]
$15.81
Alternative cost
$13.00
Break-even wait
4 min
P(surge|w) curve — orange dot = your current wait
Decision
Take the subway — expected ride cost exceeds alternative.
← Back to puzzle