pystra.distributions.gev.GEVmin#
- class GEVmin(name, mean, stdv, shape, input_type=None, startpoint=None)[source]#
Bases:
DistributionGeneralized Extreme Value (GEV) distribution for minima.
This distribution unifies the different types of extreme value distributions: Gumbel (Type I), Fréchet (Type II), and Weibull (Type III).
- Arguments:
name (str): Name of the random variable
mean (float): Mean
stdv (float): Standard deviation
shape (float): Shape parameter. shape < 0.0 is Weibull, shape > 0 is Frechet.
input_type (any): Change meaning of mean and stdv
startpoint (float): Start point for seach
- Raises:
- ValueError – If shape is greater than or equal to 0.5:
- Notes:
The shape parameter shape must be less than 0.5 for finite variance.
shape < 0 is the Weibull case, shape = 0 is the Gumbel case, and shape > 0 is the Fréchet case.
This distribution is to model minima.
Methods
Cumulative distribution function
Derivatives of the CDF w.r.t.
getMeangetNamegetStartPointgetStdvDiagonal Jacobian of the marginal x-to-u transformation.
Probability density function
Plot the probability density function.
Inverse cumulative distribution function
Draw random samples from the distribution.
setStartPointUpdate the location parameter of the underlying SciPy distribution.
Update the scale parameter of the underlying SciPy distribution.
Transform from standard normal space to physical space.
Transform from physical space to standard normal space.
- dF_dtheta(x)#
Derivatives of the CDF w.r.t. each sensitivity parameter.
Returns
∂F_X(x)/∂θfor every parameter listed bysensitivity_params. The base-class implementation uses central finite differences on the CDF via_make_copy().Before computing derivatives, a reconstruction sanity check verifies that
_make_copy()(with no overrides) reproduces the current distribution. This catches both constructor failures (e.g. composite distributions) and silent mismatches (e.g. distributions whose extra constructor arguments are not stored in_ctor_kwargs).Subclasses may override this with analytical expressions for better accuracy and performance (see
NormalandLognormal).- Parameters:
x (float) – Evaluation point in physical space.
- Returns:
{param_name: ∂F/∂θ}for each parameter insensitivity_params.- Return type:
dict
- Raises:
ValueError – If the distribution cannot be faithfully reconstructed by
_make_copy().
- jacobian(u, x)#
Diagonal Jacobian of the marginal x-to-u transformation.
Returns a diagonal matrix
Jwhere the diagonal entry isf_X(x) / phi(u)(Lemaire, eq. 4.9). This is assembled into the full Jacobian by theTransformationclass.- Parameters:
u (float or array_like) – Value(s) in standard normal space.
x (float or array_like) – Corresponding value(s) in physical space.
- Returns:
Diagonal Jacobian matrix of shape
(n, n)where n is the length of the input arrays.- Return type:
ndarray
- plot(ax=None, **kwargs)#
Plot the probability density function.
- Parameters:
ax (matplotlib.axes.Axes, optional) – Axes to plot on. A new figure is created if
None.**kwargs – Additional keyword arguments forwarded to
ax.plot().
- Returns:
The axes containing the plot.
- Return type:
matplotlib.axes.Axes
- sample(n=1000)#
Draw random samples from the distribution.
Uses inverse-transform sampling via
ppf.- Parameters:
n (int, optional) – Number of samples (default 1000).
- Returns:
Array of shape
(n,)with sampled values.- Return type:
ndarray
- set_location(loc=0)#
Update the location parameter of the underlying SciPy distribution.
After updating,
meanandstdvare recomputed. This is used by the sensitivity analysis to perturb distribution parameters.- Parameters:
loc (float, optional) – New location parameter (default 0).
- Raises:
Exception – If the distribution does not wrap a SciPy frozen distribution.
- set_scale(scale=1)#
Update the scale parameter of the underlying SciPy distribution.
After updating,
meanandstdvare recomputed. This is used by the sensitivity analysis to perturb distribution parameters.- Parameters:
scale (float, optional) – New scale parameter (default 1).
- Raises:
Exception – If the distribution does not wrap a SciPy frozen distribution.
- u_to_x(u)#
Transform from standard normal space to physical space.
Applies the marginal Nataf mapping:
x = F^{-1}(Phi(u)).- Parameters:
u (float) – Value in standard normal (u) space.
- Returns:
Corresponding value in physical (x) space.
- Return type:
float
- x_to_u(x)#
Transform from physical space to standard normal space.
Applies the marginal Nataf mapping:
u = Phi^{-1}(F(x)).- Parameters:
x (float) – Value in physical (x) space.
- Returns:
Corresponding value in standard normal (u) space.
- Return type:
float
- property sensitivity_params#
Sensitivity parameters for GEVmin.
Returns
{"mean": μ, "std": σ, "shape": ξ}. The shape parameter ξ controls tail behaviour: ξ < 0 is Weibull (bounded lower tail), ξ = 0 is Gumbel, ξ > 0 is Fréchet (heavy-tailed).