edu.cmu.minorthird.util
Class MathUtil.Accumulator

java.lang.Object
  extended by edu.cmu.minorthird.util.MathUtil.Accumulator
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
MathUtil

public static class MathUtil.Accumulator
extends java.lang.Object
implements java.io.Serializable

Accumulate a list of numbers, then report on mean, standard deviation, and other common statistics.

See Also:
Serialized Form

Constructor Summary
MathUtil.Accumulator()
           
 
Method Summary
 void add(double d)
          Add a new number to the accumulator.
 void addAll(MathUtil.Accumulator b)
          Combine two accumulators.
 double binomialStdErr()
          The standard error of binomially distributed values.
 void clear()
          Clear the accumulator
 double mean()
          The mean of accumulated values.
 double numberOfValues()
          The number of accumulated values.
 double populationStdDev()
          The population standard devation of the accumulated values.
 double stdDev()
          The sample standard devation of the accumulated values.
 double stdErr()
          The sample standard error of the accumulated values.
 double variance()
          The variance of the accumulated values.
 double z(double expected)
          The Z statistic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathUtil.Accumulator

public MathUtil.Accumulator()
Method Detail

clear

public void clear()
Clear the accumulator


add

public void add(double d)
Add a new number to the accumulator.


addAll

public void addAll(MathUtil.Accumulator b)
Combine two accumulators. Result will be be as if every call b.add(x) had been followed by a call to this.add(x).


mean

public double mean()
The mean of accumulated values.


numberOfValues

public double numberOfValues()
The number of accumulated values.


variance

public double variance()
The variance of the accumulated values.


populationStdDev

public double populationStdDev()
The population standard devation of the accumulated values.


stdDev

public double stdDev()
The sample standard devation of the accumulated values.


stdErr

public double stdErr()
The sample standard error of the accumulated values.


binomialStdErr

public double binomialStdErr()
The standard error of binomially distributed values.


z

public double z(double expected)
The Z statistic.