Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.stat.descriptive
Class DescriptiveStatistics

    java.lang.Object
      org.apache.commons.math.stat.descriptive.DescriptiveStatistics

All Implemented Interfaces:
  Serializable, StatisticalSummary

Direct Known Subclasses:
  DescriptiveStatisticsImpl

public abstract class DescriptiveStatistics
extends Object
implements StatisticalSummary, Serializable

Abstract factory class for univariate statistical summaries.

Version:
  $Revision: 1.1 $ $Date: 2004/10/08 05:08:17 $
See Also:
  Serialized Form

Field Summary
`static int` | `INFINITE_WINDOW` This constant signals that a Univariate implementation takes into account the contributions of an infinite number of elements.
`(package private) static long` | `serialVersionUID` Serialization UID

Constructor Summary
`DescriptiveStatistics()`

Method Summary
`abstract void` | `addValue(double v)` Adds the value to the set of numbers
`abstract double` | `apply(UnivariateStatistic stat)` Apply the given statistic to the data associated with this set of statistics.
`abstract void` | `clear()` Resets all statistics and storage
`abstract double` | `getElement(int index)` Returns the element at the specified index
`double` | `getGeometricMean()` Returns the geometric mean of the available values
`double` | `getKurtosis()` Returns the Kurtosis of the available values.
`double` | `getMax()` Returns the maximum of the available values
`double` | `getMean()` Returns the arithmetic mean of the available values
`double` | `getMin()` Returns the minimum of the available values
`abstract long` | `getN()` Returns the number of available values
`double` | `getPercentile(double p)` Returns an estimate for the pth percentile of the stored values.
`double` | `getSkewness()` Returns the skewness of the available values.
`double[]` | `getSortedValues()` Returns the current set of values in an array of double primitives, sorted in ascending order.
`double` | `getStandardDeviation()` Returns the standard deviation of the available values.
`double` | `getSum()` Returns the sum of the values that have been added to Univariate.
`double` | `getSumsq()` Returns the sum of the squares of the available values.
`abstract double[]` | `getValues()` Returns the current set of values in an array of double primitives.
`double` | `getVariance()` Returns the variance of the available values.
`abstract int` | `getWindowSize()` Univariate has the ability to return only measures for the last N elements added to the set of values.
`static DescriptiveStatistics` | `newInstance()` Create an instance of a `DescriptiveStatistics`
`static DescriptiveStatistics` | `newInstance(Class cls)` Create an instance of a `DescriptiveStatistics`
`abstract void` | `setWindowSize(int windowSize)` WindowSize controls the number of values which contribute to the values returned by Univariate.
`String` | `toString()` Generates a text report displaying univariate statistics from values that have been added.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### serialVersionUID

    static final long serialVersionUID

  Serialization UID

  See Also:
    Constant Field Values

### INFINITE_WINDOW

    public static final int INFINITE_WINDOW

  This constant signals that a Univariate implementation takes into account the contributions of an infinite number of elements. In other words, if getWindow returns this constant, there is, in effect, no "window".

  See Also:
    Constant Field Values

Constructor Detail

### DescriptiveStatistics

    public DescriptiveStatistics()

Method Detail

### newInstance

    public static DescriptiveStatistics newInstance(Class cls)
                                             throws InstantiationException,
                                                    IllegalAccessException

  Create an instance of a `DescriptiveStatistics`

  Parameters:
    `cls` - the type of `DescriptiveStatistics` object to create.
  Returns:
    a new factory.
  Throws:
    `InstantiationException` - is thrown if the object can not be created.
    `IllegalAccessException` - is thrown if the type's default constructor is not accessible.

### newInstance

    public static DescriptiveStatistics newInstance()

  Create an instance of a `DescriptiveStatistics`

  Returns:
    a new factory.

### addValue

    public abstract void addValue(double v)

  Adds the value to the set of numbers

  Parameters:
    `v` - the value to be added

### getMean

    public double getMean()

  Returns the arithmetic mean of the available values

  Specified by:
    `getMean` in interface `StatisticalSummary`
  Returns:
    The mean or Double.NaN if no values have been added.

### getGeometricMean

    public double getGeometricMean()

  Returns the geometric mean of the available values

  Returns:
    The geometricMean, Double.NaN if no values have been added, or if the productof the available values is less than or equal to 0.

### getVariance

    public double getVariance()

  Returns the variance of the available values.

  Specified by:
    `getVariance` in interface `StatisticalSummary`
  Returns:
    The variance, Double.NaN if no values have been added or 0.0 for a single value set.

### getStandardDeviation

    public double getStandardDeviation()

  Returns the standard deviation of the available values.

  Specified by:
    `getStandardDeviation` in interface `StatisticalSummary`
  Returns:
    The standard deviation, Double.NaN if no values have been added or 0.0 for a single value set.

### getSkewness

    public double getSkewness()

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

  Returns:
    The skewness, Double.NaN if no values have been added or 0.0 for a value set <=2.

### getKurtosis

    public double getKurtosis()

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

  Returns:
    The kurtosis, Double.NaN if no values have been added, or 0.0 for a value set <=3.

### getMax

    public double getMax()

  Returns the maximum of the available values

  Specified by:
    `getMax` in interface `StatisticalSummary`
  Returns:
    The max or Double.NaN if no values have been added.

### getMin

    public double getMin()

  Returns the minimum of the available values

  Specified by:
    `getMin` in interface `StatisticalSummary`
  Returns:
    The min or Double.NaN if no values have been added.

### getN

    public abstract long getN()

  Returns the number of available values

  Specified by:
    `getN` in interface `StatisticalSummary`
  Returns:
    The number of available values

### getSum

    public double getSum()

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

  Specified by:
    `getSum` in interface `StatisticalSummary`
  Returns:
    The sum or Double.NaN if no values have been added

### getSumsq

    public double getSumsq()

  Returns the sum of the squares of the available values.

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

### clear

    public abstract void clear()

  Resets all statistics and storage

### getWindowSize

    public abstract int getWindowSize()

  Univariate has the ability to return only measures for the last N elements added to the set of values.

  Returns:
    The current window size or -1 if its Infinite.

### setWindowSize

    public abstract void setWindowSize(int windowSize)

  WindowSize controls the number of values which contribute to the values returned by Univariate. 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

  Parameters:
    `windowSize` - sets the size of the window.

### getValues

    public abstract 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:
    returns the current set of numbers in the order in which they were added to this set

### getSortedValues

    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:
    returns the current set of numbers sorted in ascending order

### getElement

    public abstract double getElement(int index)

  Returns the element at the specified index

  Parameters:
    `index` - The Index of the element
  Returns:
    return the element at the specified index

### getPercentile

    public double getPercentile(double p)

  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 `IllegalArgumentException` is thrown)
  - at least one value must be stored (returns `Double.NaN` otherwise)

  Parameters:
    `p` - the requested percentile (scaled from 0 - 100)
  Returns:
    An estimate for the pth percentile of the stored data values

### toString

    public String toString()

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

  Returns:
    String with line feeds displaying statistics

### apply

    public abstract double apply(UnivariateStatistic stat)

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

  Parameters:
    `stat` - the statistic to apply
  Returns:
    the computed value of the statistic.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.