it.unimi.dsi.stat
Class SummaryStats

java.lang.Object
  extended by it.unimi.dsi.stat.SummaryStats
All Implemented Interfaces:
Size64

public class SummaryStats
extends Object
implements Size64

A simple class digesting a stream of numbers and providing basic statistics about the stream. You just have to create an instance, call add(double) or add(double[]) to add elements.

Author:
Sebastiano Vigna

Constructor Summary
SummaryStats()
           
 
Method Summary
 void add(double x)
          Adds a value to the stream.
 void add(double[] a)
          Deprecated. Use addAll(double[]).
 void addAll(double[] a)
          Adds values to the stream.
 void addAll(DoubleList l)
          Adds values to the stream.
 double max()
          Returns the maximum of the values added so far.
 double mean()
          Returns the mean of the values added so far.
 double min()
          Returns the minimum of the values added so far.
 double relativeStandardDeviation()
          Returns the relative standard deviation of the values added so far.
 double sampleRelativeStandardDeviation()
          Returns the sample relative standard deviation of the values added so far.
 double sampleStandardDeviation()
          Returns the sample standard deviation of the values added so far.
 double sampleVariance()
          Returns the sample variance of the values added so far.
 int size()
          Deprecated. 
 long size64()
          Returns the number of values added so far.
 double standardDeviation()
          Returns the standard deviation of the values added so far.
 double sum()
          Returns the sum of the values added so far.
 double variance()
          Returns the variance of the values added so far.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SummaryStats

public SummaryStats()
Method Detail

add

public void add(double x)
Adds a value to the stream.

Parameters:
x - the new value.

add

@Deprecated
public void add(double[] a)
Deprecated. Use addAll(double[]).

Adds values to the stream.

Parameters:
a - an array of new values.

addAll

public void addAll(double[] a)
Adds values to the stream.

Parameters:
a - an array of new values.

addAll

public void addAll(DoubleList l)
Adds values to the stream.

Parameters:
l - a list of new values.

mean

public double mean()
Returns the mean of the values added so far.

Returns:
the mean of the values added so far.

sum

public double sum()
Returns the sum of the values added so far.

Returns:
the sum of the values added so far.

sampleVariance

public double sampleVariance()
Returns the sample variance of the values added so far.

Returns:
the sample variance of the values added so far.
See Also:
variance()

variance

public double variance()
Returns the variance of the values added so far.

Returns:
the variance of the values added so far.
See Also:
sampleVariance()

sampleStandardDeviation

public double sampleStandardDeviation()
Returns the sample standard deviation of the values added so far.

Returns:
the sample standard deviation of the values added so far.
See Also:
standardDeviation()

standardDeviation

public double standardDeviation()
Returns the standard deviation of the values added so far.

Returns:
the standard deviation of the values added so far.
See Also:
sampleStandardDeviation()

sampleRelativeStandardDeviation

public double sampleRelativeStandardDeviation()
Returns the sample relative standard deviation of the values added so far.

Returns:
the sample relative standard deviation of the values added so far.
See Also:
relativeStandardDeviation()

relativeStandardDeviation

public double relativeStandardDeviation()
Returns the relative standard deviation of the values added so far.

Returns:
the relative standard deviation of the values added so far.
See Also:
sampleRelativeStandardDeviation()

min

public double min()
Returns the minimum of the values added so far.

Returns:
the minimum of the values added so far.

max

public double max()
Returns the maximum of the values added so far.

Returns:
the maximum of the values added so far.

size64

public long size64()
Returns the number of values added so far.

Specified by:
size64 in interface Size64
Returns:
the number of values added so far.

size

@Deprecated
public int size()
Deprecated. 

Specified by:
size in interface Size64