Theoretical Background
Generalized Extreme Value Distribution
The GEV distribution unifies the three types of extreme value distributions. The cumulative distribution function (CDF) of a GEV random variable \(X\) with location \(\mu\), scale \(\sigma > 0\), and shape \(\xi\) is:
CDF:
The probability density function (PDF) of GEV is given by:
with support
For \(\xi = 0\) (Gumbel case),
Generalized Pareto Distribution
The CDF of exceedances \(Y = X - \mu > 0\) over threshold \(\mu\) following a GPD, with scale \(\sigma > 0\) and shape \(\xi\):
CDF:
The PDF of GPD is given by:
with support
For \(\xi = 0\) (Exponential case),
Non-stationary Framework
In a non-stationary framework, parameters are modeled as functions of covariates:
Location (linear):
Scale (exponential):
Shape (linear):
Where \(Z(t)\) is a dynamic covariate that changes with time and affects the extreme value distributions.
Non-Stationarity Configuration via Config Vector
In nsEVDx, non-stationarity is controlled via a configuration vector:
Each element in the configuration specifies the number of covariates for the location (\(\mu\)), scale (\(\sigma\)), and shape (\(\xi\)) parameters:
A value of 0 indicates stationarity.
Values > 0 indicate non-stationary modeling using the corresponding number of covariates.
This framework allows flexible, parsimonious modeling of non-stationary extreme value distributions, including covariates only where supported by data.
Log-Likelihood
The primary computational core in nsEVDx is the evaluation of the generalized
log-likelihood suitable for both stationary and non-stationary three-parameter
extreme value distributions (EVDs).
The log-likelihood form the foundation of parameter estimation, frequentist inference,
and Bayesian inference for both stationary and non-stationary EVDs.
For a sample of observations \(\{x_1, x_2, \ldots, x_n\}\), the log-likelihood is defined as
where \(f(\cdot)\) denotes the PDF of the selected EVD and \(\theta\) represents the full parameter vector.
For non-stationary models, \(\theta\) contains all regression coefficients associated with the location, scale, and shape parameters,
which may vary as functions of user-specified covariates.
Analytical Gradient
To improve computational efficiency and numerical stability,
nsEVDx provides analytical gradients of the log-likelihood with
respect to all model parameters whenever possible.
The gradient vector is defined as
where \(p\) is the number of model parameters.
Analytical gradients offer several advantages:
Faster optimization and sampling.
Improved numerical accuracy.
Reduced sensitivity to finite-difference step sizes.
Better scaling for high-dimensional non-stationary models.
Numerical Gradient Fallback
As a robustness feature, nsEVDx also provides numerical
finite-difference approximations of the gradient. This fallback option
can be used when analytical derivatives are unavailable or for validating
gradient implementations.
For a parameter \(\theta_j\), the central-difference approximation is
where \(h\) is a small perturbation.
Although numerical gradients are generally slower and less accurate than their analytical counterparts, they provide a robust fallback mechanism and facilitate validation of derivative implementations.
MCMC Applications
Both the log-likelihood and its gradient are designed for direct use in Markov Chain Monte Carlo (MCMC) algorithms and related Bayesian inference methods.
Examples include:
Random-Walk Metropolis-Hastings (RWH).
Metropolis-Adjusted Langevin Algorithms (MALA).
Hamiltonian Monte Carlo (HMC).
When analytical gradients are available they are used by default for maximum computational efficiency. Numerical gradients remain available as a fallback option, ensuring compatibility across all stationary and non-stationary GEV and GPD model configurations. ``