The exponential modeled one waiting time. Sum several of them, total rainfall accumulated from several storm pulses, and you get the gamma: strictly positive, right-skewed, and far more flexible than the exponential it generalizes.
meteorology_regional_rainfall.csv holds rainfall_inches for 1,000 station-seasons
(plus station and season). We fit a gamma and use its tail to estimate flood risk.
Fit by the Method of Moments
The gamma's two parameters fall straight out of the mean and variance: shape α = mean²/var = 2.93 and scale β = var/mean = 1.38. This method of moments reproduces the sample mean (4.04) and variance (5.57) by construction.
Matching two moments is a start, not a verdict. The companion notebook validates the fit with a gamma QQ plot (points on the diagonal) and a formal Kolmogorov-Smirnov test (D ≈ 0.02, p ≈ 0.87, so we cannot reject the Gamma), so the distribution is a defensible model for the rainfall totals rather than just a curve that happens to look right.
With shape ≈ 2.9 the gamma is humped, not a pure exponential decay, and its skewness of 1.2 confirms the long right tail. That asymmetry is exactly why a symmetric normal would mislead here: it would put real probability on impossible negative rainfall and badly understate the wet extremes.
Flood Risk in the Tail
Flood planning is a tail question. P(rainfall > threshold) gives the chance of an extreme season, and its reciprocal is the return period, the average wait between such events.
| Threshold | P(exceed) | return period | observed |
|---|---|---|---|
| > 8 in | 0.066 | 1-in-15 seasons | 0.069 |
| > 10 in | 0.023 | 1-in-44 seasons | 0.021 |
| > 12 in | 0.007 | 1-in-139 seasons | 0.006 |
| > 15 in | 0.001 | 1-in-832 seasons | 0.001 |
A season above 8 inches is roughly a 1-in-15 event, above 12 inches about 1-in-139, the return periods engineers design drainage and levees against. The 99th-percentile season tops 11 inches; sizing infrastructure to the mean of 4 inches would ignore exactly the floods that matter. The tail is the whole point.
The Gamma Generalizes the Exponential
The gamma's structure connects it to the previous chapter. A gamma with integer shape α is the sum of α independent exponential waits. With α = 1 it is the exponential; larger α stacks more waits and grows the hump.
In the notebook, the sum of three exponential waits matches a Gamma(shape 3), and our fitted shape (≈ 2.9) is close, as if each wet season were a few independent rainfall pulses added together. This is the family link: the exponential is a gamma with shape 1, and the gamma is the natural model for any positive quantity built from several exponential-like contributions, rainfall, insurance claim totals, queue waiting times, and more.
Run the rainfall analysis
The companion notebook fits the gamma by the method of moments, overlays its density on the rainfall histogram, computes exceedance probabilities and return periods from the tail, and rebuilds the gamma as a sum of exponential waits, every number from code.
View opens the rendered notebook instantly (no setup). Open in Colab runs &
edits it live in your browser. To run locally, install numpy, pandas, scipy,
and matplotlib and launch jupyter notebook.
🎓 Key Takeaways
- ✓Rainfall totals are gamma: positive, right-skewed, with shape α and scale β.
- ✓Method of moments: α = mean²/var = 2.93, β = var/mean = 1.38, reproducing the data's mean and variance.
- ✓Flood risk is the tail: a >8-inch season is 1-in-15, >12 inches is 1-in-139; the 99th percentile tops 11 inches.
- ✓A normal would mislead, putting probability on negative rainfall and understating extremes.
- ✓Gamma generalizes the exponential: shape 1 is exponential; larger shape is a sum of exponential waits.
Quiz: Test Yourself
Eight quick questions on the gamma case study. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved, so you can hop back to the chapter and return anytime.