dwvisser.statistics
Class PolynomialFitErrY

java.lang.Object
  |
  +--dwvisser.statistics.PolynomialFitErrY

public class PolynomialFitErrY
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

Author:
Dale Visser

Field Summary
 double[] residual
           
 
Constructor Summary
PolynomialFitErrY(java.io.File batch, java.io.File out, boolean centered)
           
PolynomialFitErrY(int order, double[] x, double[] y, double[] sig)
           
PolynomialFitErrY(int order, double[] x, double[] y, double[] sig, boolean centered)
          Creates and performs polynomial regression on weighted data set.
 
Method Summary
 double calculateFitValue(int index)
           
 double calculateY(double x)
           
 UncertainNumber calculateY(UncertainNumber x)
           
 double get_p_value()
           
 double[] getAdjustedCoeffErrors()
           
 Matrix getAdjustedCovarMatrix()
           
 double getChiSq()
           
 double[] getCoefficientErrors()
           
 Matrix getCovarianceMatrix()
           
 int getDegreesOfFreedom()
           
 double[] getFitCoefficients()
           
 double getMeanX()
           
 double getNormalizedResidual(int index)
           
 double getReducedChiSq()
           
 double getSlope(double x)
           
 PolynomialFitErrY invertFit(boolean centered)
          Inverts x and y data sets.
static void main(java.lang.String[] args)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

residual

public double[] residual
Constructor Detail

PolynomialFitErrY

public PolynomialFitErrY(int order,
                         double[] x,
                         double[] y,
                         double[] sig,
                         boolean centered)
                  throws StatisticsException
Creates and performs polynomial 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

PolynomialFitErrY

public PolynomialFitErrY(int order,
                         double[] x,
                         double[] y,
                         double[] sig)
                  throws StatisticsException

PolynomialFitErrY

public PolynomialFitErrY(java.io.File batch,
                         java.io.File out,
                         boolean centered)
                  throws StatisticsException
Method Detail

getMeanX

public double getMeanX()

getFitCoefficients

public double[] getFitCoefficients()

getCoefficientErrors

public double[] getCoefficientErrors()

getAdjustedCoeffErrors

public double[] getAdjustedCoeffErrors()

getChiSq

public double getChiSq()

getReducedChiSq

public double getReducedChiSq()

getDegreesOfFreedom

public int getDegreesOfFreedom()

get_p_value

public double get_p_value()

calculateY

public double calculateY(double x)

calculateY

public UncertainNumber calculateY(UncertainNumber x)
                           throws StatisticsException
StatisticsException

getSlope

public double getSlope(double x)

calculateFitValue

public double calculateFitValue(int index)

invertFit

public PolynomialFitErrY invertFit(boolean centered)
                            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).

StatisticsException

getCovarianceMatrix

public Matrix getCovarianceMatrix()

getAdjustedCovarMatrix

public Matrix getAdjustedCovarMatrix()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNormalizedResidual

public double getNormalizedResidual(int index)

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments