Fitting¶
rainfall_thresholds.fit ¶
Fitting a threshold to the rainfall conditions that triggered landslides.
The frequentist approach of Brunetti et al. (2010) and Peruccacci et al.
(2012): fit log10 I = log10 alpha - beta log10 D by least squares over
the (D, I) pairs of known landslide-triggering events, then lower the line
until a chosen share of the events sits below it. The threshold at the 5th
percentile, T5, leaves 5 % of the triggering events beneath.
Where Peruccacci et al. take the percentile from a Gaussian fitted to a kernel density of the residuals, this module takes it from the residuals themselves (linear interpolation between order statistics). The two agree when the residuals are close to normal; the empirical one needs no assumption about their shape.
ThresholdFit
dataclass
¶
A fitted threshold and what it was fitted on.
fit_threshold ¶
fit_threshold(events: Iterable[tuple[float, float]], *, percentile: float = 5.0) -> ThresholdFit
Fit I = alpha * D^(-beta) at percentile to (duration_h, intensity_mm_h) pairs.
Pairs with a non-positive duration or intensity are skipped: they have no logarithm. At least three usable pairs are needed.
percentile_of ¶
percentile_of(values: list[float], percentile: float) -> float
The percentile-th percentile, interpolating linearly between order statistics.
The same definition as NumPy's default (method="linear").