Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.astro.louisville.edu/software/astroimagej/imagej/api/ij/measure/CurveFitter.html
Дата изменения: Thu Dec 2 23:03:10 2010
Дата индексирования: Mon Oct 1 22:25:12 2012
Кодировка:

Поисковые слова: hawaii
CurveFitter (ImageJ API)

ij.measure
Class CurveFitter

java.lang.Object
  extended by ij.measure.CurveFitter

public class CurveFitter
extends java.lang.Object

Curve fitting class based on the Simplex method described in the article "Fitting Curves to Data" in the May 1984 issue of Byte magazine, pages 340-362. 2001/02/14: Modified to handle a gamma variate curve. Uses altered Simplex method based on method in "Numerical Recipes in C". This method tends to converge closer in less iterations. Has the option to restart the simplex at the initial best solution in case it is "stuck" in a local minimum (by default, restarted twice). Also includes settings dialog option for user control over simplex parameters and functions to evaluate the goodness-of-fit. The results can be easily reported with the getResultString() method. Kieran Holland (holki659 at student.otago.ac.nz) 2008/01/21: Modified to do Gaussian fitting by Stefan Woerz (s.woerz at dkfz.de).


Field Summary
static int EXP_RECOVERY
           
static int EXP_WITH_OFFSET
           
static int EXPONENTIAL
           
static java.lang.String[] fitList
           
static java.lang.String[] fList
           
static int GAMMA_VARIATE
           
static int GAUSSIAN
           
static int IterFactor
           
static int LOG
           
static int LOG2
           
static int POLY2
           
static int POLY3
           
static int POLY4
           
static int POWER
           
static int RODBARD
           
static int RODBARD2
           
static int STRAIGHT_LINE
           
 
Constructor Summary
CurveFitter(double[] xData, double[] yData)
          Construct a new CurveFitter.
 
Method Summary
 int doCustomFit(java.lang.String equation, double[] initialValues, boolean showSettings)
           
 void doFit(int fitType)
          Perform curve fitting with the simplex method doFit(fitType) just does the fit doFit(fitType, true) pops up a dialog allowing control over simplex parameters alpha is reflection coefficient (-1) beta is contraction coefficient (0.5) gamma is expansion coefficient (2)
 void doFit(int fitType, boolean showSettings)
           
 double f(double[] p, double x)
          Returns formula value for parameters 'p' at 'x'
static double f(int fit, double[] p, double x)
          Returns 'fit' formula value for parameters "p" at "x"
 int getFit()
           
 double getFitGoodness()
          Get a measure of "goodness of fit" where 1.0 is best.
 java.lang.String getFormula()
           
 int getIterations()
          Get number of iterations performed
static int getMax(double[] array)
          Gets index of highest value in an array.
 int getMaxIterations()
          Get maximum number of iterations allowed
 java.lang.String getName()
           
 int getNumParams()
          Get number of parameters for current fit formula
 double[] getParams()
          Get the set of parameter values from the best corner of the simplex
 double[] getResiduals()
          Returns residuals array ie.
 int getRestarts()
          Get number of simplex restarts to do
 java.lang.String getResultString()
          Get a string description of the curve fitting results for easy output.
 double getRSquared()
          Returns R^2, where 1.0 is best.
 double getSD()
          Returns the standard deviation of the residuals.
 double getSumResidualsSqr()
           
 double[] getXPoints()
           
 double[] getYPoints()
           
 void setInitialParameters(double[] params)
          Sets the initial parameters, which override the default initial parameters.
 void setMaxIterations(int x)
          Set maximum number of iterations allowed
 void setRestarts(int n)
          Set number of simplex restarts to do
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRAIGHT_LINE

public static final int STRAIGHT_LINE
See Also:
Constant Field Values

POLY2

public static final int POLY2
See Also:
Constant Field Values

POLY3

public static final int POLY3
See Also:
Constant Field Values

POLY4

public static final int POLY4
See Also:
Constant Field Values

EXPONENTIAL

public static final int EXPONENTIAL
See Also:
Constant Field Values

POWER

public static final int POWER
See Also:
Constant Field Values

LOG

public static final int LOG
See Also:
Constant Field Values

RODBARD

public static final int RODBARD
See Also:
Constant Field Values

GAMMA_VARIATE

public static final int GAMMA_VARIATE
See Also:
Constant Field Values

LOG2

public static final int LOG2
See Also:
Constant Field Values

RODBARD2

public static final int RODBARD2
See Also:
Constant Field Values

EXP_WITH_OFFSET

public static final int EXP_WITH_OFFSET
See Also:
Constant Field Values

GAUSSIAN

public static final int GAUSSIAN
See Also:
Constant Field Values

EXP_RECOVERY

public static final int EXP_RECOVERY
See Also:
Constant Field Values

IterFactor

public static final int IterFactor
See Also:
Constant Field Values

fitList

public static final java.lang.String[] fitList

fList

public static final java.lang.String[] fList
Constructor Detail

CurveFitter

public CurveFitter(double[] xData,
                   double[] yData)
Construct a new CurveFitter.

Method Detail

doFit

public void doFit(int fitType)
Perform curve fitting with the simplex method doFit(fitType) just does the fit doFit(fitType, true) pops up a dialog allowing control over simplex parameters alpha is reflection coefficient (-1) beta is contraction coefficient (0.5) gamma is expansion coefficient (2)


doFit

public void doFit(int fitType,
                  boolean showSettings)

doCustomFit

public int doCustomFit(java.lang.String equation,
                       double[] initialValues,
                       boolean showSettings)

getNumParams

public int getNumParams()
Get number of parameters for current fit formula


f

public double f(double[] p,
                double x)
Returns formula value for parameters 'p' at 'x'


f

public static double f(int fit,
                       double[] p,
                       double x)
Returns 'fit' formula value for parameters "p" at "x"


getParams

public double[] getParams()
Get the set of parameter values from the best corner of the simplex


getResiduals

public double[] getResiduals()
Returns residuals array ie. differences between data and curve.


getSumResidualsSqr

public double getSumResidualsSqr()

getSD

public double getSD()
Returns the standard deviation of the residuals.


getRSquared

public double getRSquared()
Returns R^2, where 1.0 is best.
     r^2 = 1 - SSE/SSD

     where:      SSE = sum of the squares of the errors
                 SSD = sum of the squares of the deviations about the mean.
    


getFitGoodness

public double getFitGoodness()
Get a measure of "goodness of fit" where 1.0 is best.


getResultString

public java.lang.String getResultString()
Get a string description of the curve fitting results for easy output.


getIterations

public int getIterations()
Get number of iterations performed


getMaxIterations

public int getMaxIterations()
Get maximum number of iterations allowed


setMaxIterations

public void setMaxIterations(int x)
Set maximum number of iterations allowed


getRestarts

public int getRestarts()
Get number of simplex restarts to do


setRestarts

public void setRestarts(int n)
Set number of simplex restarts to do


setInitialParameters

public void setInitialParameters(double[] params)
Sets the initial parameters, which override the default initial parameters.


getMax

public static int getMax(double[] array)
Gets index of highest value in an array.

Parameters:
Double - array.
Returns:
Index of highest value.

getXPoints

public double[] getXPoints()

getYPoints

public double[] getYPoints()

getFit

public int getFit()

getName

public java.lang.String getName()

getFormula

public java.lang.String getFormula()