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

public Class Kurtosis

extends AbstractStorelessUnivariateStatistic
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, org.apache.commons.math3.exception.MathIllegalArgumentException, .NullArgumentException, org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic, org.apache.commons.math3.util.FastMath, .MathUtils

Computes the Kurtosis of the available values.

We use the following (unbiased) formula to define kurtosis:

kurtosis = { [n(n+1) / (n -1)(n - 2)(n-3)] sum[(x_i - mean)^4] / std^4 } - [3(n-1)^2 / (n-2)(n-3)]

where n is the number of values, mean is the Mean and std is the StandardDeviation

Note that this statistic is undefined for n < 4. Double.Nan is returned when there is not sufficient data to compute the statistic. 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 boolean
incMoment

Determines whether or not this statistic can be incremented or cleared.

protected FourthMoment
moment

Fourth Moment on which this statistic is based

private static final long
serialVersionUID

Serializable version identifier

Constructor Summary

AccessConstructor and Description
public
Kurtosis()

Construct a Kurtosis

public
Kurtosis(final FourthMoment
external Moment
m4
)

Construct a Kurtosis from an external moment

public
Kurtosis(Kurtosis
the Kurtosis instance to copy
original
)

Copy constructor, creates a new Kurtosis identical to the original

Method Summary

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

Copies source to dest.

public double

Returns:

the kurtosis of the values or Double.NaN if length is less than 4
evaluate
(final double[]
the input array
values
,
final int
index of the first array element to include
begin
,
final int
the number of elements to include
length
)

Overrides org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.evaluate.

Implements org.apache.commons.math3.stat.descriptive.UnivariateStatistic.evaluate.

Returns the kurtosis of the entries in the specified portion of the input array.

public long
getN()

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

Returns the number of values that have been added.

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

Implements abstract org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.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.AbstractStorelessUnivariateStatistic:
equalsevaluatehashCodeincrementAllincrementAll

Field Detail

incMomentback to summary
protected boolean incMoment

Determines whether or not this statistic can be incremented or cleared.

Statistics based on (constructed from) external moments cannot be incremented or cleared.

momentback to summary
protected FourthMoment moment

Fourth Moment on which this statistic is based

serialVersionUIDback to summary
private static final long serialVersionUID

Serializable version identifier

Constructor Detail

Kurtosisback to summary
public Kurtosis()

Construct a Kurtosis

Kurtosisback to summary
public Kurtosis(final FourthMoment m4)

Construct a Kurtosis from an external moment

Parameters
m4:FourthMoment

external Moment

Kurtosisback to summary
public Kurtosis(Kurtosis original) throws NullArgumentException

Copy constructor, creates a new Kurtosis identical to the original

Parameters
original:Kurtosis

the Kurtosis instance to copy

Exceptions
NullArgumentException:
if original is null

Method Detail

clearback to summary
public void clear()

Implements abstract org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.clear.

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

Doc from org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.clear.

Clears the internal state of the Statistic

Annotations
@Override
copyback to summary
public Kurtosis copy()

Implements abstract org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.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.AbstractStorelessUnivariateStatistic.copy.

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

Returns:Kurtosis

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

a copy of the statistic

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

Copies source to dest.

Neither source nor dest can be null.

Parameters
source:Kurtosis

Kurtosis to copy

dest:Kurtosis

Kurtosis to copy to

Exceptions
NullArgumentException:
if either source or dest is null
evaluateback to summary
public double evaluate(final double[] values, final int begin, final int length) throws MathIllegalArgumentException

Overrides org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.evaluate.

Implements org.apache.commons.math3.stat.descriptive.UnivariateStatistic.evaluate.

Returns the kurtosis of the entries in the specified portion of the input array.

See Kurtosis for details on the computing algorithm.

Throws IllegalArgumentException if the array is null.

Parameters
values:double[]

the input array

begin:int

index of the first array element to include

length:int

the number of elements to include

Returns:double

the kurtosis of the values or Double.NaN if length is less than 4

Annotations
@Override
Exceptions
MathIllegalArgumentException:
if the input array is null or the array index parameters are not valid
getNback to summary
public long getN()

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

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

Returns the number of values that have been added.

Returns:long

the number of values.

getResultback to summary
public double getResult()

Implements abstract org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.getResult.

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

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

Implements abstract org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic.increment.

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

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

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

Note that when Kurtosis(FourthMoment) is used to create a Variance, this method does nothing. In that case, the FourthMoment should be incremented directly.

Parameters
d:double

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

the new value.

Annotations
@Override