org.expasy.jpl.commons.base.math
Class StraightLineFitter

java.lang.Object
  extended by org.expasy.jpl.commons.base.math.StraightLineFitter

public final class StraightLineFitter
extends Object

Class to fit straight line to a set of 2D data points. The methods implemented in Press, Teukolsky, Vetterling, Flannery, Numerical Recipies, second edition are used.

Version:
1.0
Author:
mueller

Constructor Summary
StraightLineFitter(ArrayList<Double> xValues, ArrayList<Double> yValues)
          Constructor : y-variance is set to 1 for all data points
StraightLineFitter(ArrayList<Double> xValues, ArrayList<Double> yValues, ArrayList<Double> yVariance)
          Constructor
 
Method Summary
 double getFitOffset()
          Gets offset of fitted straight line
 double getFitSlope()
          Gets slope of fitted straight line
 ArrayList<Double> getFittedValues()
          Returns the values of the fitted straight line at xValues
 ArrayList<Double> getXValues()
          Get the x-values of the data points
 ArrayList<Double> getYValues()
          Get the y-values of the data points
 ArrayList<Double> getYVariance()
          Get y-variance of data points
 void setXYValues(ArrayList<Double> xValues, ArrayList<Double> yValues)
          Sets x-,y-values.
 void setXYValues(ArrayList<Double> xValues, ArrayList<Double> yValues, ArrayList<Double> yVariance)
          Sets x-,y- and variance values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StraightLineFitter

public StraightLineFitter(ArrayList<Double> xValues,
                          ArrayList<Double> yValues)
                   throws IllegalArgumentException
Constructor : y-variance is set to 1 for all data points

Parameters:
xValues - : x-values of the data points
yValues - : y-values of the data points
Throws:
IllegalArgumentException

StraightLineFitter

public StraightLineFitter(ArrayList<Double> xValues,
                          ArrayList<Double> yValues,
                          ArrayList<Double> yVariance)
                   throws IllegalArgumentException
Constructor

Parameters:
xValues - : x-values of the data points
yValues - : y-values of the data points
yVariance - : variance associated with y-values of data points
Throws:
IllegalArgumentException
Method Detail

setXYValues

public void setXYValues(ArrayList<Double> xValues,
                        ArrayList<Double> yValues)
                 throws IllegalArgumentException
Sets x-,y-values. y-variance is set to 1 for all data points

Parameters:
xValues - : x-values of the data points
yValues - : y-values of the data points
Throws:
IllegalArgumentException

setXYValues

public void setXYValues(ArrayList<Double> xValues,
                        ArrayList<Double> yValues,
                        ArrayList<Double> yVariance)
                 throws IllegalArgumentException
Sets x-,y- and variance values

Parameters:
xValues - : x-values of the data points
yValues - : y-values of the data points
yVariance - : variance associated with y-values of data points
Throws:
IllegalArgumentException

getXValues

public ArrayList<Double> getXValues()
Get the x-values of the data points

Returns:
x-values of the data points

getYValues

public ArrayList<Double> getYValues()
Get the y-values of the data points

Returns:
y-values of the data points

getYVariance

public ArrayList<Double> getYVariance()
Get y-variance of data points

Returns:
y-variance of data points

getFitOffset

public double getFitOffset()
Gets offset of fitted straight line

Returns:
offset

getFitSlope

public double getFitSlope()
Gets slope of fitted straight line

Returns:
slope

getFittedValues

public ArrayList<Double> getFittedValues()
Returns the values of the fitted straight line at xValues

Returns:
values of the fitted straight line at xValues


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.