Repository: scipy/scipy
File: scipy/stats/_probability_distribution.py (Python)

Code before:
        4.0
        >>> X.moment(order=2, kind='central') == X.variance() == X.sigma**2
        True

        Evaluate the fourth standardized moment:

        >>> X.moment(order=4, kind='standardized')
        3.0
        >>> X.moment(order=4, kind='standardized') == X.kurtosis(convention='non-excess')
        True

        """  # noqa:E501
        raise NotImplementedError()

    @abstractmethod
    def lmoment(self, order, kind, *, method):
        r"""L-moment or L-moment ratio of positive integer order.

        The L-moment of order :math:`n` of a continuous random variable :math:`X` is:

        .. math::

            \lambda_n(X) = \frac{1}{n} \sum_{k=0}^{n-1} (-1)^{k} {{n-1}\choose k} E[X_{(n-k)}]

        where :math:`X_{(1)}, \dots, X_{(r)}, \dots, X_{(n)}` are the order statistics
        of an independent sample of size :math:`n`,

        The L-moment can also be expresed in terms of the random variable's inverse
        cumulative distribution function :math:`F^{-1}` and the shifted Legendre
        polynomial :math:`\widetilde{P}_{n-1}`:

        .. math::

            \lambda_n(X) = \int_0^1 F^{-1}(p) \widetilde{P}_{n-1}(p) dp

        For order :math:`n \geq 3`, 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:

        .. math::

            \tau_n(X) = \frac{\lambda_n(X)}
                             {\lambda_2(X)}

        Parameters
        ----------
        order : int
            The positive integer order of the L-moment; i.e. :math:`n` in the formulae
            above.
        standardized : bool, default: False
            Indicates whether to return the L-moment (default) or standardized L-moment;

Review comment (suggestion):
```suggestion
        of an independent sample of size :math:`n`.
```

Code after:
        4.0
        >>> X.moment(order=2, kind='central') == X.variance() == X.sigma**2
        True

        Evaluate the fourth standardized moment:

        >>> X.moment(order=4, kind='standardized')
        3.0
        >>> X.moment(order=4, kind='standardized') == X.kurtosis(convention='non-excess')
        True

        """  # noqa:E501
        raise NotImplementedError()

    @abstractmethod
    def lmoment(self, order, kind, *, method):
        r"""L-moment or L-moment ratio of positive integer order.

        The L-moment of order :math:`n` of a continuous random variable :math:`X` is:

        .. math::

            \lambda_n(X) = \frac{1}{n} \sum_{k=0}^{n-1} (-1)^{k} {{n-1}\choose k} E[X_{(n-k)}]

        where :math:`X_{(1)}, \dots, X_{(r)}, \dots, X_{(n)}` are the order statistics
        of an independent sample of size :math:`n`.

        The L-moment can also be expressed in terms of the random variable's inverse
        cumulative distribution function :math:`F^{-1}` and the shifted Legendre
        polynomial :math:`\widetilde{P}_{n-1}`:

        .. math::

            \lambda_n(X) = \int_0^1 F^{-1}(p) \widetilde{P}_{n-1}(p) dp

        For order :math:`n \geq 3`, 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:

        .. math::

            \tau_n(X) = \frac{\lambda_n(X)}
                             {\lambda_2(X)}

        Parameters
        ----------
        order : int
            The positive integer order of the L-moment; i.e. :math:`n` in the formulae
            above.
        standardize : bool, default: True
            Whether to return L-moment ratios for orders 3 and higher. L-moment ratios