Class StatisticalMoments
- java.lang.Object
-
- elki.math.Mean
-
- elki.math.MeanVariance
-
- elki.math.MeanVarianceMinMax
-
- elki.math.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.htmlGeneral 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 LaboratoriesBut 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 Summary
Fields Modifier and Type Field Description (package private) double
m3
Third moment.(package private) double
m4
Fourth moment.-
Fields inherited from class elki.math.MeanVarianceMinMax
max, min
-
Fields inherited from class elki.math.MeanVariance
m2
-
-
Constructor Summary
Constructors Constructor Description StatisticalMoments()
Empty constructorStatisticalMoments(StatisticalMoments other)
Constructor from other instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getNaiveExcessKurtosis()
Get the kurtosis using naive variance.double
getNaiveKurtosis()
Get the kurtosis using naive variance.double
getNaiveSkewness()
Get the skewness using naive variance.double
getSampleExcessKurtosis()
Get the kurtosis using sample variance.double
getSampleKurtosis()
Get the kurtosis using sample variance.double
getSampleSkewness()
Get the skewness using sample variance.void
put(double val)
Add a single value with weight 1.0StatisticalMoments
put(double[] vals)
Add values with weight 1.0StatisticalMoments
put(double[] vals, double[] weights)
Add values with weight 1.0void
put(double val, double weight)
Add data with a given weight.void
put(Mean other)
Join the data of another StatisticalMoments instance.StatisticalMoments
reset()
Reset the value.java.lang.String
toString()
-
Methods inherited from class elki.math.MeanVarianceMinMax
getDiff, getDoubleMinMax, getMax, getMin, newArray
-
Methods inherited from class elki.math.MeanVariance
getPopulationStddev, getPopulationVariance, getSampleStddev, getSampleVariance, getSumOfSquares, of
-
Methods inherited from class elki.math.Mean
getCount, getMean, highPrecision, of
-
-
-
-
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 classMeanVarianceMinMax
- 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 classMeanVarianceMinMax
- Parameters:
val
- dataweight
- weight
-
put
public void put(Mean other)
Join the data of another StatisticalMoments instance.- Overrides:
put
in classMeanVarianceMinMax
- Parameters:
other
- Data to join with
-
put
public StatisticalMoments put(double[] vals)
Description copied from class:MeanVarianceMinMax
Add values with weight 1.0- Overrides:
put
in classMeanVarianceMinMax
- Parameters:
vals
- Values- Returns:
- this
-
put
public StatisticalMoments put(double[] vals, double[] weights)
Description copied from class:Mean
Add values with weight 1.0- Overrides:
put
in classMeanVarianceMinMax
- 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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classMeanVarianceMinMax
-
reset
public StatisticalMoments reset()
Description copied from class:Mean
Reset the value.- Overrides:
reset
in classMeanVarianceMinMax
- Returns:
- this accumulator
-
-