papaya
Class Linear.StdErr

java.lang.Object
  extended by papaya.Linear.StdErr
Enclosing class:
Linear

public static class Linear.StdErr
extends Object

Contains methods related to computing the standard errors of the residuals, slope and intercept associated with the best-fit linear line.


Method Summary
static float intercept(float[] x, float residualStdErr)
          Returns the standard error of the computed slope given x and the standard error in the residuals.
static float residual(float[] residuals, int df)
          Returns the standard error of the residuals given the degrees of freedom.
static float slope(float[] x, float residualStdErr)
          Returns the standard error of the computed slope given x and the standard error in the residuals.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

residual

public static float residual(float[] residuals,
                             int df)
Returns the standard error of the residuals given the degrees of freedom. That is,
 residualStdErr = Sqrt ( Sum( (delta[i] - mean(delta))^2 ) / df )
 
where df is the degrees of freedom ( (n-1) if the y-intercept was pre-specified in the best-fit line, (n-2) if neither slope nor intercept were specified.)

Parameters:
residuals -
df -
Returns:
standard error of the residual

slope

public static float slope(float[] x,
                          float residualStdErr)
Returns the standard error of the computed slope given x and the standard error in the residuals. That is,
 slopeStdErr = residualStdErr / Sum ( (x[i] - mean(x))^2 ).
 

Parameters:
x - the independent variable
residualStdErr - the standard error of the residual
Returns:
the error in the slope.

intercept

public static float intercept(float[] x,
                              float residualStdErr)
Returns the standard error of the computed slope given x and the standard error in the residuals. That is,
 interceptStdErr = slopeStdErr / Sqrt( Sum(x[i]*x[i])/size ).
 
where the slopeStdErr is computed using the methods specified in slope(float[], float).

Parameters:
x - the independent variable
residualStdErr - the standard error of the residual
Returns:
error in the slope.


Processing library papaya by Adila Faruk. (C) 2014