Top Description Fields Constructors Methods
org.apache.commons.math3.stat.descriptive.moment

pack-priv Class ThirdMoment

extends SecondMoment
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.apache.commons.math3.stat.descriptive.moment.FourthMoment
Imports
java.io.Serializable, org.apache.commons.math3.exception.NullArgumentException, org.apache.commons.math3.util.MathUtils

Computes a statistic related to the Third Central Moment. Specifically, what is computed is the sum of cubed deviations from the sample mean.

The following recursive updating formula is used:

Let

Then

new value = old value - 3 * (dev/n) * m2 + (n-1) * (n -2) * (dev^3/n^2)

Returns Double.NaN if no data values have been added and returns 0 if there is just one value in the data set. Note that Double.NaN may also be returned if the input includes NaN and / or infinite values.

Note that this implementation is not synchronized. If multiple threads access an instance of this class concurrently, and at least one of the threads invokes the increment() or clear() method, it must be synchronized externally.

Field Summary

Modifier and TypeField and Description
protected double
m3

third moment of values that have been added

protected double
nDevSq

Square of deviation of most recently added value from previous first moment, normalized by previous sample size.

private static final long
Inherited from org.apache.commons.math3.stat.descriptive.moment.SecondMoment:
m2

Constructor Summary

AccessConstructor and Description
pack-priv
ThirdMoment()

Create a FourthMoment instance

pack-priv
ThirdMoment(ThirdMoment
the ThirdMoment instance to copy
original
)

Copy constructor, creates a new ThirdMoment identical to the original

Method Summary

Modifier and TypeMethod and Description
public void
public ThirdMoment
public static void
copy(ThirdMoment
ThirdMoment to copy
source
,
ThirdMoment
ThirdMoment to copy to
dest
)

Copies source to dest.

public double
public void
increment(final double
the new value.
d
)

Overrides org.apache.commons.math3.stat.descriptive.moment.SecondMoment.increment.

Implements org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.increment.

Updates the internal state of the statistic to reflect the addition of the new value.

Inherited from org.apache.commons.math3.stat.descriptive.moment.SecondMoment:
copy

Field Detail

m3back to summary
protected double m3

third moment of values that have been added

nDevSqback to summary
protected double nDevSq

Square of deviation of most recently added value from previous first moment, normalized by previous sample size. Retained to prevent repeated computation in higher order moments. nDevSq = nDev * nDev.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.commons.math3.stat.descriptive.moment.SecondMoment.serialVersionUID.

Serializable version identifier

Constructor Detail

ThirdMomentback to summary
pack-priv ThirdMoment()

Create a FourthMoment instance

ThirdMomentback to summary
pack-priv ThirdMoment(ThirdMoment original) throws NullArgumentException

Copy constructor, creates a new ThirdMoment identical to the original

Parameters
original:ThirdMoment

the ThirdMoment instance to copy

Exceptions
NullArgumentException:
if orginal is null

Method Detail

clearback to summary
public void clear()

Overrides org.apache.commons.math3.stat.descriptive.moment.SecondMoment.clear.

Implements org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.clear.

Doc from org.apache.commons.math3.stat.descriptive.moment.SecondMoment.clear.

Clears the internal state of the Statistic

Annotations
@Override
copyback to summary
public ThirdMoment copy()

Overrides org.apache.commons.math3.stat.descriptive.moment.SecondMoment.copy.

Implements org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.copy, org.apache.commons.math3.stat.descriptive.UnivariateStatistic.copy.

Doc from org.apache.commons.math3.stat.descriptive.moment.SecondMoment.copy.

Returns a copy of the statistic with the same internal state.

Returns:ThirdMoment

Doc from org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.copy.

a copy of the statistic

Annotations
@Override
copyback to summary
public static void copy(ThirdMoment source, ThirdMoment dest) throws NullArgumentException

Copies source to dest.

Neither source nor dest can be null.

Parameters
source:ThirdMoment

ThirdMoment to copy

dest:ThirdMoment

ThirdMoment to copy to

Exceptions
NullArgumentException:
if either source or dest is null
getResultback to summary
public double getResult()

Overrides org.apache.commons.math3.stat.descriptive.moment.SecondMoment.getResult.

Implements org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.getResult.

Doc from org.apache.commons.math3.stat.descriptive.moment.SecondMoment.getResult.

Returns the current value of the Statistic.

Returns:double

Doc from org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.getResult.

value of the statistic, Double.NaN if it has been cleared or just instantiated.

Annotations
@Override
incrementback to summary
public void increment(final double d)

Overrides org.apache.commons.math3.stat.descriptive.moment.SecondMoment.increment.

Implements org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.increment.

Doc from org.apache.commons.math3.stat.descriptive.moment.SecondMoment.increment.

Updates the internal state of the statistic to reflect the addition of the new value.

Parameters
d:double

Doc from org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.increment.

the new value.

Annotations
@Override