environmentaltools.temporal.l_mom

environmentaltools.temporal.l_mom(data, func)[source]

Estimate distribution parameters using L-moments method.

Computes distribution parameters from sample L-moments (linear combinations of order statistics). Provides robust estimates especially for small samples.

Parameters:
  • data (array-like) – Sample data to fit

  • func ({'genpareto', 'expon', 'genextreme', 'gumbel_r'}) –

    Distribution type to fit:

    • ’genpareto’: Generalized Pareto Distribution (3 parameters)

    • ’expon’: Exponential distribution (2 parameters, k=0)

    • ’genextreme’: Generalized Extreme Value distribution (3 parameters)

    • ’gumbel_r’: Gumbel distribution (2 parameters, k=0)

Returns:

Distribution parameters [k, mu, sig] where:

  • kfloat

    Shape parameter (0 for Exponential and Gumbel)

  • mufloat

    Location parameter

  • sigfloat

    Scale parameter

Return type:

list

Notes

L-moments are linear combinations of order statistics:

  • λ₁ = E[X] (mean)

  • λ₂ = E[X_{2:2} - X_{1:2}]/2 (scale)

  • λ₃ related to skewness

L-moment ratios (τ₃ = λ₃/λ₂) are used to estimate shape parameters.

For GEV, the shape parameter k is solved numerically from: 2(1-3^(-k))/(1-2^(-k)) - 3 = τ₃

Sample L-moments use plotting positions: p_i = (i-0.35)/n

References

Hosking, J.R.M. (1990). “L-moments: Analysis and Estimation of Distributions Using Linear Combinations of Order Statistics”. Journal of the Royal Statistical Society, Series B, 52(1), 105-124.

Examples

>>> import numpy as np
>>> data = np.random.exponential(2.0, 100)
>>> k, mu, sig = l_mom(data, 'expon')
>>> print(f"Exponential: k={k:.3f}, mu={mu:.3f}, sig={sig:.3f}")