Mapping Exceedance Probabilities Instead of Raw Rates
A map of posterior mean relative risks looks like a map of measured quantities and is not. Two counties shaded identically may have wildly different certainty behind them, and the reader has no way to tell. This guide, part of Bayesian Disease Mapping & Rate Smoothing, covers publishing exceedance probabilities instead — a quantity that carries the uncertainty inside the value being mapped.
Problem Context & Constraints
An exceedance probability is : the posterior probability that area ’s relative risk exceeds a stated threshold . It is computed directly from the posterior draws, it is bounded between zero and one, and it answers the question a decision-maker actually has — how confident are we that this area is above the level that would trigger action.
Its advantage over the posterior mean is that certainty and magnitude are combined rather than separated. A county with a mean relative risk of 1.6 estimated from twelve cases and one with the same mean from six hundred cases receive very different exceedance probabilities, and on the map they look different, as they should.
Two constraints attach. The threshold must be chosen for a reason, not set to 1.0 by default: exceeding the study average is rarely the decision boundary, and the choice of changes which areas the map highlights more than the model does. And the resulting probabilities are posterior probabilities under a model, so they inherit every assumption in the expected counts and the priors — they are not p-values and must not be described as significance.
Prerequisites
- A fitted posterior with draws retained per area — from the BYM2 fit in Fitting a BYM2 Model for County Disease Mapping or any comparable model
- A threshold justified from policy, guideline or a pre-registered analysis plan
python3.11,numpy1.26.4,pandas2.2.2,arviz0.19.0
The three-class presentation is a deliberate restriction, and its effect on the map is the reason for it:
Step-by-Step Solution
# Exceedance probabilities and decision-threshold mapping from posterior draws.
# Pinned: numpy==1.26.4, pandas==2.2.2, arviz==0.19.0
import logging
import numpy as np
import pandas as pd
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
log = logging.getLogger("bayes.exceed")
def exceedance(draws: np.ndarray, c: float) -> np.ndarray:
"""Posterior P(RR > c) per area. `draws` is (n_draws, n_areas) of relative risk."""
if draws.ndim != 2:
raise ValueError("draws must be (n_draws, n_areas)")
p = (draws > c).mean(axis=0)
log.info("threshold %.2f: median P=%.3f, %d areas above 0.95, %d below 0.05",
c, float(np.median(p)), int((p > 0.95).sum()), int((p < 0.05).sum()))
return p
def exceedance_table(draws: np.ndarray, area_ids, thresholds=(1.0, 1.25, 1.5, 2.0)) -> pd.DataFrame:
"""One column per threshold, so the reader can see how the map depends on c."""
out = pd.DataFrame({"area_id": area_ids})
out["rr_mean"] = draws.mean(axis=0)
lo, hi = np.percentile(draws, [2.5, 97.5], axis=0)
out["rr_lo"], out["rr_hi"] = lo, hi
for c in thresholds:
out[f"p_gt_{c:g}"] = exceedance(draws, c)
return out
def decision_classes(p: np.ndarray, upper: float = 0.95, lower: float = 0.05) -> np.ndarray:
"""Three classes, not a continuous ramp.
A continuous probability ramp invites a reader to distinguish 0.62 from 0.68,
which the posterior does not support. Three classes state exactly what the
evidence supports: above, below, or not resolved."""
cls = np.full(len(p), "unresolved", dtype=object)
cls[p >= upper] = "above"
cls[p <= lower] = "below"
counts = pd.Series(cls).value_counts().to_dict()
log.info("decision classes: %s", counts)
return cls
Publishing three classes rather than a continuous probability surface is a deliberate restriction. An exceedance probability of 0.62 and one of 0.71 are not meaningfully different for any decision, and a smooth colour ramp encourages exactly that comparison. The three-class map says what the posterior can support and no more.
Validation & Edge Cases
1. Show the threshold sensitivity. The set of areas classed “above” changes with , and a reader is entitled to see how much:
INFO threshold 1.00: median P=0.512, 41 areas above 0.95, 38 below 0.05
INFO threshold 1.25: median P=0.271, 22 areas above 0.95, 96 below 0.05
INFO threshold 1.50: median P=0.118, 9 areas above 0.95, 168 below 0.05
INFO threshold 2.00: median P=0.021, 2 areas above 0.95, 231 below 0.05
INFO decision classes: {'unresolved': 77, 'below': 168, 'above': 9}
2. Report the unresolved class prominently. In the run above, 77 of 254 counties are unresolved at . That is the honest headline: nearly a third of the map cannot be classified either way, and a two-colour map would have assigned every one of them to a side.
3. Do not choose after seeing the exceedance table. The threshold is a policy quantity — a guideline level, a statutory trigger, a pre-registered effect size — and selecting it to produce a satisfying number of flagged areas is the same failure as tuning a smoothing parameter to sharpen a feature.
4. Check the posterior is adequate for tail probabilities. An exceedance probability of 0.99 estimated from 400 effective draws has a standard error of about 0.005, which is fine; one of 0.999 does not have four significant figures of support. Report probabilities to two decimal places and no more.
5. Never describe exceedance probabilities as significance. They are posterior probabilities conditional on the model. The distinction matters most in exactly the reporting context where it is most likely to be lost.
6. Consider a two-sided presentation. Public health decisions are sometimes about identifying unusually low areas — under-screened populations, under-reported conditions — and the same machinery answers that question with the inequality reversed. Publishing both tails, with the unresolved middle, gives a three-class map in each direction and often reveals that the low tail is better resolved than the high one, because a deficit against a large expectation is easier to establish than an excess against a small one.
7. Report how many areas moved class between releases. For a series, the count of areas that changed from unresolved to above, or above to unresolved, is a compact summary of what the new period added. It is far more informative than a difference map of posterior means, which is dominated by sampling noise in exactly the sparse areas the exceedance treatment was chosen to handle.
8. Do not aggregate exceedance probabilities. The probability that a region contains at least one elevated area is not the average of its areas’ exceedance probabilities, and computing it requires the joint posterior rather than the marginals. Where a regional statement is needed, compute it from the draws directly.
9. Keep the colour scheme diverging around the unresolved class. A sequential ramp implies an ordering from low to high, but the three classes are not a single ordered scale — “below” and “above” are opposite findings and “unresolved” is an absence of finding, not a middle value. A diverging scheme with a neutral centre reads correctly at a glance, and it stops a reader interpreting the unresolved class as moderate risk.
The class sizes across thresholds are the table a reader needs in order to judge how much the choice of threshold decided:
Compliance Notes
- Publish the threshold and its source in the legend, not the methods appendix. A map of is uninterpretable without knowing why 1.5.
- Keep the posterior draws, or at least the per-area quantiles, so exceedance at another threshold can be computed later without refitting.
- State the model on the map. Exceedance probabilities inherit every assumption in the expected counts, the priors and the neighbour graph.
- Apply disclosure review to the classification, since an “above” class on a small-population area is an assertion about a small group of people even though no count is shown.
Related Topics
- Bayesian Disease Mapping & Rate Smoothing — the parent guide and the reason posterior means need this treatment.
- Fitting a BYM2 Model for County Disease Mapping — where the posterior draws come from.
- Getis-Ord Gi* Hotspot Detection — the frequentist alternative, and the one whose p-values these probabilities are most often confused with.