This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / stats / _probability_distribution / _ProbabilityDistribution / lmoment

function

scipy.stats._probability_distribution:_ProbabilityDistribution.lmoment

source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_probability_distribution.py:343

Signature

def lmoment(self, order, *, standardize, method)

Summary

L-moment or L-moment ratio of positive integer order.

Extended Summary

The L-moment of order of a continuous random variable is:

where are the order statistics of an independent sample of size .

The L-moment can also be expressed in terms of the random variable's inverse cumulative distribution function and the shifted Legendre polynomial :

For order , the "standardized" L-moment, known as the L-moment ratio, is the L-moment normalized by the L-moment of order 2, resulting in a scale invariant quantity:

Parameters

order : int

The positive integer order of the L-moment; i.e. in the formulae above.

standardize : bool, default: True

Whether to return L-moment ratios for orders 3 and higher. L-moment ratios are analogous to standardized conventional moments: they are the non-standardized L-moments divided by the L-moment of order 2.

method : {None, 'formula', 'general', 'order_statistics', 'quadrature_icdf', 'cache'}

The strategy used to evaluate the L-moment. By default (None), the infrastructure chooses between the following options, listed in order of precedence.

  • 'cache': use the value of the L-moment most recently calculated via another method

  • 'formula': use a formula specific to the distribution.

  • 'general': use a general result that is true for all distributions with finite L-moments; for instance, the first L-moment is identically equal to the mean.

  • 'quadrature_icdf': numerically integrate according to the definition in terms of the inverse cumulative distribution function.

  • 'order_statistics': compute according to the definition in terms of order statistics.

Not all method options are available for all orders and distributions. If the selected method is not available, a NotImplementedError will be raised.

Returns

out : array

The L-moment of the random variable of the specified order.

Notes

L-moments are only defined for distributions with finite mean. If a formula for the L-moment is not specifically implemented for the chosen distribution, SciPy will attempt to compute the moment via a generic method, which may yield a finite result where none exists. This is not a critical bug, but an opportunity for an enhancement.

SciPy offers only basic capabilities for working with L-moments. For more advanced features, consider the lmo package [2].

Examples

Instantiate a distribution with the desired parameters:
import numpy as np
from scipy import stats
X = stats.Normal(mu=1., sigma=2.)
✓
Evaluate the first L-moment:
X.lmoment(order=1)
X.lmoment(order=1) == X.mean() == X.mu
✗
np.True_
Evaluate the second L-moment:
X.lmoment(order=2)
✗
np.float64(1.1283791670955126)
np.allclose(X.lmoment(order=2), X.sigma / np.sqrt(np.pi))
✓
True
Evaluate the fourth L-moment ratio, that is, the L-kurtosis:
X.lmoment(order=4)
X.lmoment(order=4) == X.lmoment(order=4, standardize=False) / X.lmoment(order=2)
✗
np.True_

See also

moment
order_statistic

Aliases

  • scipy.stats._distribution_infrastructure._ProbabilityDistribution.lmoment