org.jscience.physics.nuclear.kinematics.math.statistics
Class LinearFitErrY

java.lang.Object
  extended by org.jscience.physics.nuclear.kinematics.math.statistics.LinearFitErrY

public class LinearFitErrY
extends java.lang.Object

Given a data set, performs a linear regression, then can be queried for the results. Based on code in Numerical Recipes in C


Field Summary
 double[] residual
          DOCUMENT ME!
 
Constructor Summary
LinearFitErrY()
          do-nothing initializer to re-use this same code for multiple fits
LinearFitErrY(double[] x, double[] y)
          Creates and performs linear regression on unweighted data set.
LinearFitErrY(double[] x, double[] y, double[] sig)
          Creates and performs linear regression on weighted data set.
LinearFitErrY(java.io.File batch, java.io.File out)
          Creates a new LinearFitErrY object.
 
Method Summary
 double calculateY(double x)
          DOCUMENT ME!
 void fit(double[] x, double[] y)
          DOCUMENT ME!
 void fit(double[] x, double[] y, double[] sig)
          DOCUMENT ME!
 double get_p_value()
          DOCUMENT ME!
 double getChiSq()
          DOCUMENT ME!
 int getDegreesOfFreedom()
          DOCUMENT ME!
 double getOffset()
          DOCUMENT ME!
 double getOffsetErr()
          DOCUMENT ME!
 double getReducedChiSq()
          DOCUMENT ME!
 double getSlope()
          DOCUMENT ME!
 double getSlopeErr()
          DOCUMENT ME!
 LinearFitErrY invertFit()
          Inverts x and y data sets.
static void main(java.lang.String[] args)
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

residual

public double[] residual
DOCUMENT ME!

Constructor Detail

LinearFitErrY

public LinearFitErrY()
do-nothing initializer to re-use this same code for multiple fits


LinearFitErrY

public LinearFitErrY(double[] x,
                     double[] y,
                     double[] sig)
              throws StatisticsException
Creates and performs linear regression on weighted data set.

Parameters:
x - the x coordinates of the points
y - the y coordinates of the points
sig - the error bars on the y coordinates
Throws:
StatisticsException

LinearFitErrY

public LinearFitErrY(double[] x,
                     double[] y)
              throws StatisticsException
Creates and performs linear regression on unweighted data set.

Parameters:
x - the x coordinates of the points
y - the y coordinates of the points
Throws:
StatisticsException

LinearFitErrY

public LinearFitErrY(java.io.File batch,
                     java.io.File out)
              throws StatisticsException
Creates a new LinearFitErrY object.

Parameters:
batch - DOCUMENT ME!
out - DOCUMENT ME!
Throws:
StatisticsException - DOCUMENT ME!
Method Detail

fit

public void fit(double[] x,
                double[] y,
                double[] sig)
         throws StatisticsException
DOCUMENT ME!

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
sig - DOCUMENT ME!
Throws:
StatisticsException - DOCUMENT ME!

fit

public void fit(double[] x,
                double[] y)
         throws StatisticsException
DOCUMENT ME!

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
Throws:
StatisticsException - DOCUMENT ME!

getSlope

public double getSlope()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getSlopeErr

public double getSlopeErr()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getOffset

public double getOffset()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getOffsetErr

public double getOffsetErr()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getChiSq

public double getChiSq()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getReducedChiSq

public double getReducedChiSq()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getDegreesOfFreedom

public int getDegreesOfFreedom()
DOCUMENT ME!

Returns:
DOCUMENT ME!

get_p_value

public double get_p_value()
DOCUMENT ME!

Returns:
DOCUMENT ME!

calculateY

public double calculateY(double x)
DOCUMENT ME!

Parameters:
x - DOCUMENT ME!
Returns:
DOCUMENT ME!

invertFit

public LinearFitErrY invertFit()
                        throws StatisticsException
Inverts x and y data sets. X error bars are determined using sigy/y ratios. Useful for inverting linear calibrations of positive sets (e.g., silicon detector channel vs. energy).

Returns:
DOCUMENT ME!
Throws:
StatisticsException - DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

main

public static void main(java.lang.String[] args)
DOCUMENT ME!

Parameters:
args - the command line arguments