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

public Class DescriptiveStatistics

extends Object
implements StatisticalSummary, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.math3.stat.descriptive.StatisticalSummary
Known Direct Subclasses
org.apache.commons.math3.stat.descriptive.SynchronizedDescriptiveStatistics
Imports
java.io.Serializable, java.lang.reflect.InvocationTargetException, java.util.Arrays, org.apache.commons.math3.exception.MathIllegalArgumentException, .NullArgumentException, .MathIllegalStateException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.stat.descriptive.moment.GeometricMean, .Kurtosis, .Mean, .Skewness, .Variance, org.apache.commons.math3.stat.descriptive.rank.Max, .Min, .Percentile, org.apache.commons.math3.stat.descriptive.summary.Sum, .SumOfSquares, org.apache.commons.math3.util.MathUtils, .ResizableDoubleArray, .FastMath

Maintains a dataset of values of a single variable and computes descriptive statistics based on stored data. The windowSize property sets a limit on the number of values that can be stored in the dataset. The default value, INFINITE_WINDOW, puts no limit on the size of the dataset. This value should be used with caution, as the backing store will grow without bound in this case. For very large datasets, SummaryStatistics, which does not store the dataset, should be used instead of this class. If windowSize is not INFINITE_WINDOW and more values are added than can be stored in the dataset, new values are added in a "rolling" manner, with new values replacing the "oldest" values in the dataset.

Note

this class is not threadsafe. Use SynchronizedDescriptiveStatistics if concurrent access from multiple threads is required.

Field Summary

Modifier and TypeField and Description
private ResizableDoubleArray
eDA

Stored data values

private UnivariateStatistic
geometricMeanImpl

Geometric mean statistic implementation - can be reset by setter.

public static final int
INFINITE_WINDOW

Represents an infinite window size.

private UnivariateStatistic
kurtosisImpl

Kurtosis statistic implementation - can be reset by setter.

private UnivariateStatistic
maxImpl

Maximum statistic implementation - can be reset by setter.

private UnivariateStatistic
meanImpl

Mean statistic implementation - can be reset by setter.

private UnivariateStatistic
minImpl

Minimum statistic implementation - can be reset by setter.

private UnivariateStatistic
percentileImpl

Percentile statistic implementation - can be reset by setter.

private static final long
serialVersionUID

Serialization UID

private static final String
SET_QUANTILE_METHOD_NAME

Name of the setQuantile method.

private UnivariateStatistic
skewnessImpl

Skewness statistic implementation - can be reset by setter.

private UnivariateStatistic
sumImpl

Sum statistic implementation - can be reset by setter.

private UnivariateStatistic
sumsqImpl

Sum of squares statistic implementation - can be reset by setter.

private UnivariateStatistic
varianceImpl

Variance statistic implementation - can be reset by setter.

protected int
windowSize

hold the window size

Constructor Summary

AccessConstructor and Description
public
DescriptiveStatistics()

Construct a DescriptiveStatistics instance with an infinite window

public
DescriptiveStatistics(int
the window size.
window
)

Construct a DescriptiveStatistics instance with the specified window

public
DescriptiveStatistics(double[]
the initial double[].
initialDoubleArray
)

Construct a DescriptiveStatistics instance with an infinite window and the initial data values in double[] initialDoubleArray.

public
DescriptiveStatistics(DescriptiveStatistics
DescriptiveStatistics instance to copy
original
)

Copy constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addValue(double
the value to be added
v
)

Adds the value to the dataset.

public double

Returns:

the computed value of the statistic.
apply
(UnivariateStatistic
the statistic to apply
stat
)

Apply the given statistic to the data associated with this set of statistics.

public void
clear()

Resets all statistics and storage

public DescriptiveStatistics

Returns:

a copy of this
copy
()

Returns a copy of this DescriptiveStatistics instance with the same internal state.

public static void
copy(DescriptiveStatistics
DescriptiveStatistics to copy
source
,
DescriptiveStatistics
DescriptiveStatistics to copy to
dest
)

Copies source to dest.

public double

Returns:

return the element at the specified index
getElement
(int
The Index of the element
index
)

Returns the element at the specified index

public double

Returns:

The geometricMean, Double.NaN if no values have been added, or if any negative values have been added.
getGeometricMean
()

Returns the geometric mean of the available values.

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the geometric mean
getGeometricMeanImpl
()

Returns the currently configured geometric mean implementation.

public double

Returns:

The kurtosis, Double.NaN if less than 4 values have been added.
getKurtosis
()

Returns the Kurtosis of the available values.

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the kurtosis
getKurtosisImpl
()

Returns the currently configured kurtosis implementation.

public double

Returns:

The max or Double.NaN if no values have been added.
getMax
()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getMax.

Returns the maximum of the available values

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the maximum
getMaxImpl
()

Returns the currently configured maximum implementation.

public double

Returns:

The mean or Double.NaN if no values have been added.
getMean
()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getMean.

Returns the arithmetic mean of the available values

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the mean
getMeanImpl
()

Returns the currently configured mean implementation.

public double

Returns:

The min or Double.NaN if no values have been added.
getMin
()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getMin.

Returns the minimum of the available values

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the minimum
getMinImpl
()

Returns the currently configured minimum implementation.

public long

Returns:

The number of available values
getN
()

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

Returns the number of available values

public double

Returns:

An estimate for the pth percentile of the stored data
getPercentile
(double
the requested percentile (scaled from 0 - 100)
p
)

Returns an estimate for the pth percentile of the stored values.

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the percentile
getPercentileImpl
()

Returns the currently configured percentile implementation.

public double

Returns:

The population variance, Double.NaN if no values have been added, or 0.0 for a single value set.
getPopulationVariance
()

Returns the population variance of the available values.

public double

Returns:

The quadratic mean or Double.NaN if no values have been added.
getQuadraticMean
()

Returns the quadratic mean, a.k.a. root-mean-square of the available values

public double

Returns:

The skewness, Double.NaN if less than 3 values have been added.
getSkewness
()

Returns the skewness of the available values.

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the skewness
getSkewnessImpl
()

Returns the currently configured skewness implementation.

public double[]

Returns:

returns the current set of numbers sorted in ascending order
getSortedValues
()

Returns the current set of values in an array of double primitives, sorted in ascending order.

public double

Returns:

The standard deviation, Double.NaN if no values have been added or 0.0 for a single value set.
getStandardDeviation
()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getStandardDeviation.

Returns the standard deviation of the available values.

public double

Returns:

The sum or Double.NaN if no values have been added
getSum
()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getSum.

Returns the sum of the values that have been added to Univariate.

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the sum
getSumImpl
()

Returns the currently configured sum implementation.

public double

Returns:

The sum of the squares or Double.NaN if no values have been added.
getSumsq
()

Returns the sum of the squares of the available values.

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the sum of squares
getSumsqImpl
()

Returns the currently configured sum of squares implementation.

public double[]

Returns:

returns the current set of numbers in the order in which they were added to this set
getValues
()

Returns the current set of values in an array of double primitives.

public double

Returns:

The variance, Double.NaN if no values have been added or 0.0 for a single value set.
getVariance
()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getVariance.

Returns the (sample) variance of the available values.

public synchronized UnivariateStatistic

Returns:

the UnivariateStatistic implementing the variance
getVarianceImpl
()

Returns the currently configured variance implementation.

public int

Returns:

The current window size or -1 if its Infinite.
getWindowSize
()

Returns the maximum number of values that can be stored in the dataset, or INFINITE_WINDOW (-1) if there is no limit.

public void
removeMostRecentValue()

Removes the most recent value from the dataset.

public double

Returns:

replaced value
replaceMostRecentValue
(double
the value to replace the most recent stored value
v
)

Replaces the most recently stored value with the given value.

public synchronized void
setGeometricMeanImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the geometric mean
geometricMeanImpl
)

Sets the implementation for the gemoetric mean.

public synchronized void
setKurtosisImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the kurtosis
kurtosisImpl
)

Sets the implementation for the kurtosis.

public synchronized void
setMaxImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the maximum
maxImpl
)

Sets the implementation for the maximum.

public synchronized void
setMeanImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the mean
meanImpl
)

Sets the implementation for the mean.

public synchronized void
setMinImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the minimum
minImpl
)

Sets the implementation for the minimum.

public synchronized void
setPercentileImpl(UnivariateStatistic
the percentileImpl to set
percentileImpl
)

Sets the implementation to be used by getPercentile(double).

public synchronized void
setSkewnessImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the skewness
skewnessImpl
)

Sets the implementation for the skewness.

public synchronized void
setSumImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the sum
sumImpl
)

Sets the implementation for the sum.

public synchronized void
setSumsqImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the sum of squares
sumsqImpl
)

Sets the implementation for the sum of squares.

public synchronized void
setVarianceImpl(UnivariateStatistic
the UnivariateStatistic instance to use for computing the variance
varianceImpl
)

Sets the implementation for the variance.

public void
setWindowSize(int
sets the size of the window.
windowSize
)

WindowSize controls the number of values that contribute to the reported statistics.

public String

Returns:

String with line feeds displaying statistics
toString
()

Overrides java.lang.Object.toString.

Generates a text report displaying univariate statistics from values that have been added.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

eDAback to summary
private ResizableDoubleArray eDA

Stored data values

geometricMeanImplback to summary
private UnivariateStatistic geometricMeanImpl

Geometric mean statistic implementation - can be reset by setter.

INFINITE_WINDOWback to summary
public static final int INFINITE_WINDOW

Represents an infinite window size. When the getWindowSize() returns this value, there is no limit to the number of data values that can be stored in the dataset.

kurtosisImplback to summary
private UnivariateStatistic kurtosisImpl

Kurtosis statistic implementation - can be reset by setter.

maxImplback to summary
private UnivariateStatistic maxImpl

Maximum statistic implementation - can be reset by setter.

meanImplback to summary
private UnivariateStatistic meanImpl

Mean statistic implementation - can be reset by setter.

minImplback to summary
private UnivariateStatistic minImpl

Minimum statistic implementation - can be reset by setter.

percentileImplback to summary
private UnivariateStatistic percentileImpl

Percentile statistic implementation - can be reset by setter.

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization UID

SET_QUANTILE_METHOD_NAMEback to summary
private static final String SET_QUANTILE_METHOD_NAME

Name of the setQuantile method.

skewnessImplback to summary
private UnivariateStatistic skewnessImpl

Skewness statistic implementation - can be reset by setter.

sumImplback to summary
private UnivariateStatistic sumImpl

Sum statistic implementation - can be reset by setter.

sumsqImplback to summary
private UnivariateStatistic sumsqImpl

Sum of squares statistic implementation - can be reset by setter.

varianceImplback to summary
private UnivariateStatistic varianceImpl

Variance statistic implementation - can be reset by setter.

windowSizeback to summary
protected int windowSize

hold the window size

Constructor Detail

DescriptiveStatisticsback to summary
public DescriptiveStatistics()

Construct a DescriptiveStatistics instance with an infinite window

DescriptiveStatisticsback to summary
public DescriptiveStatistics(int window) throws MathIllegalArgumentException

Construct a DescriptiveStatistics instance with the specified window

Parameters
window:int

the window size.

Exceptions
MathIllegalArgumentException:
if window size is less than 1 but not equal to INFINITE_WINDOW
DescriptiveStatisticsback to summary
public DescriptiveStatistics(double[] initialDoubleArray)

Construct a DescriptiveStatistics instance with an infinite window and the initial data values in double[] initialDoubleArray. If initialDoubleArray is null, then this constructor corresponds to DescriptiveStatistics()

Parameters
initialDoubleArray:double[]

the initial double[].

DescriptiveStatisticsback to summary
public DescriptiveStatistics(DescriptiveStatistics original) throws NullArgumentException

Copy constructor. Construct a new DescriptiveStatistics instance that is a copy of original.

Parameters
original:DescriptiveStatistics

DescriptiveStatistics instance to copy

Exceptions
NullArgumentException:
if original is null

Method Detail

addValueback to summary
public void addValue(double v)

Adds the value to the dataset. If the dataset is at the maximum size (i.e., the number of stored elements equals the currently configured windowSize), the first (oldest) element in the dataset is discarded to make room for the new value.

Parameters
v:double

the value to be added

applyback to summary
public double apply(UnivariateStatistic stat)

Apply the given statistic to the data associated with this set of statistics.

Parameters
stat:UnivariateStatistic

the statistic to apply

Returns:double

the computed value of the statistic.

clearback to summary
public void clear()

Resets all statistics and storage

copyback to summary
public DescriptiveStatistics copy()

Returns a copy of this DescriptiveStatistics instance with the same internal state.

Returns:DescriptiveStatistics

a copy of this

copyback to summary
public static void copy(DescriptiveStatistics source, DescriptiveStatistics dest) throws NullArgumentException

Copies source to dest.

Neither source nor dest can be null.

Parameters
source:DescriptiveStatistics

DescriptiveStatistics to copy

dest:DescriptiveStatistics

DescriptiveStatistics to copy to

Exceptions
NullArgumentException:
if either source or dest is null
getElementback to summary
public double getElement(int index)

Returns the element at the specified index

Parameters
index:int

The Index of the element

Returns:double

return the element at the specified index

getGeometricMeanback to summary
public double getGeometricMean()

Returns the geometric mean of the available values.

See GeometricMean for details on the computing algorithm.

Returns:double

The geometricMean, Double.NaN if no values have been added, or if any negative values have been added.

getGeometricMeanImplback to summary
public synchronized UnivariateStatistic getGeometricMeanImpl()

Returns the currently configured geometric mean implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the geometric mean

Since
1.2
getKurtosisback to summary
public double getKurtosis()

Returns the Kurtosis of the available values. Kurtosis is a measure of the "peakedness" of a distribution.

Returns:double

The kurtosis, Double.NaN if less than 4 values have been added.

getKurtosisImplback to summary
public synchronized UnivariateStatistic getKurtosisImpl()

Returns the currently configured kurtosis implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the kurtosis

Since
1.2
getMaxback to summary
public double getMax()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getMax.

Returns the maximum of the available values

Returns:double

The max or Double.NaN if no values have been added.

getMaxImplback to summary
public synchronized UnivariateStatistic getMaxImpl()

Returns the currently configured maximum implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the maximum

Since
1.2
getMeanback to summary
public double getMean()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getMean.

Returns the arithmetic mean of the available values

Returns:double

The mean or Double.NaN if no values have been added.

getMeanImplback to summary
public synchronized UnivariateStatistic getMeanImpl()

Returns the currently configured mean implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the mean

Since
1.2
getMinback to summary
public double getMin()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getMin.

Returns the minimum of the available values

Returns:double

The min or Double.NaN if no values have been added.

getMinImplback to summary
public synchronized UnivariateStatistic getMinImpl()

Returns the currently configured minimum implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the minimum

Since
1.2
getNback to summary
public long getN()

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

Returns the number of available values

Returns:long

The number of available values

getPercentileback to summary
public double getPercentile(double p) throws MathIllegalStateException, MathIllegalArgumentException

Returns an estimate for the pth percentile of the stored values.

The implementation provided here follows the first estimation procedure presented here.

Preconditions:

  • 0 < p ≤ 100 (otherwise an MathIllegalArgumentException is thrown)
  • at least one value must be stored (returns Double.NaN otherwise)

Parameters
p:double

the requested percentile (scaled from 0 - 100)

Returns:double

An estimate for the pth percentile of the stored data

Exceptions
MathIllegalStateException:
if percentile implementation has been overridden and the supplied implementation does not support setQuantile
MathIllegalArgumentException:
if p is not a valid quantile
getPercentileImplback to summary
public synchronized UnivariateStatistic getPercentileImpl()

Returns the currently configured percentile implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the percentile

Since
1.2
getPopulationVarianceback to summary
public double getPopulationVariance()

Returns the population variance of the available values.

Returns:double

The population variance, Double.NaN if no values have been added, or 0.0 for a single value set.

getQuadraticMeanback to summary
public double getQuadraticMean()

Returns the quadratic mean, a.k.a. root-mean-square of the available values

Returns:double

The quadratic mean or Double.NaN if no values have been added.

getSkewnessback to summary
public double getSkewness()

Returns the skewness of the available values. Skewness is a measure of the asymmetry of a given distribution.

Returns:double

The skewness, Double.NaN if less than 3 values have been added.

getSkewnessImplback to summary
public synchronized UnivariateStatistic getSkewnessImpl()

Returns the currently configured skewness implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the skewness

Since
1.2
getSortedValuesback to summary
public double[] getSortedValues()

Returns the current set of values in an array of double primitives, sorted in ascending order. The returned array is a fresh copy of the underlying data -- i.e., it is not a reference to the stored data.

Returns:double[]

returns the current set of numbers sorted in ascending order

getStandardDeviationback to summary
public double getStandardDeviation()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getStandardDeviation.

Returns the standard deviation of the available values.

Returns:double

The standard deviation, Double.NaN if no values have been added or 0.0 for a single value set.

getSumback to summary
public double getSum()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getSum.

Returns the sum of the values that have been added to Univariate.

Returns:double

The sum or Double.NaN if no values have been added

getSumImplback to summary
public synchronized UnivariateStatistic getSumImpl()

Returns the currently configured sum implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the sum

Since
1.2
getSumsqback to summary
public double getSumsq()

Returns the sum of the squares of the available values.

Returns:double

The sum of the squares or Double.NaN if no values have been added.

getSumsqImplback to summary
public synchronized UnivariateStatistic getSumsqImpl()

Returns the currently configured sum of squares implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the sum of squares

Since
1.2
getValuesback to summary
public double[] getValues()

Returns the current set of values in an array of double primitives. The order of addition is preserved. The returned array is a fresh copy of the underlying data -- i.e., it is not a reference to the stored data.

Returns:double[]

returns the current set of numbers in the order in which they were added to this set

getVarianceback to summary
public double getVariance()

Implements org.apache.commons.math3.stat.descriptive.StatisticalSummary.getVariance.

Returns the (sample) variance of the available values.

This method returns the bias-corrected sample variance (using n - 1 in the denominator). Use getPopulationVariance() for the non-bias-corrected population variance.

Returns:double

The variance, Double.NaN if no values have been added or 0.0 for a single value set.

getVarianceImplback to summary
public synchronized UnivariateStatistic getVarianceImpl()

Returns the currently configured variance implementation.

Returns:UnivariateStatistic

the UnivariateStatistic implementing the variance

Since
1.2
getWindowSizeback to summary
public int getWindowSize()

Returns the maximum number of values that can be stored in the dataset, or INFINITE_WINDOW (-1) if there is no limit.

Returns:int

The current window size or -1 if its Infinite.

removeMostRecentValueback to summary
public void removeMostRecentValue() throws MathIllegalStateException

Removes the most recent value from the dataset.

Exceptions
MathIllegalStateException:
if there are no elements stored
replaceMostRecentValueback to summary
public double replaceMostRecentValue(double v) throws MathIllegalStateException

Replaces the most recently stored value with the given value. There must be at least one element stored to call this method.

Parameters
v:double

the value to replace the most recent stored value

Returns:double

replaced value

Exceptions
MathIllegalStateException:
if there are no elements stored
setGeometricMeanImplback to summary
public synchronized void setGeometricMeanImpl(UnivariateStatistic geometricMeanImpl)

Sets the implementation for the gemoetric mean.

Parameters
geometricMeanImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the geometric mean

Since
1.2
setKurtosisImplback to summary
public synchronized void setKurtosisImpl(UnivariateStatistic kurtosisImpl)

Sets the implementation for the kurtosis.

Parameters
kurtosisImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the kurtosis

Since
1.2
setMaxImplback to summary
public synchronized void setMaxImpl(UnivariateStatistic maxImpl)

Sets the implementation for the maximum.

Parameters
maxImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the maximum

Since
1.2
setMeanImplback to summary
public synchronized void setMeanImpl(UnivariateStatistic meanImpl)

Sets the implementation for the mean.

Parameters
meanImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the mean

Since
1.2
setMinImplback to summary
public synchronized void setMinImpl(UnivariateStatistic minImpl)

Sets the implementation for the minimum.

Parameters
minImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the minimum

Since
1.2
setPercentileImplback to summary
public synchronized void setPercentileImpl(UnivariateStatistic percentileImpl) throws MathIllegalArgumentException

Sets the implementation to be used by getPercentile(double). The supplied UnivariateStatistic must provide a setQuantile(double) method; otherwise IllegalArgumentException is thrown.

Parameters
percentileImpl:UnivariateStatistic

the percentileImpl to set

Exceptions
MathIllegalArgumentException:
if the supplied implementation does not provide a setQuantile method
Since
1.2
setSkewnessImplback to summary
public synchronized void setSkewnessImpl(UnivariateStatistic skewnessImpl)

Sets the implementation for the skewness.

Parameters
skewnessImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the skewness

Since
1.2
setSumImplback to summary
public synchronized void setSumImpl(UnivariateStatistic sumImpl)

Sets the implementation for the sum.

Parameters
sumImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the sum

Since
1.2
setSumsqImplback to summary
public synchronized void setSumsqImpl(UnivariateStatistic sumsqImpl)

Sets the implementation for the sum of squares.

Parameters
sumsqImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the sum of squares

Since
1.2
setVarianceImplback to summary
public synchronized void setVarianceImpl(UnivariateStatistic varianceImpl)

Sets the implementation for the variance.

Parameters
varianceImpl:UnivariateStatistic

the UnivariateStatistic instance to use for computing the variance

Since
1.2
setWindowSizeback to summary
public void setWindowSize(int windowSize) throws MathIllegalArgumentException

WindowSize controls the number of values that contribute to the reported statistics. For example, if windowSize is set to 3 and the values {1,2,3,4,5} have been added in that order then the available values are {3,4,5} and all reported statistics will be based on these values. If windowSize is decreased as a result of this call and there are more than the new value of elements in the current dataset, values from the front of the array are discarded to reduce the dataset to windowSize elements.

Parameters
windowSize:int

sets the size of the window.

Exceptions
MathIllegalArgumentException:
if window size is less than 1 but not equal to INFINITE_WINDOW
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Generates a text report displaying univariate statistics from values that have been added. Each statistic is displayed on a separate line.

Returns:String

String with line feeds displaying statistics

Annotations
@Override