Pure JAX functions. Stateless, differentiable, composable. No classes, no NumPyro dependency, no xarray — just (Array, ...) → Array.
All functions are compatible with jax.jit, jax.grad, and jax.vmap. They implement the mathematical core of extreme value theory; the NumPyro Distribution wrappers at Layer 1 compose these into the standard probabilistic interface.
GEV Functions (xtremax._src.gev)¶
The Generalized Extreme Value distribution unifies three classical types under one parameterization.
CDF:
with the convention (Gumbel limit).
Support: .
gev_log_prob(x, loc, scale, shape)¶
Mathematical definition:
where . For : where .
Numerical method: Uses jnp.where to branch between and (Gumbel) to avoid division by zero. Gradient-safe via JAX autodiff.
Complexity: element-wise.
def gev_log_prob(
x: Float[Array, "..."],
loc: Float[Array, "..."],
scale: Float[Array, "..."],
shape: Float[Array, "..."],
) -> Float[Array, "..."]:gev_cdf(x, loc, scale, shape)¶
def gev_cdf(x, loc, scale, shape) -> Array:gev_icdf(q, loc, scale, shape)¶
Quantile function (inverse CDF):
For : .
def gev_icdf(q, loc, scale, shape) -> Array:gev_return_level(period, loc, scale, shape)¶
-year return level:
This is the level expected to be exceeded on average once every years.
def gev_return_level(period, loc, scale, shape) -> Array:gev_mean(loc, scale, shape)¶
Undefined for (infinite mean — heavy tail).
gev_variance(loc, scale, shape)¶
GPD Functions (xtremax._src.gpd)¶
The Generalized Pareto Distribution models threshold exceedances .
CDF:
For : (exponential).
gpd_log_prob(y, scale, shape)¶
def gpd_log_prob(y, scale, shape) -> Array:gpd_cdf(y, scale, shape)¶
gpd_survival(y, scale, shape)¶
Survival function:
gpd_return_level(period, scale, shape, rate)¶
-year return level for POT:
where is the threshold and is the exceedance rate (expected exceedances per year).
def gpd_return_level(period, scale, shape, rate) -> Array:gpd_mean_excess(scale, shape)¶
Mean excess function: for .
Point Process Functions (xtremax._src.point_process)¶
poisson_log_likelihood(event_times, rate, T)¶
Homogeneous Poisson process log-likelihood:
where is the rate and is the observation window.
inhomogeneous_poisson_log_likelihood(event_times, log_intensity_fn, T)¶
Inhomogeneous Poisson process:
The integral is approximated numerically (trapezoidal or quadrature).
hawkes_log_likelihood(event_times, background_rate, alpha, beta)¶
Hawkes self-exciting process:
extremal_index(exceedances, threshold, run_length)¶
Extremal index — measures clustering of threshold exceedances. means no clustering (independent exceedances). Estimated via the runs method:
Max-Stable Functions (xtremax._src.max_stable)¶
brown_resnick_extremal_coeff(h, variogram_fn)¶
Brown-Resnick extremal coefficient:
where is the semivariogram and is the standard normal CDF.
smith_extremal_coeff(h, cov_matrix)¶
schlather_extremal_coeff(h, correlation_fn)¶
extremal_t_extremal_coeff(h, correlation_fn, df)¶
pairwise_log_likelihood(z, extremal_coeff_fn, coordinates)¶
Composite pairwise log-likelihood for max-stable processes (Padoan et al. 2010):
where is the bivariate density derived from the bivariate CDF:
and is the Pickands dependence function determined by .
madogram(data, coordinates, n_bins)¶
F-madogram for nonparametric extremal coefficient estimation:
Variogram Functions (xtremax._src.variogram)¶
Used by max-stable models and spatial GP layers.
power_variogram(h, range, smoothness)¶
matern_variogram(h, range, smoothness, sill)¶
where is the modified Bessel function of the second kind.