jhplot.stat
Class LinReg

java.lang.Object
  extended by jhplot.stat.LinReg

public class LinReg
extends java.lang.Object

A linear regression analysis.


Constructor Summary
LinReg(double[] aX, double[] aY)
          Constructor for regression calculations
LinReg(P1D aXY)
          constructor for regression calculations.
 
Method Summary
 void addPoint(double xValue, double yValue)
          Add a point to the data and redo the regression
 P1D[] getConfidence()
          Get confidence intervals for means
 P1D[] getConfidence(java.awt.Color color)
          Get confidence intervals for means
 P1D getConfidenceBand(java.awt.Color color, double transparency)
          Calculate confidence band in form of P1D with errors.
 P1D getConfidenceBand(int Npoints, java.awt.Color color, double transparency)
          Calculate confidence band in form of P1D with errors.
 double getCorrelation()
          Get correlation coefficient
 int getDataLength()
          Get the size of the input data
 double[] getDataX()
          Get an array with X data
 double[] getDataY()
          Get an array with Y data
 double getIntercept()
          Get Intercept
 double getInterceptError()
          Get the standard error on intercept
 double getMaxAbsoluteResidual()
          Get max absolute residual
 double getMaxX()
          Get a maximum value for X
 double getMaxY()
          Get maximum value in Y
 double getMinX()
          Get a minimum value for X
 double getMinY()
          Get minimum value for Y
 double getMSE()
          Get MSE value
 double getPearsonR()
          Get pearson R
 P1D[] getPrediction()
          Get prediction lines
 P1D[] getPrediction(java.awt.Color color)
          Get prediction lines
 P1D getPredictionBand(java.awt.Color color, double transparency)
          Calculate the prediction band in form of P1D with errors.
 P1D getPredictionBand(int Npoints, java.awt.Color color, double transparency)
          Calculate the prediction band in form of P1D with errors.
 P1D getResiduals()
          Get residuals
 F1D getResult()
          Get the linear regression result
 double getSlope()
          Get slope
 double getSlopeError()
          Get the standard error on slope
 double getSSE()
          Get SSE value
 double getSSR()
          Ger SSR value
 double getSumXSquared()
          Get sun of the square
 double getSxx()
          Get Sxx value: sumXsquared - sumX * sumX / n
 double getSyy()
          Get SYY value: sumYsquared - sumY * sumY / n
 double getXBar()
          Get average x
 double getYBar()
          Get average Y
 void reset()
          reset data to 0
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinReg

public LinReg(double[] aX,
              double[] aY)
Constructor for regression calculations

Parameters:
aX - is the array of x data
aY - is the array of y data

LinReg

public LinReg(P1D aXY)
constructor for regression calculations. It should be noted that only X and Y values from the input P1D data holder are used

Parameters:
aXY - P1D container for X and Y values
Method Detail

reset

public void reset()
reset data to 0


getCorrelation

public double getCorrelation()
Get correlation coefficient

Returns:
Correlation coefficient.

getIntercept

public double getIntercept()
Get Intercept

Returns:
Intercept

getInterceptError

public double getInterceptError()
Get the standard error on intercept

Returns:
standard error on intercept

getSlopeError

public double getSlopeError()
Get the standard error on slope

Returns:
standard error on slope

getSlope

public double getSlope()
Get slope

Returns:
slope

getResiduals

public P1D getResiduals()
Get residuals

Returns:
P1D array with residuals

getDataX

public double[] getDataX()
Get an array with X data

Returns:
array with X data

getDataY

public double[] getDataY()
Get an array with Y data

Returns:
array with Y data

addPoint

public void addPoint(double xValue,
                     double yValue)
Add a point to the data and redo the regression

Parameters:
xValue - X value
yValue - Y value

getMinX

public double getMinX()
Get a minimum value for X

Returns:
Minimum value

getMaxX

public double getMaxX()
Get a maximum value for X

Returns:
Max value in X

getMinY

public double getMinY()
Get minimum value for Y

Returns:
minimum Y value

getMaxY

public double getMaxY()
Get maximum value in Y

Returns:
Maximum value in Y

getMaxAbsoluteResidual

public double getMaxAbsoluteResidual()
Get max absolute residual

Returns:
max absolute residual

getSxx

public double getSxx()
Get Sxx value: sumXsquared - sumX * sumX / n

Returns:
Sxx

getSyy

public double getSyy()
Get SYY value: sumYsquared - sumY * sumY / n

Returns:
Syy valye

getSSR

public double getSSR()
Ger SSR value

Returns:
SSR value

getSSE

public double getSSE()
Get SSE value

Returns:
SSE value

getMSE

public double getMSE()
Get MSE value

Returns:
MSE value

getXBar

public double getXBar()
Get average x

Returns:
average X

getYBar

public double getYBar()
Get average Y

Returns:
average Y

getDataLength

public int getDataLength()
Get the size of the input data

Returns:
size of data array

getPearsonR

public double getPearsonR()
Get pearson R

Returns:
pearson R

getSumXSquared

public double getSumXSquared()
Get sun of the square

Returns:
sum of the square

getResult

public F1D getResult()
Get the linear regression result

Returns:
Resulting function

getConfidence

public P1D[] getConfidence()
Get confidence intervals for means

Returns:
P1D[2] for lower and high

getConfidence

public P1D[] getConfidence(java.awt.Color color)
Get confidence intervals for means

Parameters:
color - color used to draw
Returns:
P1D[2] for lower and high

getPrediction

public P1D[] getPrediction()
Get prediction lines

Returns:
P1D[2] for lower and high

getPrediction

public P1D[] getPrediction(java.awt.Color color)
Get prediction lines

Parameters:
color - color used to draw
Returns:
P1D[2] for lower and high

getConfidenceBand

public P1D getConfidenceBand(java.awt.Color color,
                             double transparency)
Calculate confidence band in form of P1D with errors. The number of total points for P1D is set to 100 by default.

Parameters:
color - Color used to show the band
transparancy - level of color transparency (between 0 and 1)
Returns:
P1D with fit values. Errors show the confidence band

getConfidenceBand

public P1D getConfidenceBand(int Npoints,
                             java.awt.Color color,
                             double transparency)
Calculate confidence band in form of P1D with errors.

Parameters:
Npoints - number of points to display the band
color - Color used to show the band
transparancy - level of color transparency (between 0 and 1)
Returns:
P1D with fit values. Errors show the confidence band

getPredictionBand

public P1D getPredictionBand(java.awt.Color color,
                             double transparency)
Calculate the prediction band in form of P1D with errors. The number of total points for P1D is set to 100 by default.

Parameters:
color - Color used to show the band
transparancy - level of color transparency (between 0 and 1)
Returns:
P1D with fit values. Errors show the prediction band

getPredictionBand

public P1D getPredictionBand(int Npoints,
                             java.awt.Color color,
                             double transparency)
Calculate the prediction band in form of P1D with errors.

Parameters:
Npoints - number of points for evaluation
color - Color used to show the band
transparancy - level of color transparency (between 0 and 1)
Returns:
P1D with fit values. Errors show the prediction band


jHepWork 1.7 (C) Chekanov