org.apache.commons.math.stat.descriptive
Class SummaryStatistics

java.lang.Object
  extended byorg.apache.commons.math.stat.descriptive.SummaryStatistics
All Implemented Interfaces:
Serializable, StatisticalSummary
Direct Known Subclasses:
SummaryStatisticsImpl

public abstract class SummaryStatistics
extends Object
implements StatisticalSummary, Serializable

Abstract factory class for univariate statistical summaries.

Version:
$Revision: 348519 $ $Date: 2005-11-23 12:12:18 -0700 (Wed, 23 Nov 2005) $
See Also:
Serialized Form

Constructor Summary
SummaryStatistics()
           
 
Method Summary
abstract  void addValue(double v)
          Adds the value to the data to be summarized
abstract  void clear()
          Resets all statistics
 boolean equals(Object object)
          Returns true iff object is a SummaryStatistics instance and all statistics have the same values as this.
abstract  double getGeometricMean()
          Returns the geometric mean of the available values
abstract  double getMax()
          Returns the maximum of the available values
abstract  double getMean()
          Returns the arithmetic mean of the available values
abstract  double getMin()
          Returns the minimum of the available values
abstract  long getN()
          Returns the number of available values
abstract  double getStandardDeviation()
          Returns the standard deviation of the available values.
abstract  double getSum()
          Returns the sum of the values that have been added to Univariate.
 StatisticalSummary getSummary()
          Return a StatisticalSummaryValues instance reporting current statistics.
abstract  double getSumsq()
          Returns the sum of the squares of the available values.
abstract  double getVariance()
          Returns the variance of the available values.
 int hashCode()
          Returns hash code based on values of statistics
static SummaryStatistics newInstance()
          Create an instance of a SummaryStatistics
static SummaryStatistics newInstance(Class cls)
          Create an instance of a SummaryStatistics
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SummaryStatistics

public SummaryStatistics()
Method Detail

newInstance

public static SummaryStatistics newInstance(Class cls)
                                     throws InstantiationException,
                                            IllegalAccessException
Create an instance of a SummaryStatistics

Parameters:
cls - the type of SummaryStatistics 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 SummaryStatistics newInstance()
Create an instance of a SummaryStatistics

Returns:
a new SummaryStatistics instance.

getSummary

public StatisticalSummary getSummary()
Return a StatisticalSummaryValues instance reporting current statistics.

Returns:
Current values of statistics

addValue

public abstract void addValue(double v)
Adds the value to the data to be summarized

Parameters:
v - the value to be added

getMean

public abstract 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 abstract 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 abstract 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 abstract 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.

getMax

public abstract 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 abstract 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 abstract 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 abstract 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


equals

public boolean equals(Object object)
Returns true iff object is a SummaryStatistics instance and all statistics have the same values as this.

Parameters:
object - the object to test equality against.
Returns:
true if object equals this

hashCode

public int hashCode()
Returns hash code based on values of statistics

Returns:
hash code


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