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.
| Modifier and Type | Field 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 |
| Access | Constructor and Description |
|---|---|
| public | |
| 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. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public double | Returns: the computed value of the statistic.the statistic to apply stat)Apply the given statistic to the data associated with this set of statistics. |
| public void | |
| public DescriptiveStatistics | Returns: a copy of thisReturns 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 indexThe 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.Returns the geometric mean of the available values. |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the geometric meanReturns the currently configured geometric mean implementation. |
| public double | Returns: The kurtosis, Double.NaN if less than 4 values have been added.Returns the Kurtosis of the available values. |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the kurtosisReturns the currently configured kurtosis implementation. |
| public double | Returns: The max or Double.NaN if no values have been added.Implements org. Returns the maximum of the available values |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the maximumReturns the currently configured maximum implementation. |
| public double | Returns: The mean or Double.NaN if no values have been added.Implements org. Returns the arithmetic mean of the available values |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the meanReturns the currently configured mean implementation. |
| public double | Returns: The min or Double.NaN if no values have been added.Implements org. Returns the minimum of the available values |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the minimumReturns the currently configured minimum implementation. |
| public long | Returns: The number of available valuesImplements org. Returns the number of available values |
| public double | Returns: An estimate for the pth percentile of the stored datathe 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 percentileReturns 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.Returns the population variance of the available values. |
| public double | Returns: The quadratic mean orDouble.NaN if no values
have been added.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.Returns the skewness of the available values. |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the skewnessReturns the currently configured skewness implementation. |
| public double[] | Returns: returns the current set of numbers sorted in ascending orderReturns 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.Implements org. Returns the standard deviation of the available values. |
| public double | Returns: The sum or Double.NaN if no values have been addedImplements org. Returns the sum of the values that have been added to Univariate. |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the sumReturns the currently configured sum implementation. |
| public double | Returns: The sum of the squares or Double.NaN if no values have been added.Returns the sum of the squares of the available values. |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the sum of squaresReturns 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 setReturns 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.Implements org. Returns the (sample) variance of the available values. |
| public synchronized UnivariateStatistic | Returns: the UnivariateStatistic implementing the varianceReturns the currently configured variance implementation. |
| public int | Returns: The current window size or -1 if its Infinite.Returns the maximum number of values that can be stored in the dataset, or INFINITE_WINDOW (-1) if there is no limit. |
| public void | |
| public double | Returns: replaced valuethe 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 |
| 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 statisticsOverrides java. Generates a text report displaying univariate statistics from values that have been added. |
| eDA | back to summary |
|---|---|
| private ResizableDoubleArray eDA Stored data values | |
| geometricMeanImpl | back to summary |
|---|---|
| private UnivariateStatistic geometricMeanImpl Geometric mean statistic implementation - can be reset by setter. | |
| INFINITE_WINDOW | back to summary |
|---|---|
| public static final int INFINITE_WINDOW Represents an infinite window size. When the | |
| kurtosisImpl | back to summary |
|---|---|
| private UnivariateStatistic kurtosisImpl Kurtosis statistic implementation - can be reset by setter. | |
| maxImpl | back to summary |
|---|---|
| private UnivariateStatistic maxImpl Maximum statistic implementation - can be reset by setter. | |
| meanImpl | back to summary |
|---|---|
| private UnivariateStatistic meanImpl Mean statistic implementation - can be reset by setter. | |
| minImpl | back to summary |
|---|---|
| private UnivariateStatistic minImpl Minimum statistic implementation - can be reset by setter. | |
| percentileImpl | back to summary |
|---|---|
| private UnivariateStatistic percentileImpl Percentile statistic implementation - can be reset by setter. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization UID | |
| SET_QUANTILE_METHOD_NAME | back to summary |
|---|---|
| private static final String SET_QUANTILE_METHOD_NAME Name of the setQuantile method. | |
| skewnessImpl | back to summary |
|---|---|
| private UnivariateStatistic skewnessImpl Skewness statistic implementation - can be reset by setter. | |
| sumImpl | back to summary |
|---|---|
| private UnivariateStatistic sumImpl Sum statistic implementation - can be reset by setter. | |
| sumsqImpl | back to summary |
|---|---|
| private UnivariateStatistic sumsqImpl Sum of squares statistic implementation - can be reset by setter. | |
| varianceImpl | back to summary |
|---|---|
| private UnivariateStatistic varianceImpl Variance statistic implementation - can be reset by setter. | |
| windowSize | back to summary |
|---|---|
| protected int windowSize hold the window size | |
| DescriptiveStatistics | back to summary |
|---|---|
| public DescriptiveStatistics() Construct a DescriptiveStatistics instance with an infinite window | |
| DescriptiveStatistics | back to summary |
|---|---|
| public DescriptiveStatistics(int window) throws MathIllegalArgumentException Construct a DescriptiveStatistics instance with the specified window
| |
| DescriptiveStatistics | back 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()
| |
| DescriptiveStatistics | back to summary |
|---|---|
| public DescriptiveStatistics(DescriptiveStatistics original) throws NullArgumentException Copy constructor. Construct a new DescriptiveStatistics instance that is a copy of original.
| |
| addValue | back 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.
| |
| apply | back to summary |
|---|---|
| public double apply(UnivariateStatistic stat) Apply the given statistic to the data associated with this set of statistics.
| |
| clear | back to summary |
|---|---|
| public void clear() Resets all statistics and storage | |
| copy | back to summary |
|---|---|
| public DescriptiveStatistics copy() Returns a copy of this DescriptiveStatistics instance with the same internal state.
| |
| copy | back to summary |
|---|---|
| public static void copy(DescriptiveStatistics source, DescriptiveStatistics dest) throws NullArgumentException Copies source to dest. Neither source nor dest can be null.
| |
| getElement | back to summary |
|---|---|
| public double getElement(int index) Returns the element at the specified index
| |
| getGeometricMean | back to summary |
|---|---|
| public double getGeometricMean() Returns the geometric mean of the available values.
See
| |
| getGeometricMeanImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getGeometricMeanImpl() Returns the currently configured geometric mean implementation.
| |
| getKurtosis | back to summary |
|---|---|
| public double getKurtosis() Returns the Kurtosis of the available values. Kurtosis is a measure of the "peakedness" of a distribution.
| |
| getKurtosisImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getKurtosisImpl() Returns the currently configured kurtosis implementation.
| |
| getMax | back to summary |
|---|---|
| public double getMax() Implements org. Returns the maximum of the available values
| |
| getMaxImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getMaxImpl() Returns the currently configured maximum implementation.
| |
| getMean | back to summary |
|---|---|
| public double getMean() Implements org. Returns the arithmetic mean of the available values
| |
| getMeanImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getMeanImpl() Returns the currently configured mean implementation.
| |
| getMin | back to summary |
|---|---|
| public double getMin() Implements org. Returns the minimum of the available values
| |
| getMinImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getMinImpl() Returns the currently configured minimum implementation.
| |
| getN | back to summary |
|---|---|
| public long getN() Implements org. Returns the number of available values
| |
| getPercentile | back 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:
| |
| getPercentileImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getPercentileImpl() Returns the currently configured percentile implementation.
| |
| getPopulationVariance | back to summary |
|---|---|
| public double getPopulationVariance() Returns the population variance of the available values.
| |
| getQuadraticMean | back to summary |
|---|---|
| public double getQuadraticMean() Returns the quadratic mean, a.k.a. root-mean-square of the available values
| |
| getSkewness | back to summary |
|---|---|
| public double getSkewness() Returns the skewness of the available values. Skewness is a measure of the asymmetry of a given distribution.
| |
| getSkewnessImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getSkewnessImpl() Returns the currently configured skewness implementation.
| |
| getSortedValues | back 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.
| |
| getStandardDeviation | back to summary |
|---|---|
| public double getStandardDeviation() Implements org. Returns the standard deviation of the available values.
| |
| getSum | back to summary |
|---|---|
| public double getSum() Implements org. Returns the sum of the values that have been added to Univariate.
| |
| getSumImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getSumImpl() Returns the currently configured sum implementation.
| |
| getSumsq | back to summary |
|---|---|
| public double getSumsq() Returns the sum of the squares of the available values.
| |
| getSumsqImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getSumsqImpl() Returns the currently configured sum of squares implementation.
| |
| getValues | back 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.
| |
| getVariance | back to summary |
|---|---|
| public double getVariance() Implements org. Returns the (sample) variance of the available values. This method returns the bias-corrected sample variance (using
| |
| getVarianceImpl | back to summary |
|---|---|
| public synchronized UnivariateStatistic getVarianceImpl() Returns the currently configured variance implementation.
| |
| getWindowSize | back 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.
| |
| removeMostRecentValue | back to summary |
|---|---|
| public void removeMostRecentValue() throws MathIllegalStateException Removes the most recent value from the dataset.
| |
| replaceMostRecentValue | back 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.
| |
| setGeometricMeanImpl | back to summary |
|---|---|
| public synchronized void setGeometricMeanImpl(UnivariateStatistic geometricMeanImpl) Sets the implementation for the gemoetric mean.
| |
| setKurtosisImpl | back to summary |
|---|---|
| public synchronized void setKurtosisImpl(UnivariateStatistic kurtosisImpl) Sets the implementation for the kurtosis.
| |
| setMaxImpl | back to summary |
|---|---|
| public synchronized void setMaxImpl(UnivariateStatistic maxImpl) Sets the implementation for the maximum.
| |
| setMeanImpl | back to summary |
|---|---|
| public synchronized void setMeanImpl(UnivariateStatistic meanImpl) Sets the implementation for the mean.
| |
| setMinImpl | back to summary |
|---|---|
| public synchronized void setMinImpl(UnivariateStatistic minImpl) Sets the implementation for the minimum.
| |
| setPercentileImpl | back to summary |
|---|---|
| public synchronized void setPercentileImpl(UnivariateStatistic percentileImpl) throws MathIllegalArgumentException Sets the implementation to be used by
| |
| setSkewnessImpl | back to summary |
|---|---|
| public synchronized void setSkewnessImpl(UnivariateStatistic skewnessImpl) Sets the implementation for the skewness.
| |
| setSumImpl | back to summary |
|---|---|
| public synchronized void setSumImpl(UnivariateStatistic sumImpl) Sets the implementation for the sum.
| |
| setSumsqImpl | back to summary |
|---|---|
| public synchronized void setSumsqImpl(UnivariateStatistic sumsqImpl) Sets the implementation for the sum of squares.
| |
| setVarianceImpl | back to summary |
|---|---|
| public synchronized void setVarianceImpl(UnivariateStatistic varianceImpl) Sets the implementation for the variance.
| |
| setWindowSize | back 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
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Generates a text report displaying univariate statistics from values that have been added. Each statistic is displayed on a separate line. | |