com.espertech.esper.view.stat
Class BaseStatisticsBean

java.lang.Object
  extended by com.espertech.esper.view.stat.BaseStatisticsBean
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class BaseStatisticsBean
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

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.
 java.lang.Object clone()
           
 double getCorrelation()
          Return the correlation value for the two data series (Microsoft Excel function CORREL).
 long getDataPoints()
          Returns the number of datapoints.
 long getN()
          Returns the number of data points.
 double getSlope()
          Returns the slope.
 double getSumX()
          Returns sum of x.
 double getSumXSq()
          For use by subclasses, returns sum (X * X).
 double getSumXY()
          For use by subclasses, returns sum (X * Y).
 double getSumY()
          Returns sum of 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 getYIntercept()
          Returns the Y intercept.
 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.
 void setDataPoints(long dataPoints)
          Sets the number of datapoints
 void setSumX(double sumX)
          Sets the sum X.
 void setSumXSq(double sumXSq)
          Sets the sum X square.
 void setSumXY(double sumXY)
          Sets the sum of x times y.
 void setSumY(double sumY)
          Sets the sum Y.
 void setSumYSq(double sumYSq)
          Sets the sum Y square.
 java.lang.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 java.lang.Object clone()
Overrides:
clone in class java.lang.Object

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

setSumX

public void setSumX(double sumX)
Sets the sum X.

Parameters:
sumX - to set

setSumXSq

public void setSumXSq(double sumXSq)
Sets the sum X square.

Parameters:
sumXSq - to set

setSumY

public void setSumY(double sumY)
Sets the sum Y.

Parameters:
sumY - to set

setSumYSq

public void setSumYSq(double sumYSq)
Sets the sum Y square.

Parameters:
sumYSq - to set

setSumXY

public void setSumXY(double sumXY)
Sets the sum of x times y.

Parameters:
sumXY - sum of x times y.

setDataPoints

public void setDataPoints(long dataPoints)
Sets the number of datapoints

Parameters:
dataPoints - to set

getSumX

public double getSumX()
Returns sum of x.

Returns:
sum of x

getSumY

public double getSumY()
Returns sum of y.

Returns:
sum of y

getDataPoints

public long getDataPoints()
Returns the number of datapoints.

Returns:
datapoints

getYIntercept

public double getYIntercept()
Returns the Y intercept.

Returns:
Y intercept

getSlope

public double getSlope()
Returns the slope.

Returns:
regression slope

getCorrelation

public final double getCorrelation()
Return the correlation value for the two data series (Microsoft Excel function CORREL).

Returns:
correlation value

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com