Package elki.math

Class StatisticalMoments


  • @Reference(authors="Erich Schubert, Michael Gertz",title="Numerically Stable Parallel Computation of (Co-)Variance",booktitle="Proc. 30th Int. Conf. Scientific and Statistical Database Management (SSDBM 2018)",url="https://doi.org/10.1145/3221269.3223036",bibkey="DBLP:conf/ssdbm/SchubertG18") @Reference(authors="T. B. Terriberry",title="Computing Higher-Order Moments Online",booktitle="",url="http://people.xiph.org/~tterribe/notes/homs.html",bibkey="web/Terriberry07") @Reference(authors="P. P\u00e9bay",title="Formulas for Robust, One-Pass Parallel Computation of Covariances and Arbitrary-Order Statistical Moments",booktitle="Sandia Report SAND2008-6212, Sandia National Laboratories",url="https://prod.sandia.gov/techlib-noauth/access-control.cgi/2008/086212.pdf",bibkey="tr/sandia/Pebay08") @Reference(authors="E. A. Youngs, E. M. Cramer",title="Some Results Relevant to Choice of Sum and Sum-of-Product Algorithms",booktitle="Technometrics 13(3)",url="https://doi.org/10.1080/00401706.1971.10488826",bibkey="doi:10.1080/00401706.1971.10488826")
    public class StatisticalMoments
    extends MeanVarianceMinMax
    Track various statistical moments, including mean, variance, skewness and kurtosis.

    References:

    An exhaustive performance study:

    Erich Schubert, Michael Gertz
    Numerically Stable Parallel Computation of (Co-)Variance
    Proc. 30th Int. Conf. Scientific and Statistical Database Management (SSDBM 2018)

    Details on higher order moments:

    T. B. Terriberry
    Computing Higher-Order Moments Online
    http://people.xiph.org/~tterribe/notes/homs.html

    General recurrence, for higher order moments, can be found in:

    P. Pébay
    Formulas for Robust, One-Pass Parallel Computation of Covariances and Arbitrary-Order Statistical Moments
    Sandia Report SAND2008-6212, Sandia National Laboratories

    But our approach also uses parts of

    E. A. Youngs and E. M. Cramer
    Some Results Relevant to Choice of Sum and Sum-of-Product Algorithms
    Technometrics 13(3), 1971

    Since:
    0.6.0
    Author:
    Erich Schubert
    • Field Detail

      • m3

        double m3
        Third moment.
      • m4

        double m4
        Fourth moment.
    • Constructor Detail

      • StatisticalMoments

        public StatisticalMoments()
        Empty constructor
      • StatisticalMoments

        public StatisticalMoments​(StatisticalMoments other)
        Constructor from other instance
        Parameters:
        other - other instance to copy data from.
    • Method Detail

      • put

        public void put​(double val)
        Description copied from class: MeanVariance
        Add a single value with weight 1.0
        Overrides:
        put in class MeanVarianceMinMax
        Parameters:
        val - Value
      • put

        public void put​(double val,
                        double weight)
        Description copied from class: MeanVariance
        Add data with a given weight.
        Overrides:
        put in class MeanVarianceMinMax
        Parameters:
        val - data
        weight - weight
      • put

        public void put​(Mean other)
        Join the data of another StatisticalMoments instance.
        Overrides:
        put in class MeanVarianceMinMax
        Parameters:
        other - Data to join with
      • put

        public StatisticalMoments put​(double[] vals,
                                      double[] weights)
        Description copied from class: Mean
        Add values with weight 1.0
        Overrides:
        put in class MeanVarianceMinMax
        Parameters:
        vals - Values
        Returns:
        this
      • getSampleSkewness

        public double getSampleSkewness()
        Get the skewness using sample variance.
        Returns:
        Skewness
      • getNaiveSkewness

        public double getNaiveSkewness()
        Get the skewness using naive variance.
        Returns:
        Skewness
      • getSampleKurtosis

        public double getSampleKurtosis()
        Get the kurtosis using sample variance. Note: this formula does not include the correction factor, such that a normal distribution should be 0.
        Returns:
        Kurtosis
      • getNaiveKurtosis

        public double getNaiveKurtosis()
        Get the kurtosis using naive variance. Note: this formula does not include the -3 term.
        Returns:
        Kurtosis
      • getSampleExcessKurtosis

        public double getSampleExcessKurtosis()
        Get the kurtosis using sample variance. Note: this formula does include the correction factor, such that a normal distribution should be 0.
        Returns:
        Kurtosis
      • getNaiveExcessKurtosis

        public double getNaiveExcessKurtosis()
        Get the kurtosis using naive variance. Note: this formula does include the -3 term.
        Returns:
        Kurtosis