jhplot.stat
Class LinReg
- java.lang.Object
-
- jhplot.stat.LinReg
-
public class LinReg extends java.lang.Object
A linear regression analysis.
-
-
Constructor Summary
Constructors Constructor and Description LinReg(double[] aX, double[] aY)
Constructor for regression calculationsLinReg(P1D aXY)
constructor for regression calculations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addPoint(double xValue, double yValue)
Add a point to the data and redo the regressionvoid
doc()
Show online documentation.P1D[]
getConfidence()
Get confidence intervals for meansP1D[]
getConfidence(java.awt.Color color)
Get confidence intervals for meansP1D
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 coefficientint
getDataLength()
Get the size of the input datadouble[]
getDataX()
Get an array with X datadouble[]
getDataY()
Get an array with Y datadouble
getIntercept()
Get Interceptdouble
getInterceptError()
Get the standard error on interceptdouble
getMaxAbsoluteResidual()
Get max absolute residualdouble
getMaxX()
Get a maximum value for Xdouble
getMaxY()
Get maximum value in Ydouble
getMinX()
Get a minimum value for Xdouble
getMinY()
Get minimum value for Ydouble
getMSE()
Get MSE valuedouble
getPearsonR()
Get pearson RP1D[]
getPrediction()
Get prediction linesP1D[]
getPrediction(java.awt.Color color)
Get prediction linesP1D
getPredictionBand()
Calculate the prediction band in form of P1D with errors.P1D
getPredictionBand(java.awt.Color color)
Calculate the prediction band in form of P1D with errors.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 residualsF1D
getResult()
Get the linear regression resultdouble
getSlope()
Get slopedouble
getSlopeError()
Get the standard error on slopedouble
getSSE()
Get SSE valuedouble
getSSR()
Ger SSR valuedouble
getSumXSquared()
Get sun of the squaredouble
getSxx()
Get Sxx value: sumXsquared - sumX * sumX / ndouble
getSyy()
Get SYY value: sumYsquared - sumY * sumY / ndouble
getXBar()
Get average xdouble
getYBar()
Get average Yvoid
reset()
reset data to 0
-
-
-
Constructor Detail
-
LinReg
public LinReg(double[] aX, double[] aY)
Constructor for regression calculations- Parameters:
aX
- is the array of x dataaY
- 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 valueyValue
- 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 bandtransparancy
- 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 bandcolor
- Color used to show the bandtransparancy
- level of color transparency (between 0 and 1)- Returns:
- P1D with fit values. Errors show the confidence band
-
getPredictionBand
public P1D getPredictionBand()
Calculate the prediction band in form of P1D with errors. The number of total points for P1D is set to 100 by default.- Returns:
- P1D with fit values. Errors show the prediction band
-
getPredictionBand
public P1D getPredictionBand(java.awt.Color color)
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- Returns:
- P1D with fit values. Errors show the prediction 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 bandtransparancy
- 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 evaluationcolor
- Color used to show the bandtransparancy
- level of color transparency (between 0 and 1)- Returns:
- P1D with fit values. Errors show the prediction band
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG