Class BaseStatisticsBean
java.lang.Object
com.espertech.esper.common.internal.view.derived.BaseStatisticsBean
- All Implemented Interfaces:
Serializable
,Cloneable
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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addPoint
(double x) Add a data point for the X data set only.final void
addPoint
(double x, double y) Add a data point.final Object
clone()
final double
Return the correlation value for the two data series (Microsoft Excel function CORREL).long
Returns the number of datapoints.final long
getN()
Returns the number of data points.double
getSlope()
Returns the slope.double
getSumX()
Returns sum of x.final double
For use by subclasses, returns sum (X * X).final double
getSumXY()
For use by subclasses, returns sum (X * Y).double
getSumY()
Returns sum of y.final double
For use by subclasses, returns sum (Y * Y).final double
Returns the average of all X data points.final double
Calculates standard deviation for X based on the entire population given as arguments.final double
Calculates standard deviation for X based on the sample data points supplied.final double
getXSum()
Returns the sum of all X data points.final double
Calculates standard deviation for X based on the sample data points supplied.final double
Returns the average of all Y data points.double
Returns the Y intercept.final double
Calculates standard deviation for Y based on the entire population given as arguments.final double
Calculates standard deviation for Y based on the sample data points supplied.final double
getYSum()
Returns the sum of all Y data points.final double
Calculates standard deviation for Y based on the sample data points supplied.final void
removePoint
(double x) Remove a X data point only.final void
removePoint
(double x, double y) Remove a data point.void
setDataPoints
(long dataPoints) Sets the number of datapointsvoid
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.final String
toString()
-
Constructor Details
-
BaseStatisticsBean
public BaseStatisticsBean()
-
-
Method Details
-
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
-
toString
-
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
-