net.esper.view.stat
Class BaseStatisticsBean

java.lang.Object
  extended by net.esper.view.stat.BaseStatisticsBean
All Implemented Interfaces:
Serializable, Cloneable, MetaDefItem
Direct Known Subclasses:
CorrelationBean, RegressionBean

public class BaseStatisticsBean
extends Object
implements Cloneable, MetaDefItem

Bean for performing statistical calculations. The bean keeps sums of X and Y datapoints and sums on squares that can be reused by subclasses. The bean calculates standard deviation (sample and population), variance, average and sum.

See Also:
Serialized Form

Constructor Summary
BaseStatisticsBean()
           
 
Method Summary
 void addPoint(double x)
          Add a data point for the X data set only.
 void addPoint(double x, double y)
          Add a data point.
 Object clone()
           
 long getN()
          Returns the number of data points.
 double getSumXSq()
          For use by subclasses, returns sum (X * X).
 double getSumXY()
          For use by subclasses, returns sum (X * Y).
 double getSumYSq()
          For use by subclasses, returns sum (Y * Y).
 double getXAverage()
          Returns the average of all X data points.
 double getXStandardDeviationPop()
          Calculates standard deviation for X based on the entire population given as arguments.
 double getXStandardDeviationSample()
          Calculates standard deviation for X based on the sample data points supplied.
 double getXSum()
          Returns the sum of all X data points.
 double getXVariance()
          Calculates standard deviation for X based on the sample data points supplied.
 double getYAverage()
          Returns the average of all Y data points.
 double getYStandardDeviationPop()
          Calculates standard deviation for Y based on the entire population given as arguments.
 double getYStandardDeviationSample()
          Calculates standard deviation for Y based on the sample data points supplied.
 double getYSum()
          Returns the sum of all Y data points.
 double getYVariance()
          Calculates standard deviation for Y based on the sample data points supplied.
 void removePoint(double x)
          Remove a X data point only.
 void removePoint(double x, double y)
          Remove a data point.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseStatisticsBean

public BaseStatisticsBean()
Method Detail

addPoint

public final void addPoint(double x)
Add a data point for the X data set only.

Parameters:
x - is the X data point to add.

addPoint

public final void addPoint(double x,
                           double y)
Add a data point.

Parameters:
x - is the X data point to add.
y - is the Y data point to add.

removePoint

public final void removePoint(double x)
Remove a X data point only.

Parameters:
x - is the X data point to remove.

removePoint

public final void removePoint(double x,
                              double y)
Remove a data point.

Parameters:
x - is the X data point to remove.
y - is the Y data point to remove.

getXStandardDeviationPop

public final double getXStandardDeviationPop()
Calculates standard deviation for X based on the entire population given as arguments. Equivalent to Microsoft Excel formula STDEVPA.

Returns:
standard deviation assuming population for X

getYStandardDeviationPop

public final double getYStandardDeviationPop()
Calculates standard deviation for Y based on the entire population given as arguments. Equivalent to Microsoft Excel formula STDEVPA.

Returns:
standard deviation assuming population for Y

getXStandardDeviationSample

public final double getXStandardDeviationSample()
Calculates standard deviation for X based on the sample data points supplied. Equivalent to Microsoft Excel formula STDEV.

Returns:
standard deviation assuming sample for X

getYStandardDeviationSample

public final double getYStandardDeviationSample()
Calculates standard deviation for Y based on the sample data points supplied. Equivalent to Microsoft Excel formula STDEV.

Returns:
standard deviation assuming sample for Y

getXVariance

public final double getXVariance()
Calculates standard deviation for X based on the sample data points supplied. Equivalent to Microsoft Excel formula STDEV.

Returns:
variance as the square of the sample standard deviation for X

getYVariance

public final double getYVariance()
Calculates standard deviation for Y based on the sample data points supplied. Equivalent to Microsoft Excel formula STDEV.

Returns:
variance as the square of the sample standard deviation for Y

getN

public final long getN()
Returns the number of data points.

Returns:
number of data points

getXSum

public final double getXSum()
Returns the sum of all X data points.

Returns:
sum of X data points

getYSum

public final double getYSum()
Returns the sum of all Y data points.

Returns:
sum of Y data points

getXAverage

public final double getXAverage()
Returns the average of all X data points.

Returns:
average of X data points

getYAverage

public final double getYAverage()
Returns the average of all Y data points.

Returns:
average of Y data points

getSumXSq

public final double getSumXSq()
For use by subclasses, returns sum (X * X).

Returns:
sum of X squared

getSumYSq

public final double getSumYSq()
For use by subclasses, returns sum (Y * Y).

Returns:
sum of Y squared

getSumXY

public final double getSumXY()
For use by subclasses, returns sum (X * Y).

Returns:
sum of X times Y

clone

public final Object clone()
Overrides:
clone in class Object

toString

public final String toString()
Overrides:
toString in class Object