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

pack-priv Class FourthMoment

extends ThirdMoment
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, org.apache.commons.math3.exception.NullArgumentException, org.apache.commons.math3.util.MathUtils

Computes a statistic related to the Fourth Central Moment. Specifically, what is computed is the sum of

(x_i - xbar) ^ 4,

where the x_i are the sample observations and xbar is the sample mean.

The following recursive updating formula is used:

Let

Then

new value = old value - 4 * (dev/n) * m3 + 6 * (dev/n)^2 * m2 +
[n^2 - 3 * (n-1)] * dev^4 * (n-1) / n^3

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
private double
m4

fourth moment of values that have been added

private static final long
Inherited from org.apache.commons.math3.stat.descriptive.moment.ThirdMoment:
m3nDevSq

Constructor Summary

AccessConstructor and Description
pack-priv
FourthMoment()

Create a FourthMoment instance

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

Copy constructor, creates a new FourthMoment identical to the original

Method Summary

Modifier and TypeMethod and Description
public void
public FourthMoment
public static void
copy(FourthMoment
FourthMoment to copy
source
,
FourthMoment
FourthMoment 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.ThirdMoment.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.ThirdMoment:
copy

Field Detail

m4back to summary
private double m4

fourth moment of values that have been added

serialVersionUIDback to summary
private static final long serialVersionUID

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

Serializable version identifier

Constructor Detail

FourthMomentback to summary
pack-priv FourthMoment()

Create a FourthMoment instance

FourthMomentback to summary
pack-priv FourthMoment(FourthMoment original) throws NullArgumentException

Copy constructor, creates a new FourthMoment identical to the original

Parameters
original:FourthMoment

the FourthMoment instance to copy

Exceptions
NullArgumentException:
if original is null

Method Detail

clearback to summary
public void clear()

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

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

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

Clears the internal state of the Statistic

Annotations
@Override
copyback to summary
public FourthMoment copy()

Overrides org.apache.commons.math3.stat.descriptive.moment.ThirdMoment.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.ThirdMoment.copy.

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

Returns:FourthMoment

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

a copy of the statistic

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

Copies source to dest.

Neither source nor dest can be null.

Parameters
source:FourthMoment

FourthMoment to copy

dest:FourthMoment

FourthMoment 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.ThirdMoment.getResult.

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

Doc from org.apache.commons.math3.stat.descriptive.moment.ThirdMoment.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.ThirdMoment.increment.

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

Doc from org.apache.commons.math3.stat.descriptive.moment.ThirdMoment.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