org.apache.commons.math.stat.univariate.moment
Class Skewness

java.lang.Object
  extended byorg.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
      extended byorg.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatistic
          extended byorg.apache.commons.math.stat.univariate.moment.Skewness
All Implemented Interfaces:
Serializable, StorelessUnivariateStatistic, UnivariateStatistic

public class Skewness
extends AbstractStorelessUnivariateStatistic
implements Serializable

Version:
$Revision: 1.14 $ $Date: 2003/11/19 03:28:24 $
See Also:
Serialized Form

Field Summary
protected  boolean incMoment
           
protected  ThirdMoment moment
           
protected  double skewness
           
 
Constructor Summary
Skewness()
          Constructs a Skewness
Skewness(ThirdMoment m3)
          Constructs a Skewness with an external moment
 
Method Summary
 void clear()
          Clears all the internal state of the Statistic
 double evaluate(double[] values, int begin, int length)
          Returns the skewness of a collection of values.
 double getN()
          Returns the current state of the statistic after the last increment.
 double getResult()
          Returns the current state of the statistic after the last increment.
 void increment(double d)
          Increments the internal state of the Storagless Implementation.
 
Methods inherited from class org.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
evaluate, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.math.stat.univariate.UnivariateStatistic
evaluate
 

Field Detail

moment

protected ThirdMoment moment

incMoment

protected boolean incMoment

skewness

protected double skewness
Constructor Detail

Skewness

public Skewness()
Constructs a Skewness


Skewness

public Skewness(ThirdMoment m3)
Constructs a Skewness with an external moment

Parameters:
m3 - external moment
Method Detail

increment

public void increment(double d)
Description copied from interface: StorelessUnivariateStatistic
Increments the internal state of the Storagless Implementation.

Specified by:
increment in interface StorelessUnivariateStatistic
Specified by:
increment in class AbstractStorelessUnivariateStatistic
See Also:
StorelessUnivariateStatistic.increment(double)

getResult

public double getResult()
Description copied from interface: StorelessUnivariateStatistic
Returns the current state of the statistic after the last increment.

Specified by:
getResult in interface StorelessUnivariateStatistic
Specified by:
getResult in class AbstractStorelessUnivariateStatistic
See Also:
StorelessUnivariateStatistic.getResult()

getN

public double getN()
Description copied from interface: StorelessUnivariateStatistic
Returns the current state of the statistic after the last increment.

Specified by:
getN in interface StorelessUnivariateStatistic
Returns:
value of the statistic, Double.NaN if it has been cleared or just instantiated.
See Also:
StorelessUnivariateStatistic.getN()

clear

public void clear()
Description copied from interface: StorelessUnivariateStatistic
Clears all the internal state of the Statistic

Specified by:
clear in interface StorelessUnivariateStatistic
Specified by:
clear in class AbstractStorelessUnivariateStatistic
See Also:
StorelessUnivariateStatistic.clear()

evaluate

public double evaluate(double[] values,
                       int begin,
                       int length)
Returns the skewness of a collection of values. Skewness is a measure of the assymetry of a given distribution. This algorithm uses a corrected two pass algorithm of the following corrected two pass formula (14.1.8), and also referenced in

"Algorithms for Computing the Sample Variance: Analysis and Recommendations", Chan, T.F., Golub, G.H., and LeVeque, R.J. 1983, American Statistician, vol. 37, pp. 242?247.

Specified by:
evaluate in interface UnivariateStatistic
Overrides:
evaluate in class AbstractStorelessUnivariateStatistic
Parameters:
values - Is a double[] containing the values
begin - processing at this point in the array
length - processing at this point in the array
Returns:
the skewness of the values or Double.NaN if the array is empty
See Also:
UnivariateStatistic.evaluate(double[], int, int)


Copyright © 2003-2004 Apache Software Foundation. All Rights Reserved.