Package uk.ac.starlink.ttools.plot
Class XYStats
- java.lang.Object
-
- uk.ac.starlink.ttools.plot.XYStats
-
public class XYStats extends java.lang.ObjectCalculates X-Y correlation statistics.- Since:
- 15 Jul 2004
- Author:
- Mark Taylor (Starlink)
-
-
Constructor Summary
Constructors Constructor Description XYStats(boolean xLog, boolean yLog)Constructs a new correlation statistics calculator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPoint(double x, double y)Submits a data point for calculations.doublegetCorrelation()Returns the product moment correlation coefficient.double[]getLinearCoefficients()Returns the polynomial coefficients of a linear regression line for the submitted data.double[]linearRegressionLine()Calculates the linear regression line for the submitted points.
-
-
-
Method Detail
-
addPoint
public void addPoint(double x, double y)Submits a data point for calculations.- Parameters:
x- X coordinatey- Y coordinate
-
getLinearCoefficients
public double[] getLinearCoefficients()
Returns the polynomial coefficients of a linear regression line for the submitted data.- Returns:
- 2-element array: (intercept, gradient)
-
getCorrelation
public double getCorrelation()
Returns the product moment correlation coefficient.- Returns:
- correlation coefficient
-
linearRegressionLine
public double[] linearRegressionLine()
Calculates the linear regression line for the submitted points. The endpoints of the line correspond to the lowest and highest X values submitted.- Returns:
- 4-element array giving the endpoints (low-X, low-Y, high-X, high-Y) of a linear regression line for these data
-
-