|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ij.measure.CurveFitter
public class CurveFitter
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: Midified 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 once). 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.
Field Summary | |
---|---|
static int |
EXPONENTIAL
|
static java.lang.String[] |
fitList
|
static java.lang.String[] |
fList
|
static int |
GAMMA_VARIATE
|
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 |
STRAIGHT_LINE
|
Constructor Summary | |
---|---|
CurveFitter(double[] xData,
double[] yData)
Construct a new CurveFitter. |
Method Summary | |
---|---|
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)
|
static double |
f(int fit,
double[] p,
double x)
Returns "fit" function value for parametres "p" at "x" |
double |
getFitGoodness()
Get a measure of "goodness of fit" where 1.0 is best. |
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 |
int |
getNumParams()
Get number of parameters for current fit function |
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()
SD = sqrt(sum of residuals squared / number of params+1) |
double |
getSumResidualsSqr()
|
void |
setMaxIterations(int x)
Set maximum number of iterations allowed |
void |
setRestarts(int x)
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 |
---|
public static final int STRAIGHT_LINE
public static final int POLY2
public static final int POLY3
public static final int POLY4
public static final int EXPONENTIAL
public static final int POWER
public static final int LOG
public static final int RODBARD
public static final int GAMMA_VARIATE
public static final int LOG2
public static final int IterFactor
public static final java.lang.String[] fitList
public static final java.lang.String[] fList
Constructor Detail |
---|
public CurveFitter(double[] xData, double[] yData)
Method Detail |
---|
public void doFit(int fitType)
public void doFit(int fitType, boolean showSettings)
public int getNumParams()
public static double f(int fit, double[] p, double x)
public double[] getParams()
public double[] getResiduals()
public double getSumResidualsSqr()
public double getSD()
public double getRSquared()
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.
public double getFitGoodness()
public java.lang.String getResultString()
public int getIterations()
public int getMaxIterations()
public void setMaxIterations(int x)
public int getRestarts()
public void setRestarts(int x)
public static int getMax(double[] array)
Double
- array.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |