pystra.distributions.gev.GEVmin#

class GEVmin(name, mean, stdv, shape, input_type=None, startpoint=None)[source]#

Bases: Distribution

Generalized 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

cdf

Cumulative distribution function

dF_dtheta

Derivatives of the CDF w.r.t.

getMean

getName

getStartPoint

getStdv

jacobian

Diagonal Jacobian of the marginal x-to-u transformation.

pdf

Probability density function

plot

Plot the probability density function.

ppf

Inverse cumulative distribution function

sample

Draw random samples from the distribution.

setStartPoint

set_location

Update the location parameter of the underlying SciPy distribution.

set_scale

Update the scale parameter of the underlying SciPy distribution.

u_to_x

Transform from standard normal space to physical space.

x_to_u

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 by sensitivity_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 Normal and Lognormal).

Parameters:

x (float) – Evaluation point in physical space.

Returns:

{param_name: ∂F/∂θ} for each parameter in sensitivity_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 J where the diagonal entry is f_X(x) / phi(u) (Lemaire, eq. 4.9). This is assembled into the full Jacobian by the Transformation class.

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, mean and stdv are 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, mean and stdv are 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).

pdf(x)[source]#

Probability density function

cdf(x)[source]#

Cumulative distribution function

ppf(u)[source]#

Inverse cumulative distribution function