Computes summary statistics for a stream of data values added using the
addValue method. The data values are not stored in
memory, so this class can be used to compute statistics for very large data
streams.
The StorelessUnivariateStatistic instances used to maintain summary
state and compute statistics are configurable via setters. For example, the
default implementation for the variance can be overridden by calling
setVarianceImpl(StorelessUnivariateStatistic). Actual parameters to
these methods must implement the StorelessUnivariateStatistic
interface and configuration must be completed before addValue
is called. No configuration is necessary to use the default, commons-math
provided implementations.
Note
This class is not thread-safe. Use
SynchronizedSummaryStatistics if concurrent access from multiple
threads is required.
| Modifier and Type | Field and Description |
|---|---|
| private GeometricMean | geoMean
geoMean of values that have been added |
| private StorelessUnivariateStatistic | geoMeanImpl
Geometric mean statistic implementation - can be reset by setter. |
| private Max | max
max of values that have been added |
| private StorelessUnivariateStatistic | maxImpl
Maximum statistic implementation - can be reset by setter. |
| private Mean | mean
mean of values that have been added |
| private StorelessUnivariateStatistic | meanImpl
Mean statistic implementation - can be reset by setter. |
| private Min | min
min of values that have been added |
| private StorelessUnivariateStatistic | minImpl
Minimum statistic implementation - can be reset by setter. |
| private long | n
count of values that have been added |
| private SecondMoment | secondMoment
SecondMoment is used to compute the mean and variance |
| private static final long | serialVersionUID
Serialization UID |
| private Sum | sum
sum of values that have been added |
| private StorelessUnivariateStatistic | sumImpl
Sum statistic implementation - can be reset by setter. |
| private SumOfLogs | sumLog
sumLog of values that have been added |
| private StorelessUnivariateStatistic | sumLogImpl
Sum of log statistic implementation - can be reset by setter. |
| private SumOfSquares | sumsq
sum of the square of each value that has been added |
| private StorelessUnivariateStatistic | sumsqImpl
Sum of squares statistic implementation - can be reset by setter. |
| private Variance | variance
variance of values that have been added |
| private StorelessUnivariateStatistic | varianceImpl
Variance statistic implementation - can be reset by setter. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | SummaryStatistics(SummaryStatistics
the original)SummaryStatistics instance to copyA copy constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| public void | |
| public SummaryStatistics | Returns: a copy of thisReturns a copy of this SummaryStatistics instance with the same internal state. |
| public static void | copy(SummaryStatistics
SummaryStatistics to copy source, SummaryStatistics SummaryStatistics to copy to dest)Copies source to dest. |
| public boolean | Returns: true if object equals thisthe object to test equality against. object)Overrides java. Returns true iff |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic implementing the geometric meanReturns the currently configured geometric mean implementation |
| public double | Returns: the geometric meanReturns the geometric mean of the values that have been added. |
| public double | Returns: the maximumImplements org. Returns the maximum of the values that have been added. |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic implementing the maximumReturns the currently configured maximum implementation |
| public double | Returns: the meanImplements org. Returns the mean of the values that have been added. |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic implementing the meanReturns the currently configured mean implementation |
| public double | Returns: the minimumImplements org. Returns the minimum of the values that have been added. |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic 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: the population varianceReturns the population variance of the values that have been added. |
| 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: second central moment statisticReturns a statistic related to the Second Central Moment. |
| public double | Returns: the standard deviationImplements org. Returns the standard deviation of the values that have been added. |
| public double | Returns: The sum orDouble.NaN if no values have been addedImplements org. Returns the sum of the values that have been added |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic implementing the sumReturns the currently configured Sum implementation |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic implementing the log sumReturns the currently configured sum of logs implementation |
| public StatisticalSummary | Returns: Current values of statisticsReturn a |
| public double | Returns: the sum of logsReturns the sum of the logs of the values that have been added. |
| public double | Returns: The sum of squaresReturns the sum of the squares of the values that have been added. |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic implementing the sum of squaresReturns the currently configured sum of squares implementation |
| public double | Returns: the varianceImplements org. Returns the (sample) variance of the available values. |
| public StorelessUnivariateStatistic | Returns: the StorelessUnivariateStatistic implementing the varianceReturns the currently configured variance implementation |
| public int | Returns: hash codeOverrides java. Returns hash code based on values of statistics |
| public void | setGeoMeanImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the geometric mean geoMeanImpl)Sets the implementation for the geometric mean. |
| public void | setMaxImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the maximum maxImpl)Sets the implementation for the maximum. |
| public void | setMeanImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the mean meanImpl)Sets the implementation for the mean. |
| public void | setMinImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the minimum minImpl)Sets the implementation for the minimum. |
| public void | setSumImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the Sum sumImpl)Sets the implementation for the Sum. |
| public void | setSumLogImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the log sum sumLogImpl)Sets the implementation for the sum of logs. |
| public void | setSumsqImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the sum of squares sumsqImpl)Sets the implementation for the sum of squares. |
| public void | setVarianceImpl(StorelessUnivariateStatistic
the StorelessUnivariateStatistic instance to use for
computing the variance varianceImpl)Sets the implementation for the variance. |
| public String | Returns: String with line feeds displaying statisticsOverrides java. Generates a text report displaying summary statistics from values that have been added. |
| geoMean | back to summary |
|---|---|
| private GeometricMean geoMean geoMean of values that have been added | |
| geoMeanImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic geoMeanImpl Geometric mean statistic implementation - can be reset by setter. | |
| max | back to summary |
|---|---|
| private Max max max of values that have been added | |
| maxImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic maxImpl Maximum statistic implementation - can be reset by setter. | |
| mean | back to summary |
|---|---|
| private Mean mean mean of values that have been added | |
| meanImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic meanImpl Mean statistic implementation - can be reset by setter. | |
| min | back to summary |
|---|---|
| private Min min min of values that have been added | |
| minImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic minImpl Minimum statistic implementation - can be reset by setter. | |
| n | back to summary |
|---|---|
| private long n count of values that have been added | |
| secondMoment | back to summary |
|---|---|
| private SecondMoment secondMoment SecondMoment is used to compute the mean and variance | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization UID | |
| sum | back to summary |
|---|---|
| private Sum sum sum of values that have been added | |
| sumImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic sumImpl Sum statistic implementation - can be reset by setter. | |
| sumLog | back to summary |
|---|---|
| private SumOfLogs sumLog sumLog of values that have been added | |
| sumLogImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic sumLogImpl Sum of log statistic implementation - can be reset by setter. | |
| sumsq | back to summary |
|---|---|
| private SumOfSquares sumsq sum of the square of each value that has been added | |
| sumsqImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic sumsqImpl Sum of squares statistic implementation - can be reset by setter. | |
| variance | back to summary |
|---|---|
| private Variance variance variance of values that have been added | |
| varianceImpl | back to summary |
|---|---|
| private StorelessUnivariateStatistic varianceImpl Variance statistic implementation - can be reset by setter. | |
| SummaryStatistics | back to summary |
|---|---|
| public SummaryStatistics() Construct a SummaryStatistics instance | |
| SummaryStatistics | back to summary |
|---|---|
| public SummaryStatistics(SummaryStatistics original) throws NullArgumentException A copy constructor. Creates a deep-copy of the
| |
| addValue | back to summary |
|---|---|
| public void addValue(double value) Add a value to the data
| |
| checkEmpty | back to summary |
|---|---|
| private void checkEmpty() throws MathIllegalStateException Throws IllegalStateException if n > 0.
| |
| clear | back to summary |
|---|---|
| public void clear() Resets all statistics and storage | |
| copy | back to summary |
|---|---|
| public SummaryStatistics copy() Returns a copy of this SummaryStatistics instance with the same internal state.
| |
| copy | back to summary |
|---|---|
| public static void copy(SummaryStatistics source, SummaryStatistics dest) throws NullArgumentException Copies source to dest. Neither source nor dest can be null.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Returns true iff | |
| getGeoMeanImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getGeoMeanImpl() Returns the currently configured geometric mean implementation
| |
| getGeometricMean | back to summary |
|---|---|
| public double getGeometricMean() Returns the geometric mean of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getMax | back to summary |
|---|---|
| public double getMax() Implements org. Returns the maximum of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getMaxImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getMaxImpl() Returns the currently configured maximum implementation
| |
| getMean | back to summary |
|---|---|
| public double getMean() Implements org. Returns the mean of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getMeanImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getMeanImpl() Returns the currently configured mean implementation
| |
| getMin | back to summary |
|---|---|
| public double getMin() Implements org. Returns the minimum of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getMinImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getMinImpl() Returns the currently configured minimum implementation
| |
| getN | back to summary |
|---|---|
| public long getN() Implements org. Returns the number of available values
| |
| getPopulationVariance | back to summary |
|---|---|
| public double getPopulationVariance() Returns the population variance of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getQuadraticMean | back to summary |
|---|---|
| public double getQuadraticMean() Returns the quadratic mean, a.k.a. root-mean-square of the available values
| |
| getSecondMoment | back to summary |
|---|---|
| public double getSecondMoment() Returns a statistic related to the Second Central Moment. Specifically, what is returned is the sum of squared deviations from the sample mean among the values that have been added.
Returns
| |
| getStandardDeviation | back to summary |
|---|---|
| public double getStandardDeviation() Implements org. Returns the standard deviation of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getSum | back to summary |
|---|---|
| public double getSum() Implements org. Returns the sum of the values that have been added
| |
| getSumImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getSumImpl() Returns the currently configured Sum implementation
| |
| getSumLogImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getSumLogImpl() Returns the currently configured sum of logs implementation
| |
| getSummary | back to summary |
|---|---|
| public StatisticalSummary getSummary() Return a
| |
| getSumOfLogs | back to summary |
|---|---|
| public double getSumOfLogs() Returns the sum of the logs of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getSumsq | back to summary |
|---|---|
| public double getSumsq() Returns the sum of the squares of the values that have been added. Double.NaN is returned if no values have been added.
| |
| getSumsqImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getSumsqImpl() Returns the currently configured sum of squares implementation
| |
| 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 Double.NaN is returned if no values have been added.
| |
| getVarianceImpl | back to summary |
|---|---|
| public StorelessUnivariateStatistic getVarianceImpl() Returns the currently configured variance implementation
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns hash code based on values of statistics
| |
| setGeoMeanImpl | back to summary |
|---|---|
| public void setGeoMeanImpl(StorelessUnivariateStatistic geoMeanImpl) throws MathIllegalStateException Sets the implementation for the geometric mean.
This method cannot be activated after data has been added - i.e.,
after
| |
| setMaxImpl | back to summary |
|---|---|
| public void setMaxImpl(StorelessUnivariateStatistic maxImpl) throws MathIllegalStateException Sets the implementation for the maximum.
This method cannot be activated after data has been added - i.e.,
after
| |
| setMeanImpl | back to summary |
|---|---|
| public void setMeanImpl(StorelessUnivariateStatistic meanImpl) throws MathIllegalStateException Sets the implementation for the mean.
This method cannot be activated after data has been added - i.e.,
after
| |
| setMinImpl | back to summary |
|---|---|
| public void setMinImpl(StorelessUnivariateStatistic minImpl) throws MathIllegalStateException Sets the implementation for the minimum.
This method cannot be activated after data has been added - i.e.,
after
| |
| setSumImpl | back to summary |
|---|---|
| public void setSumImpl(StorelessUnivariateStatistic sumImpl) throws MathIllegalStateException Sets the implementation for the Sum.
This method cannot be activated after data has been added - i.e.,
after
| |
| setSumLogImpl | back to summary |
|---|---|
| public void setSumLogImpl(StorelessUnivariateStatistic sumLogImpl) throws MathIllegalStateException Sets the implementation for the sum of logs.
This method cannot be activated after data has been added - i.e.,
after
| |
| setSumsqImpl | back to summary |
|---|---|
| public void setSumsqImpl(StorelessUnivariateStatistic sumsqImpl) throws MathIllegalStateException Sets the implementation for the sum of squares.
This method cannot be activated after data has been added - i.e.,
after
| |
| setVarianceImpl | back to summary |
|---|---|
| public void setVarianceImpl(StorelessUnivariateStatistic varianceImpl) throws MathIllegalStateException Sets the implementation for the variance.
This method cannot be activated after data has been added - i.e.,
after
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Generates a text report displaying summary statistics from values that have been added. | |