Michael Thomas Flanagan's Java Scientific Library

Regression Class:     Linear and Non-linear Regression

     

Last update: 13 August 2016                                                                                                                             PERMISSION TO USE
Home Page of Michael Thomas Flanagan's Java Scientific Library.

This class contains the methods for performing the following regressions:
  • Fitting to a constant; yi = a0;
  • Linear regression with intercept; yi = a0 + a1.x0,i + a2.x1,i + . . . ;
  • General linear regression; yi = a0.f1(x0, x1 . .) + a1.f2(x0, x1 . .) + . . . ;
  • Polynomial fitting; yi = a0 + a1.xi + a2.xi2 + a3.xi3. . .;
                               yi = a0 + a1.xian+1 + a2.xian+2 + . . . + an.xia2n+1 [non-linear]
  • Non linear regression; Nelder and Mead Simplex.
    [Unconstrained and constrained]
    • y = f1(a0,a1,a2..., x0,x1,x2...)
    • y0 = f1(a0,a1,a2..., x0,x1,x2...)
      y1 = f2(a0,a1,a2..., x0,x1,x2...)
      . . .
      yn = fn(a0,a1,a2..., x0,x1,x2...)
The regressions may be performed on sets of x - y data or on a single set of data which is first binned into an histogram.

Weighted regression using both dependent and independent variable errors
The above listed regressions may all be performed as unweighted regressions or as classically weighted regressions, i.e. regressions in which the weighting factors are equated to the measurement errors in the dependent variable (y) and the dependent variables (x) are assumed to be error free. The following regressions may also be performed as weighted regressions in which the weighting factors are derived from the measurement errors in both the dependent and independent variables:
Coding a user supplied function
The sum of squares function required by the non-linear regression procedure is supplied via one of the following interfaces: Covariance matrix options
The covariance matrix used in the statistical analysis of the best estimates may, in the case of non-linear regression, be calculated either numerically or analytically. If the latter option is chosen the first and second derivatives of the fitted function for pairs of parameters are supplied via an interface, RegressionDerivativeFunction or RegressionDerivativeFunction2 (more than one dependent variable).

Deprecated and renamed methods
Method names are occasionly changed to maintain naming consistency and some methods are occasionally deprecated. The older named methods are always retained in the flanagan.jar file but may not be listed on this page.

Warning before attempting a non-linear regression: Click here.

Fitting to statistical distributions and unbinned data: the ProbabilityPlot class may be as or more useful in fitting data to statistical distributions if the data is unbinned.

Outlier removal methods may be found in the Outliers Class.

import statement/s:
For all regressions
     import flanagan.analysis.Regression;
In addition for relevant non-linear regressions
     import flanagan.analysis.RegressionFunction;
     import flanagan.analysis.RegressionFunction2;
     import flanagan.analysis.RegressionFunction3;
Related classes

SUMMARY OF CONSTRUCTORS AND METHODS

Constructors   public Regression(double[ ][ ] xdata, double[ ] ydata, double[ ] yErrors)
public Regression(double[ ][ ] xdata, double[ ] ydata, double[ ][] xerrors, double[ ] yerrors)
public Regression(double[ ][ ] xdata, double[ ][] ydata, double[ ][ ] yerrors)
public Regression(double[ ][ ] xdata, double[ ][] ydata, double[ ][ ] xerrors, double[ ][ ] yerrors)
public Regression(double[ ] xdata, double[ ] ydata, double[ ] yErrors)
public Regression(double[ ] xdata, double[ ] ydata, double[ ] xerrors, double[ ] yerrors)
public Regression(double[ ] xdata, double[ ][] ydata, double[ ][ ] yerrors)
public Regression(double[ ] xdata, double[ ][] ydata, double[ ] xerrors, double[ ][ ] yerrors)
public Regression(double[ ][ ] xdata, double[ ] ydata)
public Regression(double[ ][ ] xdata, double[ ][] ydata)
public Regression(double[ ] xdata, double[ ] ydata)
public Regression(double[ ] xdata, double[ ][] ydata)
public Regression(double[ ] xdata, double binWidth, double binZero)
public Regression(double[ ] xdata, double binWidth)
Linear
Regression
Fitting to a constant
yi = a0
public void constant()
public void constantPlot()
public void constantPlot(String xLegend, String yLegend)
Linear with intercept
yi = a0+a1.x0,i+a2.x1,i+...
public void linear()
public void linear(double fixedIntercept)
public void linearPlot()
public void linearPlot(double fixedIntercept)
public void linearPlot(String xLegend, String yLegend)
public void linearPlot(double fixedIntercept, String xLegend, String yLegend)
General linear
yi = a0.f1(x0,x1..)+a1.f2(x0,x1+...)
public void linearGeneral()
public void linearGeneralPlot()
public void linearGeneralPlot(String xLegend, String yLegend)
Polynomial
yi = a0+a1.x+a2.x2+a3x3 ...
public void polynomial(int n)
public void polynomial(int n, double fixedIntercept)
public void polynomialPlot(int n)
public void polynomialPlot(int n, double fixedIntercept)
public void polynomialPlot(int n, String xLegend, String yLegend)
public void polynomialPlot(int n, double fixedIntercept, String xLegend, String yLegend)
public ArrayList<Object> bestPolynomial()
public ArrayList<Object> bestPolynomial(double fixedIntercept)
public ArrayList<Object> bestPolynomialPlot()
public ArrayList<Object> bestPolynomialPlot(double fixedIntercept)
public ArrayList<Object> bestPolynomialPlot(String xLegend, String yLegend)
public ArrayList<Object> bestPolynomialPlot(double fixedIntercept, String xLegend, String yLegend)
public void setFtestSignificance(double signif)
public double getFtestSignificance()
public void nonIntegerPolynomial(int nTerms)             [non-linear regression]
public void nonIntegerPolynomialPlot(int nTerms)       [non-linear regression]
public void nonIntegerPolynomialPlot(int nTerms, String xLegend, String yLegend)
Return the best estimates public double[] getBestEstimates()
Return the errors of the best estimates public double[] getBestEstimatesErrors()
See Common methods for list of methods associated with performing a linear regression, e.g. returning a statistical analysis of a linear regression, plotting the best fit curve.
Non-linear
Regression


WARNING
Nelder and Mead Simplex
One set of dependent variables
y = f(a0,a1,a2..., x0,x1,x2...)

Several sets of the dependent variable
y0 = f1(a0,a1,a2..., x0,x1,x2...)
y1 = f2(a0,a1,a2..., x0,x1,x2...)
. . .
yn = fn(a0,a1,a2..., x0,x1,x2...)
public void simplex(RegressionFunction rf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)

public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)

public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)

public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)

public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)
public void simplex(RegressionFunction rf, double[ ] start, double[ ] step, double ftol)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)

public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)

public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step, double ftol)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)

public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)

public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
public void simplex(RegressionFunction rf, double[ ] start, double[ ] step, int nmax)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, int nmax)

public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step, int nmax)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, int nmax)

public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, int nmax)
public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step, int nmax)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, int nmax)

public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step, int nmax)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, int nmax)

public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, int nmax)
public void simplex(RegressionFunction rf, double[ ] start, double ftol, int nmax)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)

public void simplex(RegressionFunction2 rf, double[ ] start, double ftol, int nmax)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)

public void simplex(RegressionFunction3 rf, double[ ] start, double ftol, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)

public void simplexPlot(RegressionFunction rf, double[ ] start, double ftol, int nmax)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)

public void simplexPlot(RegressionFunction2 rf, double[ ] start, double ftol, int nmax)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)

public void simplexPlot(RegressionFunction3 rf, double[ ] start, double ftol, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)
public void simplex(RegressionFunction rf, double[ ] start, double[ ] step)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)

public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)

public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)
public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)

public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)

public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)

public void simplex(RegressionFunction rf, double[ ] start, double ftol)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)

public void simplex(RegressionFunction2 rf, double[ ] start, double ftol)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)

public void simplex(RegressionFunction3 rf, double[ ] start, double ftol)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)
public void simplexPlot(RegressionFunction rf, double[ ] start, double ftol)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)

public void simplexPlot(RegressionFunction2 rf, double[ ] start, double ftol)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)

public void simplexPlot(RegressionFunction3 rf, double[ ] start, double ftol)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)
public void simplex(RegressionFunction rf, double[ ] start, int nmax)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)

public void simplex(RegressionFunction2 rf, double[ ] start, int nmax)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)

public void simplex(RegressionFunction3 rf, double[ ] start, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)

public void simplexPlot(RegressionFunction rf, double[ ] start, int nmax)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)

public void simplexPlot(RegressionFunction2 rf, double[ ] start, int nmax)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)

public void simplexPlot(RegressionFunction3 rf, double[ ] start, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)

public void simplex(RegressionFunction rf, double[ ] start)
public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start)

public void simplex(RegressionFunction2 rf, double[ ] start)
public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start)

public void simplex(RegressionFunction3 rf, double[ ] start)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start)
public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start)
public void simplexPlot(RegressionFunction rf, double[ ] start)
public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start)

public void simplexPlot(RegressionFunction2 rf, double[ ] start)
public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start)

public void simplexPlot(RegressionFunction3 rf, double[ ] start)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start)
public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start)
Deprecated simplex methods simplex2 and simplexPlot2
Constrained non-linear regression public void addConstraint(int pIndex, int direction, double boundary)
public void addConstraint(int pIndices, double plusOrMinus, int direction, double boundary)
public void addConstraint(int pIndices, int plusOrMinus, int direction, double boundary)
public void removeConstraints()
public void setPenaltyWeight(double pWeight)
public double getPenaltyWeight()
public void setConstraintTolerance(double tolerance)
Scaling the initial estimates public void setScale(int opt)
public void setScale(double[] opt)
public double[ ] getScale()
Returning the best estimates public double[] getBestEstimates()
Returning the errors of the best estimates public double[] getBestEstimatesErrors()
Returning the initial estimates public double[ ] getInitialEstimates()
public void[ ] getScaledInitialEstimates()
Returning the initial step sizes public double[ ] getInitialSteps()
public void[ ] getScaledInitialSteps()
Convergence tests public void setMinTest(int opt)
public int getMinTest()
public void setTolerance(double tol)
public int getTolerance()
public double getSimplexSd()
Restarts public void setNrestartsMax(int nrm)
public int getNrestartsMax()
public int getNrestarts()
Number of iterations public void setNmax(int nMax)
public int getNmax()
public void setNmin(int nMin)
public int getNmin()
public int getNiter()
Pseudo-linear statistics public void setDelta(double delta)
public int getDelta()
public boolean getInversionCheck()
public boolean getPosVarCheck()
Gradients about the minimum public double[][] getGrad()
Nelder and Mead Simplex Coefficients public void setNMreflect(double reflectC)
public double getNMreflect()
public void setNMextend(double extendC)
public double getNMextend()
public void setNMcontract(double contractC)
public double getNMcontract()
See Common methods for list of methods associated with performing a non-linear regression, e.g. returning a statistical analysis of a non-linear regression, plotting the best fit curve.
Fitting data to special Functions Scaling of the ordinate values public void setYscaleFactor(double scaleFactor)
public void setYscaleOption(boolean test)
public boolean getYscaleOption()
Fit to a Gaussian distribution
(parameter fixing option available)
or to Gaussian distributions

[normal distribution]
public void gaussian()
public void gaussian(double[] parameterValues, boolean[] fixedOptions)
public void gaussianPlot()
public void gaussianPlot(double[] parameterValues, boolean[] fixedOptions)
public void multipleGaussiansPlot(int nGaussians, double[] guessesOfMeans, double[] guessesOfStandardDeviations, double[] guessesOfFractionalContributions)
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Gaussian Probabilty Plot
Fit to a Log-normal distribution
(two parameter statistic)
public void logNormal()
public void logNormalTwoPar()
public void logNormalPlot()
public void logNormalTwoParPlot()
public static void fitOneOrSeveralDistributions(double[] array)
Fit to a Log-normal distribution
(three parameter statistic)
public void logNormalThreePar()
public void logNormalThreeParPlot()
public static void fitOneOrSeveralDistributions(double[] array)
Fit to a Logistic distribution public void logistic()
public void logisticPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Logistic Probabilty Plot
Fit to a Beta distribution public void beta()
public void betaPlot()
public void betaMinMax()
public void betaMinMaxPlot()
public static void fitOneOrSeveralDistributions(double[] array)
Fit to a Gamma distribution public void gamma()
public void gammPlot()
public void gammaStandard()
public void gammaStandardPlot()
public static void fitOneOrSeveralDistributions(double[] array)
Fit to an Erlang distribution public void erlang()
public void erlangPlot()
public static void fitOneOrSeveralDistributions(double[] array)
Fit to a Poisson distribution public void poisson()
public void poissonPlot()
Fit to a Lorentzian distribution public void lorentz()
public void lorentzPlot()
public static void fitOneOrSeveralDistributions(double[] array)
Fit to a Type 1 Extreme Value Distribution
(minimum order statistic)
Gumbel Distribution (minimum order statistic)
public void gumbelMin()
public void gumbelMinPlot()
public void gumbelMinOnePar()
public void gumbelMinOneParPlot()
public void gumbelMinStandard()
public void gumbelMinStandardPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Gumbel (minimum order statistic) Probabilty Plot
Fit to a Type 1 Extreme Value Distribution
(maximum order statistic)
Gumbel Distribution (maximum order statistic)
public void gumbelMax()
public void gumbelMaxPlot()
public void gumbelMaxOnePar()
public void gumbelMaxOneParPlot()
public void gumbelMaxStandard()
public void gumbelMaxStandardPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Gumbel (maxiimum order statistic) Probabilty Plot
Fit to a Type 2 Extreme Value Distribution
Fréchet distribution
public void frechet()
public void frechetPlot()
public void frechetTwoPar()
public void frechetTwoParPlot()
public void frechetStandard()
public void frechetStandardPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Fréchet Probabilty Plot
Fit to a Type 3 Extreme Value Distribution
Weibull distribution
public void weibull()
public void weibullPlot()
public void weibullTwoPar()
public void weibullTwoParPlot()
public void weibullStandard()
public void weibullStandardPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Weibull Probabilty Plot
Fit to a Type 3 Extreme Value Distribution (see also fitting simple exponentials)
Exponential Distribution
public void exponential()
public void exponentialPlot()
public void exponentialOnePar()
public void exponentialOneParPlot()
public void exponentialStandard()
public void exponentialStandardPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Exponential Probabilty Plot
Fit to a Type 3 Extreme Value Distribution
Rayleigh Distribution
public void rayleigh()
public void rayleighPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Rayleigh Probabilty Plot
Pareto Distribution public void paretoShifted()
public void paretoShiftedPlot()
public void paretoTwoPar()
public void paretoTwoParPlot()
public void paretoOnePar()
public void paretoOneParPlot()
public static void fitOneOrSeveralDistributions(double[] array)
See also the ProbabiltyPlot class methods under Pareto Probabilty Plot
Fit to one or several of the above distributions public static void fitOneOrSeveralDistributions(double[] array)
Fitting Simple Exponentials (See also fit to an Exponential Distribution)
yi = a.exp(b.xi)
yi = Σaj.exp(bj.xi)
yi = a.(1 - exp(b.xi))
public void exponentialSimple()
public void exponentialSimplePlot()
public void exponentialMultiple(int nExp)
public void exponential|MultiplePlot(int nExp)
public void exponentialMultiple(int nExp, double[] initialEstimates)
public void exponential|MultiplePlot(int nExp, double[] initialEstimates)
public void oneMinusExponential()
public void oneMinusExponentialPlot()
Fit to a Sigmoid Function
Sigmoidal Threshold Function
public void sigmoidThreshold()
public void sigmoidThesholdPlot()
Fit to a Sigmoid Function
Hill/Sips Sigmoid
public void sigmoidHillSips()
public void sigmoidHillSipsPlot()
Fit to a Sigmoid Function
Five parameter logistic curve
[5PL]
public void fiveParameterLogistic()
public void fiveParameterLogisticPlot()
public void fiveParameterLogistic(double bottom, double top)
public void fiveParameterLogisticPlot(double bottom, double top)
Fit to a Sigmoid Function
Four parameter logistic curve
[4PL, EC50 dose response curve]
public void fourParameterLogistic()
public void ec50()
public void fourParameterLogisticConstrained()
public void ec50constrained()
public void fourParameterLogisticPlot()
public void ec50Plot()
public void fourParameterLogisticConstrainedPlot()
public void ec50constrainedPlot()
public void fourParameterLogistic(double bottom, double top)
public void ec50(double bottom, double top)
public void fourParameterLogisticPlot(double bottom, double top)
public void ec50Plot(double bottom, double top)
Fit to a Rectangular Hyperbola public void rectangularHyperbola()
public void rectangularHyperbolaPlot()
public void shiftedRectangularHyperbola()
public void shiftedRectangularHyperbolaPlot()
Fit to a Scaled Heaviside
Step Function
public void stepFunction()
public void stepFunctionPlot()
Common instance methods

(see below for common
static methods)
Input data option public void setErrorsAsScaled();
public void setErrorsAsSD();
public void setTrueFreq(boolean trueOrfalse)
public boolean getTrueFreq()
Add a title to graphs
and output files
public void setTitle(String title)
Print the regression results public void print( String filename, int prec)
public void print( String filename)
public void print(int prec)
public void print()
Suppress the printing of
the regression results
public void suppressPrint()
Plot the regression results
x against y
public int plotXY( String graphName)
public int plotXY()
public int plotXY(RegressionFunction rf, String graphName)
public int plotXY(RegressionFunction2 rf, String graphName)
public int plotXY(RegressionFunction3 rf, String graphName)
public int plotXY(RegressionFunction rf)
public int plotXY(RegressionFunction2 rf)
public int plotXY(RegressionFunction3 rf)
Plot the regression results
y(exp) against y(calc)
public int plotYY(String filename)
public int plotYY()
Suppress the plot of the regression
results y(exp) against y(calc)
public void suppressYYplot()
Add axis legends to the x - y plot public void setXlegend(String xLegend)
public void setYlegend(String yLegend)
Return the best estimates public double[] getBestEstimates()
Return the errors of the best estimates public double[] getBestEstimatesErrors()
Return the coefficients of variation public double[] getCoeffVar()
Return the t-values of the best estimates public double[] getTvalues()
Return the P-values of the best estimates public double[] getPvalues()
Return the calculated y values public double[] getYcalc()
Return the weights public double[] getWeights()
Return the unweighted residuals public double[] getResiduals()
Return the weighted residuals public double[] getWeightedResiduals()
Return the unweighted sum of residual squares public double getSumOfSquares()
public double getSumOfUnweightedResidualSquares()
Return the weighted sum of residual squares public double getChiSquare()
public double getSumOfWeightedResidualSquares()
Return the reduced chi square public double getReducedChiSquare()
Return the total sum of weighted squares public double getTotalSumOfWeightedSquares()
Return the regression sum of weighted squares public double getRegressionSumOfWeightedSquares()
Return the linear correlation coefficient public double getXYcorrCoeff()
public double getYYcorrCoeff()
Return the coefficient of determination public double getCoefficientOfDetermination()
Return the adjusted coefficient of determination public double getAdustedCoefficientOfDetermination()
Return the coefficient of determination F-ratio public double getCoeffDeterminationFratio()
Return the coefficient of determination F-ratio probability public double getCoeffDeterminationFratioProb()
Return the degrees of freedom public int getDegFree()
Covariance Matrix public double[ ][ ] getCovMatrix()
Parameter correlation coefficients public doublet[ ][ ] getCorrCoeffMatrix()
Return the Durbin-Watson d Statistic public double getDurbinWatsonD()
Check normality of residuals public void checkResidualNormality()
public void checkWeightedResidualNormality()
Common static methods Test of additional terms
(Extra sum of squares)
public static ArrayList<Object> testOfAdditionalTerms(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints, double significanceLevel)
public static ArrayList<Object> testOfAdditionalTerms(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)
public static ArrayList<Object> testOfAdditionalTerms_ArrayList(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints, double significanceLevel)
public static ArrayList<Object> testOfAdditionalTerms_ArrayList(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)
public static double testOfAdditionalTermsFratio(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)
public static double testOfAdditionalTermsFprobability(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)
Resetting the denominator in statistical formulae
public static void setDenominatorToN()
public static void setDenominatorToNminusOne()
Reset Stat class continued fraction evaluation parameters
This evaluation is called by the Regression statistical analysis
public static void resetCFmaxIter(int maxit)
public static int getCFmaxIter()
public static void resetCFtolerance(double tolerance)
public static double getCFtolerance()



CONSTRUCTORS

The Example Programs give several examples of non-linear regression using different constructors.

Errors in both the dependent and indpendent variables
public Regression(double[ ][ ] xdata, double[ ] ydata, double[ ][ ] xerrors, double[ ] yerrors)
public Regression(double[ ][ ] xdata, double[ ][ ] ydata, double[ ][ ] xerrors, double[ ][ ] yerrors)
public Regression(double[ ] xdata, double[ ] ydata, double[ ] xerrors, double[ ] yerrors)
public Regression(double[ ] xdata, double[ ][ ] ydata, double[ ] xerrors, double[ ][ ] yerrors)
public Regression(double[ ][ ] xdata, double[ ] ydata, double[ ] yerrors)
Usage:                      Regression reg = new Regression(xdata, ydata, xerors, yerrors)
Creates a new instance of Regression that allows the appropriate regression procedures, described below, to be performed on the data set, xdata, ydata, xerrors, yerrors, where:
ydata are the dependent variables; y may be a single or double dimension array, i.e. more than one set of dependent variable.
xdata are the independent variables; xdata may be: xerrors and yerrors are the measurement errors in the independent variables (x) and in the dependent variable (y) respectively. In this usage these errors are combined to provide the weighting factors, wi [weight], as

i.e. assuming the errors are uncorrelated. xerrors and yerrors should contain the standard deviations or estimates of the standard deviations of the corresponding measurements in ydata and ydata respectively. If they are not entered as such, i.e. if the are entered as internally consisted weights that are not equal to estimates of the standard deviations, the method setErrorsAsScaled() must also be called.
As weights are provided in this usage chi square

is minimised, where the calculated y[] are obtained from the appropriate above equation.
If more than 40% of the elements of the array, yerror, are zero or negative all elements of the array are equated to unity, i.e. an unweighted regression is performed, i.e. ss,

is minimised, otherwise all zero or negative elements are replaced by the average of their nearest positive neighbours.

If the data is to be plotted after the regression has been performed the values in the entered data must be ordered as they will appear on the graph. See ArrayMaths() for methods of sorting one array into ascending order with the ordering of an accompanying array into the same order.
The number of methods that will handle errors in both coordinates is limited - see above. See below for constructors appropriate for unweighted or dependent variable only weighted data.

Errors only in the dependent variable
public Regression(double[ ][ ] xdata, double[ ][ ] ydata, double[ ][ ] yerrors)
public Regression(double[ ] xdata, double[ ] ydata, double[ ] yerrors)
public Regression(double[ ] xdata, double[ ][ ] ydata, double[ ][ ] yerrors)
Usage:                      Regression reg = new Regression(xdata, ydata, xerors, yerrors)
Creates a new instance of Regression that allows the appropriate regression procedures, described below, to be performed on the data set, xdata, ydata, yerrors, where:
ydata are the dependent variables; y may be a single or double dimension array, i.e. more than one set of dependent variable.
xdata are the independent variables; xdata may be: yerrors are the measurement errors in the dependent variable, y, and in this usage are used as the weighting factors, weight. These should be the standard deviations or estimates of the standard deviations of the corresponding measurements in ydata. If they are not entered as such, i.e. if the are entered as internally consisted weights that are not equal to estimates of the standard deviations, the method setErrorsAsScaled() must also be called.

As weights are provided in this usage chi square

is minimised, where the calculated y[] are obtained from the appropriate above equation.
If more than 40% of the elements of the array, yerror, are zero or negative all elements of the array are equated to unity, i.e. an unweighted regression is performed, i.e. ss,

is minimised, otherwise all zero or negative elements are replaced by the average of their nearest positive neighbours.

If the data is to be plotted after the regression has been performed the values in the entered data must be ordered as they will appear on the graph. See ArrayMaths() for methods of sorting one array into ascending order with the ordering of an accompanying array into the same order.
All the regression methods will handle data in which only dependent variable errors are used.

Unweighted regressions
public Regression(double[ ][ ] xdata, double[ ] ydata)
public Regression(double[ ][ ] xdata, double[ ][ ] ydata)
public Regression(double[ ] xdata, double[ ] ydata)
public Regression(double[ ] xdata, double[ ][ ] ydata)
Usage:                      Regression reg = new Regression(xdata, ydata)
Creates a new instance of Regression that allows the appropriate regression procedures, described below, to be performed on the data set, xdata, ydata, where:
ydata are the dependent variables; y may only be a single or double dimension array, i.e. more than one set of dependent variable.
xdata are the independent variables; xdata may be a one-dimensional array or a multidimensional array (multiple rgeression) [as above].
As the weighting factor array weight is not provided in these constructors, all weighting factors are all equated to unity, i.e. an unweighted regression is performed.
All the regression methods will handle unweighted data.

Binned data
public Regression(double[ ] xdata, double binWidth, double binWidth)
public Regression(double[ ] xdata, double binWidth)
Usage:                      Regression reg = new Regression(xdata, binWidth, binZero)
Creates a new instance of Regression that first bins the data in the array, xdata in the above usage, into a set of frequency bins of width, binWidth in the above usage, with the first bin starting at binZero in the above usage. It then allows the appropriate regression procedures, described below, to be performed on the binned data set. Treats the data as unscaled true frequencies, see Data Type below.

Usage:                      Regression reg = new Regression(xdata, binWidth)
Creates a new instance of Regression that first bins the data in the array, xdata in the above usage, into a set of frequency bins of width, binWidth, in the above usage. The start of the bins in calculated, within this method, to encompass all the data. It then allows the appropriate regression procedures, described below, to be performed on the binned data set. Treats the data as unscaled true frequencies, see Data Type below.

METHODS

LINEAR REGRESSION
Fitting to a constant
public void constant()
public void constantPlot()
public void constantPlot(String xLegend, String yLegend)
Usage:                      reg.constant();
Fits the data supplied, via the constructor, to the instance reg in the above usage, to the linear equation
yi = a0
See below, or summary table above, for methods to obtain Usage:                      reg.constantPlot();
Performs all that is described above under reg.constant() and in addition Usage:                      reg.constantPlot(xLegend, yLegend);
Performs all that is described above under reg.constantPlot() and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

Linear with intercept: intercept to be found by regression
See below for regression with a fixed intercept
public void linear()
public void linearPlot()
public void linearPlot(String xLegend, String yLegend)
Usage:                      reg.linear();
Fits the data supplied, via the constructor, to the instance reg in the above usage, to the linear equation
yi = a0 + a1.x0,i + a2.x1,i + ...
See below, or summary table above, for methods to obtain Usage:                      reg.linearPlot();
Performs all that is described above under reg.linear() and in addition Usage:                      reg.linearPlot(xLegend, yLegend);
Performs all that is described above under reg.linearPlot() and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

Linear with a fixed intercept
See above for regression with intercept found by the regression.
public void linear(double fixedIntercept)
public void linearPlot(double fixedIntercept)
public void linearPlot(double fixedIntercept, String xLegend, String yLegend)
Usage:                      reg.linear(fixedIntercept);
Fits the data supplied, via the constructor, to the instance reg in the above usage, to the linear equation
yi = a0 + a1.x0,i + a2.x1,i + ...
with the value of the intercept, a0, fixed at the value supplied as the argument, fixedIntercept.
The best estimates of a1, a2 ... etc are returned by methods returning the best estimate array, i.e. a0 is not returned in the best estimates array as its value has been fixed.
  • best estimates of the coefficients
  • estimates of their standard deviations
  • estimate of the covariance matrix
  • t-values
  • p-values
  • correlation coefficients
  • calculated y values
  • residuals
  • sum of squares of residuals
  • chi square (if weigths or true frequencies provided)
  • Usage:                      reg.linearPlot(fixedIntercept);
    Performs all that is described above under reg.linear(fixedIntercept) and in addition Usage:                      reg.linearPlot(fixedIntercept, xLegend, yLegend);
    Performs all that is described above under reg.linearPlot(fixedIntercept) and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

    General Linear Regression
    public void linearGeneral()
    public void linearGeneralPlot()
    public void linearGeneralPlot(String xLegend, String yLegend)
    Usage:                      reg.linearGeneral();
    Fits the data supplied, via the constructor, to the instance reg in the above usage, to the linear equation
    yi = a linear function of the the coefficients, a0, a1, a2 etc. and the independent variables, x0,i, x1,i, x2,i etc
      e.g. yi = a0.x0,i + a1.x1,i + ...
    See below, or summary table above, for methods to obtain
    Usage:                      reg.linearGeneralPlot();
    Performs all that is described above under reg.linearGeneral() and in addition Usage:                      reg.linearGeneralPlot(xLegend, yLegend);
    Performs all that is described above under reg.linearGeneralPlot() and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

    Fitting to a polynomial of known degree: intercept found by regression
    See fixed intercept fitting (below) for polynomial fitting with a fixed intercept.
    Also see best polynomial (below) for finding the polynomial and its degree that gives the best fit.

    public void polynomial(int deg)
    public void polynomialPlot(int deg)
    public void polynomialPlot(int deg, String xLegend, String yLegend)

    Usage:                      reg.polynomial(deg);
    Fits the data supplied, via the constructor taking a one dimensional array of the independent variable values, to the instance reg in the above usage, to a polynomial of degree, n, transferred as the method argument (deg in the above usage)

    See below, or summary table above, for methods to obtain
    Usage:                      reg.polynomialPlot(deg);
    Performs all that is described above under reg.polynomial(deg) and in addition Usage:                      reg.polynomialPlot(deg, xLegend, yLegend);
    Performs all that is described above under reg.polynomialPlot(deg) and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

    Fitting to a polynomial of known degree with a fixed intercept
    See above for polynomial fitting with the intercept included in the regression.
    Also see best polynomial [fixed intercept] (below) for finding the polynomial, with a fixed intercept, and its degree that gives the best fit.

    public void polynomial(int n, double fixedIntercept)
    public void polynomialPlot(int n, double fixedIntercept)
    public void polynomialPlot(int n, double fixedIntercept, String xLegend, String yLegend)
    Usage:                      reg.polynomial(deg, fixedIntercept);
    Fits the data supplied, via the constructor taking a one dimensional array of the independent variable values, to the instance reg in the above usage, to a polynomial of degree, n, transferred as the method argument (deg in the above usage)

    with the value of the intercept, a0, fixed at the value supplied as the argument, fixedIntercept.
    The best estimates of a1 to an are returned by methods returning the best estimate array, i.e. a0 is not returned in the best estimates array as its value has been fixed.
    See below, or summary table above, for methods to obtain
    Usage:                      reg.polynomialPlot(deg, fixedIntercept);
    Performs all that is described above under reg.polynomial(deg, fixedIntercept) and in addition Usage:                      reg.polynomialPlot(deg, fixedIntercept, xLegend, yLegend);
    Performs all that is described above under reg.polynomialPlot(deg, fixedIntercept) and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

    Fitting to a polynomial of unknown degree and unknown intercept
    See best polynomial [fixed intercept] (below) for finding the polynomial, with a fixed intercept, and its degree that gives the best fit.

    public ArrayList<Object> bestPolynomial()
    public ArrayList<Object> bestPolynomialPlot()
    public ArrayList<Object> bestPolynomialPlot(String xLegend, String yLegend)

    Usage:                      arrayl = reg.bestPolynomial();
    Fits the data supplied, via the constructor taking a one dimensional array of the independent variable values, to the instance reg in the above usage, to polynomials of increasing degree starting at zero degree, i.e. a constant. The polynomial that provides the best fit is determined by an additional term F-test (See below for details of this test). A significance probability level of 0.05 is used in this test but this level may be changed (see setFtestSignificance). A full analysis is then performed on the best fit polynomial as described under fitPolynomial(n) above.
    The returned ArrayList, arrayl, contains:
    Usage:                      arrayl = reg.bestPolynomialPlot();
    Performs all that is described above under reg.bestPolynomial() and in addition Usage:                      reg.bestPolynomialPlot(xLegend, yLegend);
    Performs all that is described above under reg.bestPolynomialPlot() and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

    Fitting to a polynomial of unknown degree and fixed intercept
    See best polynomial (above) for finding the polynomial, with a unknown intercept, and its degree that gives the best fit.

    public ArrayList<Object> bestPolynomial(double fixedIntercept)
    public ArrayList<Object> bestPolynomialPlot(double fixedIntercept)
    public ArrayList<Object> bestPolynomialPlot(double fixedIntercept, String xLegend, String yLegend)

    Usage:                      arrayl = reg.bestPolynomial(fixedIntercept);
    Fits the data supplied, via the constructor taking a one dimensional array of the independent variable values, to the instance reg in the above usage, to polynomials, with a fixed intercept (fixedIntercept) of increasing degree starting at a degree of one. The polynomial that provides the best fit is determined by an additional term F-test (See below for details of this test). A significance probability level of 0.05 is used in this test but this level may be changed (see setFtestSignificance). A full analysis is then performed on the best fit polynomial as described under fitPolynomial(n) above.
    The returned ArrayList, arrayl, contains:
    Usage:                      arrayl = reg.bestPolynomialPlot(fixedIntercept);
    Performs all that is described above under reg.bestPolynomial(fixedIntercept) and in addition Usage:                      reg.bestPolynomialPlot(fixedIntercept, xLegend, yLegend);
    Performs all that is described above under reg.bestPolynomialPlot(fixedIntercept) and in addition adds the x-axis (abscissa) legend, xLegend, and the y-axis (ordinate) legend, yLegend, to the plot.

    Resetting the F-test significance level
    public void setFtestSignificance(double signif)
    public double getFtestSignificance()
    Usage:                      reg.setFtestSignificance(signif);
    Resets the F-test significance level, as described in the method above (bestPolynomial), to the value passed as the argument, signif. The default value is 0.05.

    Usage:                      signif = reg.getFtestSignificance();
    Returns the F-test significance level described in the method above (bestPolynomial). The default value is 0.05.

    Fitting to a non-integer polynomial
    See also ImmunoAssay.
    public void nonIntegerPolynomial(int nTerms)
    public void nonIntegerPolynomialPlot(int nTerms)
    public void nonIntegerPolynomialPlot(int nTerms, String xLegend, String yLegend)
    Usage:                      reg.nonIntegerPolynomial(nTerms);
    This method fits the data supplied, via the constructor taking a one dimensional array of the independent variable values, to the instance reg in the above usage, to a non-integer polynomial
           
    where the number of terms, argument nTerms, equals n+1. The best estimates of all the ai may all take non-integer values and are determined by non-linear regression as described below.

    Usage:                      reg.nonIntegerPolynomialPlot(nTerms);
    Performs all that is described above under reg.nonIntegerPolynomial(nTerms)
    and in addition Usage:                      reg.nonIntegerPolynomialPlot(nTerms, xLegend, yLegend);
    Performs all that is described above under reg.nonIntegerPolynomialPlot(). The legends on the plot will be those passed as this method's arguments.



    NON-LINEAR REGRESSION
    WARNING:
    If you do not have an understanding of the basis of non-linear regression you are strongly advised to read a good text-book on non-linear regression before using the non-linear regression methods of this library.
    Non-linear rgression procedures may often exit having found a local or a false minimum in the sum of squares of residuals surface rather than at the global minimum hence giving false best estimates. You should always check a plot of the experimental data and the calculated best fit curve.
    It is a common practice to repeat non-linear regressions using a new set of initial estimates calculated as
         new initial estimate = (two times the original initial estimate) minus the best estimate value
    i.e. equidistant to the initial estimate/best estimate distance but on the opposite side of the initial estimate.
    The statistical output should also be checked but should also be treated with great caution. The statistical parameters, e.g. best estimate error, are calculated using the approach that is strictly only valid for linear models, i.e. in linear regression. The assumption that must be satisfied for these statistics to be anyway meaningful in non-linear regression is that the sum of squares of residuals surface is a quadratic surface in the region of the minimum. This approximation is often valid but far from always.

    Nelder and Mead Simplex Method
    This method implements the Nelder and Mead heuristic simplex optimization procedure to minimise either chi square
    (if weights provided)
    or the summ of squares
    (if no weights provided)
    for the data supplied, via the constructor, to the instance of Regression (reg in the above and below usage) and a user supplied function (see below).
    The Example Programs give several examples of non-linear regression.
    Reference: Nelder, J.A. and Mead, R. (1965) Computer Journal, 7, 308-313.

    methods
    public void simplex(RegressionFunction rf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol, int nmax)
    Usage:                      reg.simplex(rf, start, step, ftol, nmax);
    Fits the data supplied, via the constructor, to the instance reg in the above usage, to a function coded in a Regression Function; rf in the above usage. The procedure for coding the function, rf, is described in detail
    below and is illustrated in the Example Programs.

    The array, start, holds the initial estimates of the parameters whose best estimates are required.

    The array, step, holds the initial step sizes for each of the parameters. These step sizes are used to construct the initial simplex. They may differ for each parameter and should reflect, if known, the uncertainty in the initial estimates. This argument is optional [see below]

    The double, ftol, is the tolerance used in determining the convergence of the regression. This argument is optional [see below]
    The regression may be terminated by one of two procedures:
    1. terminate if the standard deviation of the sum of squares [unweighted data] or of the chi square values [weighted data] at the apices of the simplex is less than the tolerance, ftol [this is the default option].
    2. terminate if the reduced chi square [weighted data] or the reduced sum of squares [unweighted data] at the lowest apex of the simplex is less than the mean of the absolute values of the dependent variable (y values) multiplied by the tolerance, ftol.
    The default procedure is procedure 1 above with a default value of ftol of 1.0e-9. The default option may be overridden by the method setMintest().

    The integer, nmax, is the maximum number of iterations allowed by the simplex procedure. This argument is optional [see below]. If the maximum number of iterations is reached the method returns the current estimates at that point in the iteration.

    The second differentials needed in the calculation of the covariance matrix, used in calculation of the estimates of the errors of the best estimates, are calculated by numerical differencing if this method is called. See below for a method that allows the derivatives to be calculated analytically.

    See below, or summary table above, for methods to obtain
  • simplex termination details

  • public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    Usage:                      reg.simplex(rf, rfd, start, step, ftol, nmax);
    This method performs all the actions described under
    reg.simplex(rf, start, step, ftol, nmax), immediately above, with the exception that the second differentials needed in the calculation of the covariance matrix, used in calculation of the estimates of the errors of the best estimates, are calculated analytically. The first and second derivatives of the function being fitted with respect to pairs of parameters must be coded within a method in a Regression Derivative Function; rdf in the above usage. Detailed Instructions on coding this function are given below and illustrated in the Example Program illustrating the use of ReferenceDerivativeFunction. See above for a method that allows the derivatives to be calculated numerically.

    public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol, int nmax)
    Usage:                      reg.simplexPlot(rf, start, step, ftol, nmax);
    Performs all that is described above under
    reg.simplex(rf, start, step, ftol, nmax) and in addition
    public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol, int nmax)
    Usage:                      reg.simplexPlot(rf, rfd, start, step, ftol, nmax);
    Performs all that is described above under
    reg.simplex(rf, rfd, start, step, ftol, nmax) and in addition


    public void simplex(RegressionFunction rf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplex(rf, start, step, ftol);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the maximum number of iterations is not provided as an argument. A default value of 3000 is used.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplex(rf, rfd, start, step, ftol);
    As reg.simplex(rf, rfd, start, step, ftol, nmax) above with the exception that the maximum number of iterations is not provided as an argument. A default value of 3000 is used.

    public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplexPlot(rf, start, step, ftol);
    Performs all that is described above under reg.simplex(rf, start, step, ftol) and in addition public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplexPlot(rf, rfd, start, step, ftol);
    Performs all that is described above under reg.simplex(rf, rfd, start, step, ftol) and in addition


    public void simplex(RegressionFunction rf, double[ ] start, double[ ] step, int nmax)
    public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step, int nmax)
    public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step, int nmax)
    Usage:                      reg.simplex(rf, start, step, nmax);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the terrmination tolerance is not provided as an argument. A default value of 1e-9 is used.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rfd, double[ ] start, double[ ] step, int nmax)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rfd, double[ ] start, double[ ] step, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rfd, double[ ] start, double[ ] step, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rfd, double[ ] start, double[ ] step, int nmax)
    Usage:                      reg.simplex(rf, rfd, start, step, nmax);
    As reg.simplex(rf, rfd, start, step, ftol, nmax) above with the exception that the terrmination tolerance is not provided as an argument. A default value of 1e-9 is used.

    public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step, int nmax)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step, int nmax)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step, int nmax)
    Usage:                      reg.simplexPlot(rf, start, step, nmax);
    Performs all that is described above under reg.simplex(rf, start, step, nmax) and in addition public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rfd, double[ ] start, double[ ] step, int nmax)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rfd, double[ ] start, double[ ] step, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rfd, double[ ] start, double[ ] step, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rfd, double[ ] start, double[ ] step, int nmax)
    Usage:                      reg.simplexPlot(rf, rfd, start, step, nmax);
    Performs all that is described above under reg.simplex(rf, rfd, start, step, nmax) and in addition


    public void simplex(RegressionFunction rf, double[ ] start, double ftol, int nmax)
    public void simplex(RegressionFunction2 rf, double[ ] start, double ftol, int nmax)
    public void simplex(RegressionFunction3 rf, double[ ] start, double ftol, int nmax)
    Usage:                      reg.simplex(rf, start, ftol, nmax);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the initial simplex step values are not provided as an argument. A default value of 0.5 times the corresponing initial estimate [start] is used for the steps for all parameters.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)
    Usage:                      reg.simplex(rf, rfd, start, ftol, nmax);
    As reg.simplex(rf, rfd, start, step, ftol, nmax) above with the exception that the initial simplex step values are not provided as an argument. A default value of 0.5 times the corresponing initial estimate [start] is used for the steps for all parameters.

    public void simplexPlot(RegressionFunction rf, double[ ] start, double ftol, int nmax)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, double ftol, int nmax)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, double ftol, int nmax)
    Usage:                      reg.simplexPlot(rf, start, ftol, nmax);
    Performs all that is described above under reg.simplex(rf, start, ftol, nmax) and in addition public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol, int nmax)
    Usage:                      reg.simplexPlot(rf, rfd, start, ftol, nmax);
    Performs all that is described above under reg.simplex(rf, rfd, start, ftol, nmax) and in addition


    public void simplex(RegressionFunction rf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplex(rf, start, step, ftol);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the maximum number of iterations is not provided as an argument. A default value of 3000 is used.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplex(rf, rfd, start, step, ftol);
    As reg.simplex(rf, rfd, start, step, ftol, nmax) above with the exception that the maximum number of iterations is not provided as an argument. A default value of 3000 is used.

    public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplexPlot(rf, start, step, ftol);
    Performs all that is described above under reg.simplex(rf, start, step, ftol) and in addition public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step, double ftol)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step, double ftol)
    Usage:                      reg.simplexPlot(rf, rfd, start, step, ftol);
    Performs all that is described above under reg.simplex(rf, rfd, start, step, ftol) and in addition


    public void simplex(RegressionFunction rf, double[ ] start, double[ ] step)
    public void simplex(RegressionFunction2 rf, double[ ] start, double[ ] step)
    public void simplex(RegressionFunction3 rf, double[ ] start, double[ ] step)
    Usage:                      reg.simplex(rf, start, step);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the maximum number of iterations and the termination tolerance are not provided as arguments. Default values of 1e-9 and 3000 respectively are used.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)
    Usage:                      reg.simplex(rf, rfd, start, step);
    As reg.simplex(rf, rfd,start, step, ftol, nmax) above with the exception that the maximum number of iterations and the termination tolerance are not provided as arguments. Default values of 1e-9 and 3000 respectively are used.

    public void simplexPlot(RegressionFunction rf, double[ ] start, double[ ] step)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, double[ ] step)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, double[ ] step)
    Usage:                      reg.simplexPlot(rf, start, step);
    Performs all that is described above under reg.simplex(rf, start, step) and in addition
    public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double[ ] step)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double[ ] step)
    Usage:                      reg.simplexPlot(rf, rfd, start, step);
    Performs all that is described above under reg.simplex(rf, rfd, start, step) and in addition



    public void simplex(RegressionFunction rf, double[ ] start, double ftol)
    public void simplex(RegressionFunction2 rf, double[ ] start, double ftol)
    public void simplex(RegressionFunction3 rf, double[ ] start, double ftol)
    Usage:                      reg.simplex(rf, start, ftol);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the initial simplex step sizes and the maximum number of iterations are not provided as arguments. Default values of 0.5 times the corresponing initial estimate [start] for all parameters and 3000 respectively are used.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)
    Usage:                      reg.simplex(rf, rfd, start, ftol);
    As reg.simplex(rf, rfd, start, step, ftol, nmax) above with the exception that the initial simplex step sizes and the maximum number of iterations are not provided as arguments. Default values of 0.5 times the corresponing initial estimate [start] for all parameters and 3000 respectively are used.

    public void simplexPlot(RegressionFunction rf, double[ ] start, double ftol)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, double ftol)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, double ftol)
    Usage:                      reg.simplexPlot(rf, start, ftol);
    Performs all that is described above under reg.simplex(rf, start, ftol) and in addition
    public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, double ftol)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, double ftol)
    Usage:                      reg.simplexPlot(rf, rfd, start, ftol);
    Performs all that is described above under reg.simplex(rf, rfd, start, ftol) and in addition



    public void simplex(RegressionFunction rf, double[ ] start, int nmax)
    public void simplex(RegressionFunction2 rf, double[ ] start, int nmax)
    public void simplex(RegressionFunction3 rf, double[ ] start, int nmax)
    Usage:                      reg.simplex(rf, start, nmax);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the initial simplex step sizes and the termination tolerance are not provided as arguments. Default values of 0.5 times the corresponing initial estimate [start] for all parameters and 1e-9 respectively are used.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)
    Usage:                      reg.simplex(rf, rfd, start, nmax);
    As reg.simplex(rf, rfd, start, step, ftol, nmax) above with the exception that the initial simplex step sizes and the termination tolerance are not provided as arguments. Default values of 0.5 times the corresponing initial estimate [start] for all parameters and 1e-9 respectively are used.

    public void simplexPlot(RegressionFunction rf, double[ ] start, int nmax)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start, int nmax)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start, int nmax)
    Usage:                      reg.simplexPlot(rf, start, nmax);
    Performs all that is described above under reg.simplex(rf, start, nmax) and in addition
    public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start, int nmax)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start, int nmax)
    Usage:                      reg.simplexPlot(rf, rfd, start, nmax);
    Performs all that is described above under reg.simplex(rf, rfd, start, nmax) and in addition


    public void simplex(RegressionFunction rf, double[ ] start)
    public void simplex(RegressionFunction2 rf, double[ ] start)
    public void simplex(RegressionFunction3 rf, double[ ] start)
    Usage:                      reg.simplex(rf, start);
    As reg.simplex(rf, start, step, ftol, nmax) above with the exception that the initial simplex step sizes, the termination tolerance and the maximum number of iterations are not provided as arguments. Default values of 0.5 times the corresponing initial estimate [start] for all parameters, 1e-9 and 3000 respectively are used.

    public void simplex(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start)
    public void simplex(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start)
    public void simplex(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start)
    Usage:                      reg.simplex(rf, rfd, start);
    As reg.simplex(rf, rfd, start, step, ftol, nmax) above with the exception that the initial simplex step sizes, the termination tolerance and the maximum number of iterations are not provided as arguments. Default values of 0.5 times the corresponing initial estimate [start] for all parameters, 1e-9 and 3000 respectively are used.

    public void simplexPlot(RegressionFunction rf, double[ ] start)
    public void simplexPlot(RegressionFunction2 rf, double[ ] start)
    public void simplexPlot(RegressionFunction3 rf, double[ ] start)
    Usage:                      reg.simplexPlot(rf, start);
    Performs all that is described above under reg.simplex(rf, start) and in addition
    public void simplexPlot(RegressionFunction rf, RegressionDerivativeFunction rdf, double[ ] start)
    public void simplexPlot(RegressionFunction2 rf, RegressionDerivativeFunction2 rdf, double[ ] start)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction rdf, double[ ] start)
    public void simplexPlot(RegressionFunction3 rf, RegressionDerivativeFunction2 rdf, double[ ] start)
    Usage:                      reg.simplexPlot(rf, rfd, start);
    Performs all that is described above under reg.simplex(rf, rfd, start) and in addition


    DEPRECATED SIMPLEX METHODS
    The simplex2, simplexPlot2 and plotXY2 methods are now deprecated. They have been retained in the flanagan.jar file but are no longer documented here. Their function has been incorporated in the above simplex, simplexPlot and PlotXY methods. To update a program to remove the deprecated methods replace a simplex2 method by the corresponding simplex method, a simplexPlot2 method by the corresponding simplexPlot method and a plotXY2 method by a correswponding plotXY method, i.e. simply remove the 2.



    CODING THE FUNCTION TO WHICH THE DATA IS TO BE FITTED
    The mathematical function, to which the data is to be fitted, may be coded in a function that overrides the function in one of the following intertfaces:
    Any constants in the mathematical function, to which the data that is to be fitted, that are not included in the set of parameters for which we require an estimate, i.e. constants of known fixed value, are not transferred to the function via the argument list but should be declared as members of the class, implementing the RegressionFunctionn, of which function(...) is a member. Their values may be set in that declaration and can be reset within the calling program (see Example Program below).

    Compatibility Table for RegressionFunction and RegressionDerivativeFunction Interfaces

     RegressionDerivativeFunctionRegressionDerivativeFunction2
    RegressionFunctionYESNO
    RegressionFunction2NOYES
    RegressionFunction3YESYES




    CODING OF THE HESSIAN SECOND DERIVATIVES
    The estimates of the variances of the best estimates obtained by non-linear regression are calculated by assuming that the sum of squares surface approximates to one of a linear model close to the minimum. Such a calculation involves obtaining the variance-covariance matrix by inverting the Hessian matrix of second derivatives of the weighted sum of squares at the minimum with respect to all pairs of estimated parameters. These differentials may be either obtained
    numerically. or calculated analytically. If they are calculated analytically the three derivatives

    where f(p,x) is the fitted function, pi and pj are the best estimates of a pair of parameters of indices i and j,
    must be coded in a function that overrides the function in one of the following interfaces:
    The Regression class statistical method uses the returned derivatives to calculate the value of the second derivative of the weighted sum of squares

    where yk is the value of the dependent variable and n is the number of dependent variable data points. If no weights have been provided the unweighted sum of squares is used and an estimate of the variance of the dependent variables is used in calculating the variance-covariance matrix.

    Any constants in the function, to which the data that is to be fitted, that are not included in the set of parameters for which we require an estimate, i.e. constants of known fixed value, are not transferred to the function via the argument list but should be declared as members of the class of which function(x) is a member. Their values may be set in that declaration and can be reset within the calling program (see Example Program below).

    Compatibility Table for RegressionFunction and RegressionDerivativeFunction Interfaces

     RegressionDerivativeFunctionRegressionDerivativeFunction2
    RegressionFunctionYESNO
    RegressionFunction2NOYES
    RegressionFunction3YESYES




    CONSTRAINED NON-LINEAR REGRESSION
    Add a constraint applied to individual parameters
    public void addConstraint(int pIndex, int direction, double boundary)
    Usage:                      reg.addConstraint(pIndex, direction, boundary);
    This method allows the addition of a simple, but often effective constraint, to the non-linear regression. A parameter may be constrained either to take only values above a certain value or below a certain value. The arguments of the method, [in the above usage], are: More than one constraint may be added and more than one constraint may be applied to the same parameter
    If an attempt to enter a constrained region is made the chi square [weighted data] or sum of squares [unweighted data] is not calculated but is replaced by the previously calculated value plus a penalty term equal to a penalty weight [see setPenaltyWeight below] multiplied by the square of the attempted estimate of the parameter entering the constraint region minus the constraint boundary value, i.e. if any set constraint is violated

    is replaced by

    where there are q parameters constrained to lay above lower boundaries, li, r parameters constrained to lay below upper boundaries, ui and s parameters constrained to fixed values, fi within a tolerance, t, H(arg) is the Heaviside step function taking the value of zero for arg < or = 0 and a value of 1 for arg >0, Pw is the penalty weight and χ2previous value is the last calculated value of χ2 in which no constraint boundaries were violated. If the sum of squares is being minimised, i.e. an unweighted regression, an analogous repacement is made. This is an ad hoc method of constraining the regression and if a best estimate is returned at a constraint barrier the associated statistics, already questionable if the χ2 surface around the minimum does not approximate to a quadratic surface characteristic of a linear regression, will be invalidated.

    Add a constraint applied to a summation of some or all parameters
    public void addConstraint(int[] pIndices, double[] plusOrMinus, int direction, double boundary)
    public void addConstraint(int[] pIndices, int[] plusOrMinus, int direction, double boundary)
    Usage:                      reg.addConstraint(pIndices, plusOrMinus, direction, boundary);
    This method allows the addition of a simple, but often effective constraint, to the non-linear regression. A sum of some or all of the parameters may be constrained either to take only values above a certain value or below a certain value. The arguments of the method, [in the above usage], are: For example, if, for a non-linear regression with four parameters aa, bb, cc and dd, whose initial estimates were set in start[0], start[1], start[2] and start[3] respectively, one wishes to apply the constraint,
              1.1aa − 2.3bb + 5.7dd > 13.4,
    the addConstraint method would be called with:
              pIndices[0] = 0, pIndices[1] = 1, pIndices[2] = 3;
              plusOrMinus[0] = 1.1, plusOrMinus[1] = −2.3, plusOrMinus[2] = 5.7;
              direction = −1;
              boundary = 13.4;

    More than one constraint sum may be added.
    If an attempt to enter a constrained region is made the value of the chi square [weighted data] or sum of squares [unweighted data] is not calculated but is replaced by the previously calculated value plus a penalty term equal to a penalty weight [see setPenaltyWeight below] multiplied by the square of the attempted estimate of the constraint sum minus the constraint boundary value, i.e. if any set constraint is violated

    is replaced by

    where there are q parameters constrained to lay above lower boundaries, li, r parameters constrained to lay below upper boundaries, ui and s parameters constrained to fixed values, fi within a tolerance, t, H(arg) is the Heaviside step function taking the value of zero for arg < or = 0 and a value of 1 for arg >0, Pw is the penalty weight and χ2previous value is the last calculated value of χ2 in which no constraint boundaries were violated. If the sum of squares is being minimised, i.e. an unweighted regression, an analogous repacement is made. This is an ad hoc method of constraining the regression and if a best estimate is returned at a constraint barrier the associated statistics, already questionable if the χ2 surface around the minimum does not approximate to a quadratic surface characteristic of a linear regression, will be invalidated.

    Remove all constraints
    public void removeConstraints()
    Usage:                      reg.removeConstraints();
    If a new regression method is called, any previously added constraints will remain active and be applied to the new parameters unless removed. This method removes all constraints.

    Reset the penalty weight
    public void setPenaltyWeight(double pWeight)
    Usage:                      reg.setPenaltyWeight(pWeight);
    This method resets the penalty weight [pWeight in the above usage] used by the constraint procedure [see addConstraint immediately above]. The default value is 1e30.

    Return the penalty weight
    public double getPenaltyWeight()
    Usage:                      pWeight = reg.getPenaltyWeight();
    Returns the penalty weight used by the constraint procedure [see addConstraint immediately above]. The default value is 1e30.

    Reset the constraint tolerance
    public void setConstraintTolerance(double tolerance)
    Usage:                      reg.setConstraintTolerance(tolerance);
    Resets the tolerance value used by the constraint procedure for multiple parameters and a fixed constraint value [see addConstraint immediately above]. The default value is 10−4.



    SCALING OF THE INITIAL ESTIMATES
    Reset the scaling factors applied to the initial estimates
    public void setScale(int opt)
    public void setScale(double[] opt)
    Usage:                      reg.setScale(opt);
    Resets the factors by which the initial estimates unknown parameters are scaled. The options [opt in the above usage] may take values: The default value is opt=0, i.e. no scaling. Scaling is advised if there are significant disparities between some of the magnitudes of the initial estimates. If the default option is to be overriden, setScale must be called before the non-linear regression method is called.

    Get the scaling factors
    public double[ ] getScale()
    Usage:                      scale = reg.getScale();
    Returns the scaling factors applied to the initial estimates used by the Nelder and Mead Simplex method.



    RETURNING THE INITIAL ESTIMATES
    Returning the unscaled initial estimates
    public double[] getInitialEstimates()
    Usage:                      starts = reg.getInitialEstimates();
    This method returns the initial estimates used by the Nelder and Mead simplex regression methods as either entered by the user or calculated internally. The values returned are those before any scaling has occurred. See below for a method returning the scaled values.

    Returning the scaled initial estimates
    public double[] getScaledInitialEstimates()
    Usage:                      starts = reg.getScaledInitialEstimates();
    This method returns the scaled initial estimates used by the Nelder and Mead simplex regression methods as either entered by the user or calculated internally. The values returned are those after any scaling has occurred. if no scaling has occurred these values will be identical to those reurned by getInitialEstimates(). See above for a method returning the unscaled values.


    RETURNING THE INITIAL STEP SIZES
    Returning the unscaled initial step sizes
    public double[] getInitialSteps()
    Usage:                      starts = reg.getInitialSteps();
    This method returns the initial step sizes used by the Nelder and Mead simplex regression methods as either entered by the user or calculated internally. The values returned are those before any scaling has occurred. See below for a method returning the scaled values.

    Returning the scaled initial step sizes
    public double[] getScaledInitialSteps()
    Usage:                      starts = reg.getScaledInitialSteps();
    This method returns the scaled initial step sizes used by the Nelder and Mead simplex regression methods as either entered by the user or calculated internally. The values returned are those after any scaling has occurred. if no scaling has occurred these values will be identical to those reurned by getInitialSteps(). See above for a method returning the unscaled values.


    CONVERGENCE TESTS
    Reset the convergence test
    public void setMinTest(int opt) Usage:                      reg.setMinTest(opt);
    Resets the procedure by which the Simplex iteration is tested for convergence onto a minimum. The options [opt in the above usage] may take values: The default value is opt=0.

    Get the convergence test option
    public int getMinTest()
    Usage:                      scale = reg.getMinTest();
    Returns the convergence test option. See immediately above for details of this option.

    Reset the tolerance value
    public void setTolerance(double fTol)
    Usage:                      reg.=setTolerance(fTol);
    Resets the tolerance [fTol in the above usages] used in testing for convergence. See setMinTest above for details.

    Get the tolerance value
    public int getTolerance()
    Usage:                      fTol = reg.getTolerance();
    Returns the tolerance [fTol in the above usages] used in testing for convergence. See setMinTest above for details.

    Get the simplex standard deviation
    public double getSimplexSd()
    Usage:                      simplexSd = reg.getSimplexSd();
    Returns the standard deviation of the simplex at the minimum. See setMinTest above for details of its use in testing for convergence.



    RESTARTS
    Reset the maximum number of restarts
    public void setNrestartsMax(int nrm)
    Usage:                      reg.setNrestartsMax(nrm);
    Resets the maximum number of restarts allowed in the Nelder and Mead Simplex procedure. On reaching a minimum the procedure will be restarted this number [nrm in the above usage] of times. The default option is 3.

    Get the maximum number of restarts allowed
    public int getNrestartMax()
    Usage:                      nrm = reg.getNrestartsMax();
    Returns the maximum number of restarts allowed.

    Get the number of restarts that occured
    public int getNrestart()
    Usage:                      nr = reg.getNrestarts();
    Returns the number of restarts that occured.



    NUMBER OF ITERATIONS
    Reset the maximum number of iterations allowed
    public void setNmax(double nMax)
    Usage:                      reg.setNmax(nMax);
    Resets the maximum number of iterations allowed in the Nelder and Mead simplex procedure to the method argument [nMax in the above usage]. The default value is 3000.

    Get the maximum number of iterations allowed
    public int getNmax()
    Usage:                      nimax = reg.getNmax();
    Returns the maximum number of iterations allowed in the Nelder and Mead simplex procedure.

    Reset the minimum number of iterations required
    public void setNmin(double nMin)
    Usage:                      reg.setNmin(nMin);
    Resets the minimum number of iterations required in the Nelder and Mead simplex procedure to the method argument [nMin in the above usage]. The default value is 300.

    Get the minimum number of iterations required
    public int getNmin()
    Usage:                      nimin = reg.getNmin();
    Returns the minimum number of iterations required in the Nelder and Mead simplex procedure.

    Get the number of iterations taken
    public int getNiter()
    Usage:                      nr = reg.getNiter();
    Returns the number of iterations taken.



    Gradients about the minimum
    public double[ ][ ] getGrad()
    Usage:                      grad = reg.getGrad();
    Returns the gradients, calculated as difference equations, immediately before

    and immediatley after

    the minimum, for all paramters. The pre-minimum gradients are returnen in, in the above usage, in grad[0][0], grad[0][1], grad[0][2]... and the post-minimum gradients are returned in grad[1][0], grad[1][1], grad[1][2].... These gradients are only calculated in the case of a non-linear regression and a null value is returned if the regression is linear.



    THE NELDER AND MEAD SIMPLEX COEFFICIENTS
    Reset the reflection coefficient
    public void setNMreflect(doublereflectC)
    Usage:                      reg.setNMreflect(reflectC);
    Resets the Nelder and Mead simplex reflection coefficient. The default value is 1.0D.

    Get the reflection coefficient
    public double getNMreflect()
    Usage:                      reflectC = reg.getNMreflect();
    Returns the Nelder and Mead simplex reflection coefficient. The default value is 1.0D.

    Reset the extension coefficient
    public void setNMextend(doubleextendC)
    Usage:                      reg.setNMextend(extendC);
    Resets the Nelder and Mead simplex extension coefficient. The default value is 2.0D.

    Get the reflection coefficient
    public double getNMextend()
    Usage:                      extedC = reg.getNMextend();
    Returns the Nelder and Mead simplex extension coefficient. The default value is 2.0D.

    Reset the contraction coefficient
    public void setNMcontract(doublecontractC)
    Usage:                      reg.setNMcontract(contractC);
    Resets the Nelder and Mead simplex contraction coefficient. The default value is 0.5D.

    Get the contraction coefficient
    public double getNMcontract()
    Usage:                      contractC = reg.getNMcontract();
    Returns the Nelder and Mead simplex contraction coefficient. The default value is 0.5D.



    FITTING DATA TO SPECIAL FUNCTIONS

    The Regression class's instance methods allowing data to be fitted to individual distributions, with access to all this class's regression methods, are listed below.

    A static method (fitOneOrSeveralDistribtions(dataArray) below) allows a rapid scan of the fitting of the data in the double array, dataArray, to one, several or all of the distributions treated in this class, with limited output of the best fit details.

    The Ordinate Axis Scaling Factor Option
    All regressions in which data is fitted to any of the special functions may be performed with an ordinate axis scaling factor, Ao, either set equal to a fixed value, typically 1 or 100, or included as a parameter to be estimated. The default option is inclusion of Ao in the parameters to be estimated. The methods listed below allow this option to be changed.
    Setting the Ordinate Axis Scaling Factor
    public void setYscaleFactor(double scaleFacor)
    Usage:                      reg.setYscaleFactor(scaleFactor);
    This method will set the ordinate axis scaling factor, Ao, to a fixed value equal to the value of the argument, scaleFactor.

    Setting the Ordinate Axis Scaling Factor Option
    public void setYscaleOption(boolean test)
    Usage:                      reg.setYscaleOption(test);
    Setting test to false will set the ordinate axis scaling factor, Ao, to unity. See immediately setYscaleFactor() immediately below for fixing Ao to a value other than unity.
    Setting test to true will ensure that the ordinate axis scaling factor, Ao, is included amongst the parameters to be estimated by the regression procedure.
    The older method reg.setYscale(test) performs the same function as reg.setYscaleOption(test) and has been retained to ensure backward compatibility.

    Getting the Ordinate Axis Scaling Factor Option
    public boolean setYscale()
    Usage:                      test = reg.getYscale();
    Returns ordinate axis scaling factor, Ao, option.
    If false is returned, the ordinate axis scaling factor, Ao, is equal to unity.
    If true is returned, the ordinate axis scaling factor, Ao, is included amongst the parameters to be estimated by the regression procedure.
    The older method reg.getYscale() performs the same function as reg.getYscaleOption() and has been retained to ensure backward compatibility.



    Fit data to a Gaussian (Normal) Distribution Function
    NB: The ProbabilityPlot class is likely to be more useful in fitting data to a Gaussian [Normal] distribution.

    See below for a Gaussian fitting method with an option to fix one or more of the parameters.
    public void gaussian()
    Usage:                      reg.gaussian();
    Fits the data to the Gaussian (normal) distribution function, p(x), where

    and μ and σ are the mean and standard deviation of the normal (Gaussian) distribution and Ao is a scaling factor. The parameters μ, σ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gaussian statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Gaussian (Normal) Distribution Function and plot results
    public void gaussianPlot()
    Usage:                      reg.gaussianPlot();
    Performs all that is described above under reg.gaussian(parameterValues, fixedOptions) and in addition Fit data to a Gaussian (Normal) Distribution Function with an option to fix parameters
    See above for a Gaussian fitting method with no option to fix the parameters.
    public void gaussian(double[] parameterValues, boolean[] fixedOptions)
    Usage:                      reg.gaussian(parameterValues, fixedOptions);
    Fits the data to the Gaussian (normal) distribution function, p(x), where

    and μ and σ are the mean and standard deviation of the normal (Gaussian) distribution and Ao is a scaling factor. The parameters μ, σ and Ao are the parameters to be estimated or fixed. The argument parameterValues must contain the initial estimate or fixed value of the mean, μ, standard deviation, σ, and the scale factor, Ao, in that order. The argument fixedOptions must contain three booleans, each corresponding to the three parameters, μ, σ and Ao, in that order. The boolean should be true if the parameter is to be fixed at the given value in the parameterValues list. It should be false if the parameter is not to be fixed, i.e. the best estimate is to be found by the regression procedure. In the latter case the value in the parameterValues list will be taken as the initial estimate for the regression procedure. A Nelder and Mead Simplex procedure is used. See Constructors and the class Stat for details of Gaussian statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Gaussian (Normal) Distribution Function and plot results
    public void gaussianFixedPlot(double[] parameterValues, boolean[] fixedOptions)
    Usage:                      reg.gaussianPlot(parameterValues, fixedOption);
    Performs all that is described above under reg.gaussian(parameterValues, fixedOption) and in addition
    Fit data to a multiple Gaussian (Normal) Distribution Functions and plot results
    public void multipleGaussiansPlot(int nGaussians, double[] guessesOfMeans, double[] guessesOfStandardDeviations, double[] guessesOfFractionalContributions)
    Usage:                      reg.multipleGaussiansPlot(nGaussians, guessesOfMeans, guessesOfStandardDeviations, guessesOfFractionalContributions);
    Fits the data to the sum of n [nGaussians] Gaussian (normal) distribution functions, p(x), where

    and μi and σi are the means and standard deviations of the normal (Gaussian) distributions, Ai are the scaling factors for each distribution, B is an overall scaling factor and fi are the fractional contribution of each distribution. The parameters μ, σ and Ai are the parameters estimated. The reported values for the parameters B and fi are derived from the estimated values of Ai.
    This method of fitting to multiple Gaussians requires good initial estimates of the parameters whose values are required. These must be entered as the informed guesses [guessesOfMeans] of the values of the means, μi, of the individual Gaussian distributions, informed guesses [guessesOfStandardDeviations] of their standard deviations, σi, and informed guesses [guessesOfFractionalContributions] of the fractional contribution of each distribution, fi. The sum of the fractional contributions, fi, must equal 1.0.
    A Nelder and Mead Simplex procedure is used.
    This method also See Constructors and the class Stat for details of Gaussian statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.



    Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Gaussian (normal) distribution [with no fixed parameter option], and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Gaussian Probability Plots. These methods return best fit estimates of μ and σ.



    Fit data to a Log-normal Distribution Function
    Both the two parameterlog-normal and the three parameter log-normal distributions are included in this class.

    Fit data to a Two Parameter Log-Normal Distribution
    public void logNormal()
    public void logNormalTwoPar()
    Usage:                      reg.logNormal();
    Fits the data to the Two Parameter Log-normal distribution function, p(x), where

    and μ and σ are the location and shape parameters of the two parameter log-normal distribution and Ao is a scaling factor. The parameters μ, σ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of the two parameter log-normal distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    The method, logNormalTwoPar, is identical to the above method, logNormal.

    Fit data to a Two Parameter Log-Normal Distribution Function and plot results
    public void logNormalPlot()
    public void logNormalTwoParPlot()
    Usage:                      reg.logNormalPlot();
    Performs all that is described above under reg.logNormal() and in addition The method, logNormalTwoParPlot, is identical to the above method, logNormalPlot.

    Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Logistic distribution, and to other distributions, but with limited output of the best fit details. See below for details.

    Fit data to a Three Parameter Log-normal Distribution Function
    public void logNormalThreePar()
    Usage:                      reg.logNormalThreePar();
    Fits the data to the Three Parameter Log-normal distribution function, p(x), where

    and α, β and γ are the location, shape and scale parameters of the three parameter log-normal distribution and Ao is a scaling factor. The parameters α, β, γ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of the two parameter log-normal distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Three Parameter Log-Normal Distribution Function and plot results
    public void logNormalThreeParPlot()
    Usage:                      reg.logNormalThreeParPlot();
    Performs all that is described above under reg.logNormalThreePar() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Logistic distribution, and to other distributions, but with limited output of the best fit details. See below for details.



    Fit data to a Logistic Distribution Function
    See also Five Parameter Logistic and Four Parameter Logistic curves.
    public void logistic()
    Usage:                      reg.logistic();
    Fits the data to the Logistic distribution function, p(x), where

    and μ and β are the location and scale parameters of the Logistic distribution and Ao is a scaling factor. The parameters μ, β and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Logistic distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Logistic Distribution Function and plot results
    public void logisticPlot()
    Usage:                      reg.logisticPlot();
    Performs all that is described above under reg.logistic() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Logistic distribution, and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Logistic Probability Plots. These methods return best fit estimates of μ and β.



    Fit data to a Beta Distribution Function
    Fit data to a Beta Distribution on the interval [0,1]
    public void beta()
    Usage:                      reg.beta();
    Fits the data to the Beta distribution on the interval [0,1],  p(x;α,β), where

    and α and β are the shape parameters of the Beta distribution, B(α, β) is the Beta Function and Ao is a scaling factor. The parameters α, β and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Beta distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Beta Distribution on the interval [0,1] and plot results
    public void betaPlot()
    Usage:                      reg.betaPlot();
    Performs all that is described above under reg.beta() and in addition Fit data to a Beta Distribution on the interval [min,max]
    public void betaMinMax()
    Usage:                      reg.betaMinMax();
    Fits the data to the Beta distribution on the interval [min, max],  p(x;α,β, min,max), where

    and α and β are the shape parameters of the Beta distribution, B(α, β) is the Beta Function, min and max are the minimum and maximum values respectively that x may take and Ao is a scaling factor. The parameters α, β, min, max and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Beta distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Beta Distribution on the interval [min,max] and plot results
    public void betaMinMaxPlot()
    Usage:                      reg.betaMinMaxPlot();
    Performs all that is described above under reg.betaMinMax() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Beta distribution on the interval [min,max], and to other distributions, but with limited output of the best fit details. See below for details.



    Fit data to a Gamma Distribution Function
    Fit data to a Three Parameter Gamma Distribution
    public void gamma()
    Usage:                      reg.gamma();
    Fits the data to the Three Parameter Gamma distribution,  p(x;β,γ,μ), where

    and μ is the location parameter, β is the scale parameter, γ is the shape parameter, Γ(α), the Gamma Function and Ao is a scaling factor. The parameters α, β and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gamma distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Three Parameter Gamma Distribution and plot results
    public void gammaPlot()
    Usage:                      reg.gammaPlot();
    Performs all that is described above under reg.gamma() and in addition Fit data to a Standard Gamma Distribution
    public void gammaStandard()
    Usage:                      reg.gammaStandard();
    Fits the data to the Standard Gamma distribution,  p(x; γ), where

    and γ is the shape parameter, Γ(α), the Gamma Function and Ao is a scaling factor. The parameters α, β and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gamma distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Standard Gamma Distribution and plot results
    public void gammaStandardPlot()
    Usage:                      reg.gammaStandardPlot();
    Performs all that is described above under reg.gammaStandard() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Three Parameter Gamma distribution on the interval [min,max], and to other distributions, but with limited output of the best fit details. See below for details.



    Fit data to an Erlang Distribution Function
    public void erlang()
    Usage:                      reg.erlang();
    Fits the data to the Erlang distribution,  p(x;λ,k), where

    and λ [argument double lambda] is the shape parameter, k [argument int kay] is the integer rate parameter and Ao is a scaling factor. The parameters λ, k and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. The Erlang distribution is equivalent to a Gamma Distribution in which the Gamma location parameter, μ is set to zero, the Gamma scale parameter, β, is the inverse of the Erlang rate paramete, λ, and the Gamma shape parameter, γ, is restricted to integer values, i.e. the Erlang shape parameter, k. See Constructors and the class Stat for details of Erlang distribution statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to an Erlang Distribution and plot results
    public void erlangPlot()
    Usage:                      reg.erlangPlot();
    Performs all that is described above under reg.erlang() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to an Erlang distribution on the interval [min,max], and to other distributions, but with limited output of the best fit details. See below for details.



    Fit data to a Lorentzian (Cauchy) Distribution Function
    public void lorentzian()
    Usage:                      reg.lorentzian();
    Fits the data to the lorentzian distribution function, p(x), where

    and μ and Γ are the mean and half-width (width at half the maximum heigth) of the lorentzian distribution and Ao is a scaling factor. The parameters μ, Γ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Lorentzian statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Lorentzian Probability Function and plot results
    public void lorentzianPlot()
    Usage:                      reg.lorentzianPlot();
    Performs all that is described above under reg.lorentzian() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Lorenztian distribution, and to other distributions, but with limited output of the best fit details. See below for details.



    Fit data to a Poisson Distribution Function
    public void poisson()
    Usage:                      reg.poisson();
    Fits the data to the Poisson distribution function, p(x), where

    and μ is the mean of the Poisson distribution and Ao is a scaling factor. The parameters μ, and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used.
    The abscissa values, i.e. the values of k, although provided as an array of doubles, must, mathematically, be integers.
    See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Lorentzian statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Poisson Probability Function and plot results
    public void lorentzianPlot()
    Usage:                      reg.poissonPlot();
    Performs all that is described above under reg.poisson() and in addition


    Fit data to a Gumbel Distribution (minimum order statistic) Function [Type 1 Extreme Value Distribution (minimum order statistic)]
    Fit data to a Two Parameter Gumbel Distribution (minimum order statistic) Function
    public void gumbelMin()
    Usage:                      reg.gumbelMin();
    Fits the data to the Gumbel distribution (minimum order statistic) function, p(x), where

    and μ is the location parameter, σ is the scale parameter and Ao is an ordinate scaling factor. The parameters μ, σ, and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gumbel statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Two Parameter Gumbel Distribution (minimum order statistic) and plot results
    public void gumbelMinPlot()
    Usage:                      reg.gumbelMinPlot();
    Performs all that is described above under reg.gumbelMin() and in addition
    Fit data to a One Parameter Gumbel Distribution (minimum order statistic) Function
    public void gumbelMinOnePar()
    Usage:                      reg.gumbelMinOnePar();
    Fits the data to a one parameter Gumbel distribution function (minimum order statistic), p(x), where

    σ is the scale parameter and Ao is an ordinate scaling factor. The parameters σ, and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gumbel statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a One parameter Gumbel Distribution (minimum order statistic) and plot results
    public void gumbelMinOneParPlot()
    Usage:                      reg.gumbelMinOneParPlot();
    Performs all that is described above under reg.gumbelMinOnePar() and in addition
    Fit data to a Standard Gumbel Distribution (minimum order statistic) Function
    public void gumbelMinStandard()
    Usage:                      reg.gumbelMinStandard();
    Fits the data to the Standard Gumbel distribution (minimum order statistic) function, p(x), where

    and Ao is an ordinate scaling factor. Ao is the parameter to be estimated, i.e. the scale parameter σ and the location parameter, μ has been set to zero. A linear regression is performed on p(x) = Ao.z where z = exp(x)exp(-exp(x)). See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gumbel statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Standard Gumbel Distribution (minimum order statistic) and plot results
    public void gumbelMinStandardPlot()
    Usage:                      reg.gumbelMinStandardPlot();
    Performs all that is described above under reg.gumbelMinStandard() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Two Parameter Gumbel Distribution (minimum order statistic), and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Gumbel (minimum order statistic) Probability Plots. These methods return best fit estimates of μ and σ.



    Fit data to a Gumbel Distribution (maximum order statistic) Function [Type 1 Extreme Value Distribution (maximum order statistic)]
    Fit data to a Two Parameter Gumbel Distribution (maximum order statistic) Function
    public void gumbelMax()
    Usage:                      reg.gumbelMax();
    Fits the data to the Gumbel Distribution (maximum order statistic) function, p(x), where

    and μ is the location parameter, σ is the scale parameter and Ao is an ordinate scaling factor. The parameters μ, σ, and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gumbel statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Two parameter Gumbel Distribution (maximum order statistic) and plot results
    public void gumbelMaxPlot()
    Usage:                      reg.gumbelMaxPlot();
    Performs all that is described above under reg.gumbelMax() and in addition
    Fit data to a One Parameter Gumbel Distribution (maximum order statistic) Function
    public void gumbelMaxOnePar()
    Usage:                      reg.gumbelMaxOnePar();
    Fits the data to a one parameter Gumbel distribution (maximum order statistic) function, p(x), where

    σ is the scale parameter and Ao is an ordinate scaling factor. The parameters σ, and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gumbel statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a One parameter Gumbel Distribution (maximum order statistic) and plot results
    public void gumbelMaxOneParPlot()
    Usage:                      reg.gumbelMaxOneParPlot();
    Performs all that is described above under reg.gumbelMaxOnePar() and in addition
    Fit data to a Standard Gumbel Distribution (maximum order statistic) Function
    public void gumbelStandard()
    Usage:                      reg.gumbelMaxStandard();
    Fits the data to the Stanmdard Gumbel distribution (maximum order statistic) function, p(x), where

    and Ao is an ordinate scaling factor. Ao is the parameter to be estimated, i.e. the scale parameter σ and the location parameter, μ has been set to zero. A linear regression is performed on p(x) = Ao.z where z = exp(-x)exp(-exp(-x)). See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Gumbel statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Standard Gumbel Distribution (maximum order statistic) and plot results
    public void gumbelMaxStandardPlot()
    Usage:                      reg.gumbelMaxStandardPlot();
    Performs all that is described above under reg.gumbelMaxStandard() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Two Parameter Gumbel Distribution (maximum order statistic), and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Gumbel (maximum order statistic) Probability Plots. These methods return best fit estimates of μ and σ.



    Fit data to a Fréchet Distribution Function [Type 2 Extreme Value Distribution]
    Fit data to a Three parameter Fréchet Distribution Function
    public void frechet()
    Usage:                      reg.frechet();
    This method fits the data to the three parameter Fréchet distribution function;

    where μ is the location parametera, σ is the scale parameter, γ is the shape parameter and Ao is an ordinate scaling factor. The parameters μ, σ, γ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Fréchet statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a three parameter Fréchet Distribution and plot results
    public void frechetPlot()
    Usage:                      reg.frechetPlot();
    Performs all that is described above under reg.frechet() and in addition
    Fit data to a Two parameter Fréchet Distribution Function
    public void frechetTwoPar()
    Usage:                      reg.frechetTwoPar();
    This method fits the data to the two parameter Fréchet distribution function;

    σ is the scale parameter, γ is the shape parameter and Ao is an ordinate scaling factor. The parameters σ, γ and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Fréchet statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a two parameter Fréchet Distribution and plot results
    public void frechetTwpParPlot()
    Usage:                      reg.frechetTwoParPlot();
    Performs all that is described above under reg.frechetTwoPar() and in addition
    Fit data to a Standard Fréchet Distribution Function
    public void frechetStandard()
    Usage:                      reg.frechetStandard();
    This method fits the data to the standard Fréchet distribution function;

    γ is the shape parameter and Ao is an ordinate scaling factor. The parameters γ and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero and the scale parameter, σ has been set to unity. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Fréchet statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Standard Fréchet Distribution and plot results
    public void frechetStandardPlot()
    Usage:                      reg.frechetStandardPlot();
    Performs all that is described above under reg.frechetStandard() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Three Parameter Fréchet Distribution, and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Fréchet Probability Plots. These methods return best fit estimates of μ, σ and γ.



    Fit data to a Weibull Distribution Function [Type 3 Extreme Value Distribution]
    NB: The ProbabilityPlot class is likely to be more useful in fitting data to a Weibull distribution.

    Fit data to a Three parameter Weibull Distribution Function
    public void weibull()
    Usage:                      reg.weibull();
    This method fits the data to the three parameter Weibull distribution function;

    where μ is the location parametera, σ is the scale parameter, γ is the shape parameter and Ao is an ordinate scaling factor. The parameters μ, σ, γ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Weibull statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a three parameter Weibull Distribution and plot results
    public void weibullPlot()
    Usage:                      reg.weibullPlot();
    Performs all that is described above under reg.weibull() and in addition
    Fit data to a Two parameter Weibull Distribution Function
    public void weibullTwoPar()
    Usage:                      reg.weibullTwoPar();
    This method fits the data to the two parameter Weibull distribution function;

    σ is the scale parameter, γ is the shape parameter and Ao is an ordinate scaling factor. The parameters σ, γ and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Weibull statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a two parameter Weibull Distribution and plot results
    public void weibullTwpParPlot()
    Usage:                      reg.weibullTwoParPlot();
    Performs all that is described above under reg.weibullTwoPar() and in addition
    Fit data to a Standard Weibull Distribution Function
    public void weibullStandard()
    Usage:                      reg.weibullStandard();
    This method fits the data to the standard Weibull distribution function;

    γ is the shape parameter and Ao is an ordinate scaling factor. The parameters γ and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero and the scale parameter, σ has been set to unity. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Weibull statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Standard Weibull Distribution and plot results
    public void weibullStandardPlot()
    Usage:                      reg.weibullStandardPlot();
    Performs all that is described above under reg.weibullStandard() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Three Parameter Weibull Distribution, and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Weibull Probability Plots. These methods return best fit estimates of μ, σ and γ.



    Fit data to a Exponential Distribution
    The exponential distribution is a special case of a Weibull distribution in which the shape parameter, γ, has been set to unity.

    NB: The ProbabilityPlot class is likely to be more useful in fitting data to an Exponential distribution.

    Fit data to a Two parameter Exponential Distribution Function
    public void exponential()
    Usage:                      reg.exponential();
    This method fits the data to the two parameter Exponential distribution function;

    where μ is the location parametera, σ is the scale parameter and Ao is an ordinate scaling factor. The parameters μ, σ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Exponential statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a two parameter Exponential Distribution and plot results
    public void exponentialPlot()
    Usage:                      reg.exponentialPlot();
    Performs all that is described above under reg.exponential() and in addition
    Fit data to a One Parameter Exponential Distribution Function
    public void exponentialOnePar()
    Usage:                      reg.exponentialOnePar();
    This method fits the data to the two parameter Exponential distribution function;

    σ is the scale parameter and Ao is an ordinate scaling factor. The parameters σ and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Exponential statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a one parameter Exponential Distribution and plot results
    public void exponentialOneParPlot()
    Usage:                      reg.exponentialOneParPlot();
    Performs all that is described above under reg.exponentialOnePar() and in addition
    Fit data to a Standard Exponential Distribution Function
    public void exponentialStandard()
    Usage:                      reg.exponentialStandard();
    This method fits the data to the standard Exponential distribution function;

    γ is the shape parameter and Ao is an ordinate scaling factor. The parameters γ and Ao are the parameters to be estimated, i.e. the location parameter, μ has been set to zero and the scale parameter, σ has been set to unity. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Exponential statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Standard Exponential Distribution and plot results
    public void exponentialStandardPlot()
    Usage:                      reg.exponentialStandardPlot();
    Performs all that is described above under reg.exponentialStandard() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Two Parameter Exponential Distribution, and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Exponential Probability Plots. These methods return best fit estimates of μ and σ.

    Fit data to Simple Exponentials
    Fit data to a Single Exponential
    public void exponentialSimple()
    Usage:                      reg.exponentialSimple();
    This method fits the data to a Simple Exponential:
         yi = A.exp(B.xi)
    where B is the exponential decay constant and A is an ordinate scaling factor. The parameters B and A are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100.

    Fit data to a Simple Exponential and plot results
    public void exponentialSimplePlot()
    Usage:                      reg.exponentialSimplePlot();
    Performs all that is described above under reg.exponentialSimple()
    and in addition
    Fit data to one minus a single exponential
    public void oneMinusExponential()
    Usage:                      reg.oneMinusExponential();
    This method fits the data to:
         yi = A.(1.0 - exp(B.xi))
    where B is the exponential decay constant and A is an ordinate scaling factor. The parameters A and B are the parameters to be estimated. A Nelder and Mead Simplex procedure is used.

    Fit data to one minus a single exponential and plot results
    public void oneMinusExponentialPlot()
    Usage:                      reg.oneMinusExponentialPlot();
    Performs all that is described above under reg.oneMinusExponential()
    and in addition
    Fit data to Multiple Exponentials
    Fitting data to sums of exponentials can be difficult as this often involves a very ill-conditioned set of equations. Read the literature on this subject before using these methods if you are not familiar with such fitting and treat the results of these methods with caution. A method is also supplied that enables the user to supply initial estimates instead of relying on the internally calculated initial estimates. This is the preferred method if the user has some knowledge of the model being fitted.

    Fit data to Multiple Exponentials with internally calculated initial estimates
    public void exponentialMultiple(int nExp)
    public void exponential|MultiplePlot(int nExp)
    Usage:                      reg.exponentialMultiple(n);
    This method fits the data to a sum of n exponentials:
         
    The parameters Aj and Bj are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. The initial estimates are calculated within the method (See below for a method taking user supplied initial estimates).
    Use the constraint methods to apply the common constraints on the values of Aj, e.g. for(int j=0; j<2*n; j+=2)reg.addConstraint(j, -1, 0); constrains all Aj to the positive domain,
    for(int j=1; j<=2*n; j+=2)reg.addConstraint(j, 1, 0); constrains all Bj to the negative domain.

    Fit data to Multiple Exponentials and plot results
    public void exponentialMultiplePlot(n)
    Usage:                      reg.exponentialMultiplePlot(n);
    Performs all that is described above under reg.exponentialMultiple(n)
    and in addition Fit data to Multiple Exponentials with user supplied initial estimates
    public void exponentialMultiple(int nExp, double[] initialEstimates)
    public void exponential|MultiplePlot(int nExp, double[] initialEstimates)
    Usage:                      reg.exponentialMultiple(n, initialEstimates);
    This method fits the data to a sum of n exponentials:
         
    The parameters Aj and Bj are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. The initial estimates are supplied by the user and entered as the argument array, initialEstimates (See above for a method that calculates the initial estimates). Enter the initial estimates in the order A1, B1, A2, B2, . . .
    Use the constraint methods to apply the common constraints on the values of Aj, e.g. for(int j=0; j<2*n; j+=2)reg.addConstraint(j, -1, 0); constrains all Aj to the positive domain,
    for(int j=1; j<=2*n; j+=2)reg.addConstraint(j, 1, 0); constrains all Bj to the negative domain.

    Fit data to Multiple Exponentials and plot results
    public void exponentialMultiplePlot(n, initialEstimates)
    Usage:                      reg.exponentialMultiplePlot(n, initialEstimates);
    Performs all that is described above under reg.exponentialMultiple(n, initialEstimates)
    and in addition


    Fit data to a Rayleigh Distribution
    The Rayleigh distribution is a special case of a Weibull distribution in which the shape parameter, γ, has been set equal to 2, the location parameter, μ, has been set equal to zero and the Weibull scale paramater, σ has been divided by the square root of 2.

    NB: The ProbabilityPlot class is likely to be more useful in fitting data to a Rayleigh distribution.

    public void rayleigh()
    Usage:                      reg.rayleigh();
    This method fits the data to a Rayleigh distribution function;

    where β is the scale parameter and Ao is an ordinate scaling factor. The parameters σ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Rayleigh statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Rayleigh Distribution and plot results
    public void rayleighPlot()
    Usage:                      reg.rayleighPlot();
    Performs all that is described above under reg.rayleigh() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Rayleigh Distribution, and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Rayleigh Probability Plots. These methods returns a best fit estimate of β.



    Fit data to a Pareto Distribution
    NB: The ProbabilityPlot class is likely to be more useful in fitting data to a Pareto distribution.

    Fit data to a Shifted Pareto Distribution Function
    public void paretoShifted()
    Usage:                      reg.paretoShifted();
    This method fits the data to a shifted Pareto distribution function;

    where α is the shape parameter, β is the scale parameter, θ is the threshold parameter and Ao is an ordinate scaling factor. The parameters α, β, θ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Pareto statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a Shifted Pareto Distribution and plot results
    public void paretoShiftedPlot()
    Usage:                      reg.paretoShiftedPlot();
    Performs all that is described above under reg.paretoShifted() and in addition Fit data to a Two Parameter Pareto Distribution Function
    public void paretoTwoPar()
    Usage:                      reg.paretoTwoPar();
    This method fits the data to the Two Parameter Pareto distribution function;

    where α is the shape parameter, β is the scale parameter and Ao is an ordinate scaling factor. The parameters α, β and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Pareto statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    The method pareto() is identical to paretoTwoPar() and has been retained to maintain backward compatibility.

    Fit data to a Two Parameter Pareto Distribution and plot results
    public void paretoTwoParPlot()
    Usage:                      reg.paretoTwoParPlot();
    Performs all that is described above under reg.pareto() and in addition The method paretoPlot() is identical to paretoTwoParPlot() and has been retained to maintain backward compatibility.

    Fit data to the One Parameter Pareto Distribution Function
    public void paretoOnePar()
    Usage:                      reg.paretoOnePar();
    This method fits the data to the One Parameter Pareto distribution function;

    α is the shape parameter and Ao is an ordinate scaling factor. The parameters α and Ao are the parameters to be estimated, i.e. the scale parameter, β has been set to unity. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. See Constructors and the class Stat for details of Pareto statistical methods and for fitting a data set that has first to be binned into a set of observation frequency bins.

    Fit data to a one parameter Pareto Distribution and plot results
    public void paretoOneParPlot()
    Usage:                      reg.paretoOneParPlot();
    Performs all that is described above under reg.paretoOnePar() and in addition Static method
    The static method (fitOneOrSeveralDistribtions(dataArray)) allows the fitting of the data in the double array, dataArray, to a Three Parameter Pareto Distribution, and to other distributions, but with limited output of the best fit details. See below for details.

    Unbinned data
    In addition to the above methods used in combination with the appropriate Constructors or Stat binning methods for unbinned data see also the ProbabilityPlot class methods under Pareto Probability Plots. These methods return best fit estimates of α and β for a two parameter Pareto distribution.



    Fitting data to one or several of the above distributions

    public static void fitOneOrSeveralDistributions(double [] array)
    Usage:                      Regression.fitOneOrSeveralDistributions(array);
    A static method that allows the data passed in the one dimensional array of doubles, array, to be fitted to as many of the following distributions as the user chooses:
    The choice/s are made via a dialog box.
    The method calculates a suggested bin width which may be altered via a dialog box.
    Two plots for each chosen distribution are displayed:
    1. The binned data frequencies with the best fit curve of the chosen distribution;
    2. The binned frequences against the expected frequencies for the chosen distribution.
    The output text file (tab separated variables) lists:
    and for each distribution chosen:



    Fit to Sigmoid Functions

    Fit to a Sigmoidal Threshold Function
    public void sigmoidThreshold()
    Usage:                      reg.sigmoidThreshold();
    This method fits the data to the Sigmoidal Threshold Function:

    where α is the slope parameter, θ is x value (abscissa) at the mid point of the threshold and Ao is an ordinate scaling factor. The slope parameter, α, is related to the maximum gradient at the threshold by the equation

    The parameters α, θ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100.

    Fit data to a Sigmoidal Threshold Function and plot results
    public void sigmoidThresholdPlot()
    Usage:                      reg.sigmoidThresholdPlot();
    Performs all that is described above under reg.sigmoidThreshold()
    and in addition


    Fit to a Hill/Sips Sigmoidal Function
    public void sigmoidHillSips()
    Usage:                      reg.sigmoidHillSips();
    This method fits the data to the Hill/Sips Sigmoidal Function:

    where n is the slope parameter, θ is x value (abscissa) at the mid point of the sigmoid ordinates and Ao is an ordinate scaling factor. The parameters n, θ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100. The slope parameter, n, is related to the maximum gradient at the threshold by the equation

    This is a generalised form of the Hill Equation (protein-ligand interactions) and the Sips Equation (antibody-hapten interactions). If y is equated to the fractional saturation and x is equated to the free ligand/hapten, the Hill/Sips constant, Ka, is equal to θn, the Hill cooperativity index or the Sips heterogeneity index is equal to n and the number of sites is equal to Ao.

    Fit data to a Hill/Sips Sigmoidal Function and plot results
    public void sigmoidHillSipsPlot()
    Usage:                      reg.sigmoidHillSipsPlot();
    Performs all that is described above under reg.sigmoidHillSips()
    and in addition


    Fit to a five parameter logistic curve (5PL)
    See also ImmunoAssay.
    public void fiveParameterLogistic()
    public void fiveParameterLogistic(double bottom, double top)
    Usage:                      reg.fiveParameterLogistic();
    This method fits the data to the five parameter logistic curve:
                 
    The parameters top, bottom, C50, HillSlope and asymm are the parameters to be estimated. A Nelder and Mead Simplex procedure is used.

    Usage:                      reg.fiveParameterLogistic(bottom, top);
    As above for fiveParameterLogistic() with the exception that the parameters, bottom and top, are fixed to the respective argument values, i.e. EC50, HillSlope and asymm are the parameters to be estimated.

    Fit data to a five parameter logistic curve (5PL) and plot results
    See also ImmunoAssay.
    public void fiveParameterLogisticPlot(double bottom, double top)
    Usage:                      reg.fiveParameterLogisticPlot();
    Performs all that is described above under reg.fiveParameterLogistic()
    and in addition Usage:                      reg.fiveParameterLogisticPlot(bottom, top);
    As above for fiveParameterLogisticPlot() with the exception that the parameters, bottom and top, are fixed to the respective argument values, i.e. C50, HillSlope and asymm are the parameters to be estimated.



    Fit to a four parameter logistic curve (4PL, EC50 dose response curve)
    See also ImmunoAssay.
    public void fourParameterLogistic()
    public void ec50()
    public void fourParameterLogisticConstrained()
    public void ec50constrained()
    public void fourParameterLogistic(double bottom, double top)
    public void ec50(double bottom, double top)
    Usage:                      reg.fourParameterLogistic();
    Usage:                      reg.ec50();
    These identical methods fit the data to the four parameter logistic curve (EC50 dose response curve):
                 
    The parameters top, bottom, EC50 and HillSlope are the parameters to be estimated. A Nelder and Mead Simplex procedure is used.

    Usage:                      reg.fourParameterLogisticConstrained();
    Usage:                      reg.ec50constrained();
    As above for fourParameterLogistic() with the exception that the best estimate of the parameter, bottom, is constrained to be either zero or a positive value.

    Usage:                      reg.fourParameterLogistic(bottom, top);
    Usage:                      reg.ec50(bottom, top);
    As above for fourParameterLogistic() with the exception that the parameters, bottom and top, are fixed to the respective argument values, i.e. EC50 and HillSlope are the parameters to be estimated.

    Fit data to a four parameter logistic curve (4PL, EC50 dose response curve) and plot results
    See also ImmunoAssay.
    public void fourParameterLogisticPlot()
    public void ec50Plot()
    public void fourParameterLogisticConstrainedPlot()
    public void ec50constrainedPlot()
    public void fourParameterLogisticPlot(double bottom, double top)
    public void ec50Plot(double bottom, double top)
    Usage:                      reg.fourParameterLogisticPlot();
    Usage:                      reg.ec50Plot();
    Performs all that is described above under reg.fourParameterLogistic() (reg.ec50())
    and in addition Usage:                      reg.ec50constrainedPlot();
    As above for fourParameterLogisticPlot() with the exception that the best estimate of the parameter, bottom, is constrained to be either zero or a positive value.

    Usage:                      reg.fourParameterLogisticPlot(bottom, top);
    Usage:                      reg.ec50plot(bottom, top);
    As above for fourParameterLogisticPlot() with the exception that the parameters, bottom and top, are fixed to the respective argument values, i.e. EC50 and HillSlope are the parameters to be estimated.



    Fit data to a Scaled Heaviside Step Function
    public void stepFunction()
    Usage:                      reg.stepFunction();
    This method fits the data to a Scaled Heaviside Step Function:


    where θ is x value (abscissa) at the mid point of the ordinates and Ao is an ordinate scaling factor. The parameters θ and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100.

    Fit data to a Scaled Heaviside Step Function and plot results
    public void stepFunctionPlot()
    Usage:                      reg.stepFunctionPlot();
    Performs all that is described above under reg.stepFunction()
    and in addition


    Fit data to a Rectangular Hyperbola
    public void rectangularHyperbola()
    public void shiftedRectangularHyperbola()
    Usage:                      reg.rectangularHyperbola();
    This method fits the data to a Rectangular Hyperbola:

    where θ is x value (abscissa) at the mid point of the ordinates and Ao is an ordinate scaling factor. The parameters θ, Ao and are the parameters to be estimated. A Nelder and Mead Simplex procedure is used. See Ordinate Scaling Factor Option (above) for the procedure by which the ordinate scaling factor, Ao, may be set to a fixed value, typically 1 or 100.

    Usage:                      reg.shiftedRectangularHyperbola();
    This method fits the data to a shifted Rectangular Hyperbola:

    The parameters θ, α and Ao are the parameters to be estimated. A Nelder and Mead Simplex procedure is used.

    Fit data to a Rectangular Hyperbola and plot results
    public void rectangularHyperbolaPlot()
    public void shiftedRectangularHyperbolaPlot()
    Usage:                      reg.rectangularHyperbolaPlot();
    Performs all that is described above under reg.rectangularHyperbola()
    and in addition Usage:                      reg.shiftedectangularHyperbolaPlot();
    Performs all that is described above under reg.shiftedRectangularHyperbola()
    and in addition


    COMMON METHODS

    THE INUT DATA OPTIONS
    Set the weighting error type
    public void setErrorsAsScaled()
    Usage:                      reg.setErrorsAsScaled();
    The y measurement errors and the x measurement errors entered via a constructor are used as weights in the weighted regressions and in the calculation of the errors associated with the best estimates of the unknown parameters. They should be estimates of the standard deviation of the corresponding y or x data value. If they are simply entered not as estimates of the standard deviation but as arbitrary weights that are internally consistent, i.e. as scaled estimates of the standard deviations, the regression will be unaffected by the scaling factor but the best estimate standard errors will be calculated incorrectly. If you are entering scaled errors as weights you must call this method. The default method of this class is to assume the entered errors are estimates of the standard deviations. Calling this method overrides this assumpltion. Instead, in the calcultion of the best estimate standard errors, the weights are scaled to approximate to standard deviation estimates, using the variance of the obsesrvation.

    public void setErrorsAsSD()
    Usage:                      reg.setErrorsAsSD();
    This method resets the best estimate error calculation option to the default option, i.e. assuming entered experimental errors are estimates of the standard deviation.

    Set the input data option for data entere as frequencies
    public void setTrueFreq(boolean trueOrfalse)
    Usage:                      reg.setTrueFreq(trueOrFalse);
    If the data are true unscaled frequencies, e.g. in fitting frequency data to a Gaussian, one may set this method's argument [trueOrFalse in the above usage] to true. Chi square will then be calculated as

    and not as

    i.e. the weighting factors are set to the square root of the frequency of observation, i.e. a Poissonian distribution is assumed in the measurement of the frequency of a particular observation. See
    getChiSquare for further details. The default value is false.

    public boolean getTrueFreq()
    Usage:                      opt = reg.getTrueFreq();
    Returns the data input option (see immediately above for details).



    ADD A TITLE TO THE GRAPHS AND OUTPUT FILE
    public void setTitle(String title)
    Usage:                      reg.setTitle(gtitle);
    Adds the String argument gtitle, as a title, to the plots and the output file.



    PRINT THE REGRESSION RESULTS
    public void print( String filename, int prec)
    public void print( String filename)
    public void print(int prec)
    public void print()
    Usage:                      reg.print(filename, prec);
    Outputs a time and date stamped text file, whose name is in the String filename, to which is written: All floating point outputted values have had their mantissae truncted and rounded to prec decimal places. No truncation occurs if a minus value is assigned to prec

    Usage:                      reg.print(filename);
    Outputs a time and date stamped text file, whose name is in the String filename, to which is written the same data has listed above. A default option of 4 decimal places is used in the truncation and rounding method.

    Usage:                      reg.print(prec);
    Outputs a time and date stamped text file, called RegressionOutputN, to which is written the same data has listed above. The file name final integer, N is incremeted by 1 on creating a new file without having deleted the previous one. The argument prec has the same meaning as above.

    Usage:                      reg.print();
    Outputs a time and date stamped text file, called RegressionOutputN, to which is written the same data has listed above. The file name final integer, N is incremeted by 1 on creating a new file without having deleted the previous one. A default option of 4 decimal places is used in the truncation and rounding method.



    SUPPRESS THE PRINTING OF THE REGRESSION RESULTS
    public void suppressPrint()
    Usage:                      reg.suppressPrint();
    Suppresses the automatic printing of the regression results in methods of the general name xxxxPlot(), e.g. linearPlot(), simplexPlot(...)



    PLOT THE REGRESSION RESULTS (x versus y)
    Linear Regression
    public int plotXY( String graphname)
    public int plotXY()
    Usage:                      reg.plotXY(graphname);
    Displays a plot of the x values against the observed y values with the best fit line drawn. The plot has the String graphname as its title. If an attempt is made to plot a multiple linear regression, an error message is displayed and the observed versus calculated y values are plotted instead [see plotYY below]
    Usage:                      reg.plotXY();
    As immediately above [plotXY(graphname)] but no name is given to the graph.

    Non-Linear Regression
    public int plotXY(RegressionFunction rf, String graphname)
    public int plotXY(RegressionFunction2 rf, String graphname)
    public int plotXY(RegressionFunction3 rf, String graphname)
    public int plotXY(RegressionFunction rf)
    public int plotXY(RegressionFunction2 rf)
    public int plotXY(RegressionFunction3 rf)
    Usage:                      reg.plotXY(rf, graphname);
    Displays a plot of the x values against the observed y values with the best fit line drawn, if simplex has been previously called. The plot has the String graphname as its title. For plotting non-linear regression results, the function to which the data has been fitted must be passed as the appropriate Regession Function, rf in the above usage. If an attempt is made to plot a multiple non-linear regression, an error message is displayed; see plotYY below for an alternative plot of y calculated against y observed.
    Usage:                      reg.plotXY(g);
    As immediately above [plotXY(rf, graphname)] but no title name is given to the graph.





    PLOT THE REGRESSION RESULTS (y observed versus y calculated)
    public int plotYY(String graphname)
    public int plotYY()
    Usage:                      reg.plotYY(graphname);
    Displays a plot of the observed y values against the calculated y values. A best fit straight line is drawn through the points. The plot has the String graphname as its title.
    Usage:                      reg.plotYY();
    As immediately above [plotYY(graphname)] but no name is given to the graph.



    SUPPRESS THE PLOT OF y OBSERVED VERSUS y CALCULATED
    public void suppressYYplot()
    Usage:                      reg.suppressYYplot();
    Suppresses the automatic plotting of the observed value of y abgainst the calculated value of y in methods of the general name xxxxPlot(), e.g. linearPlot(), simplexPlot(...)



    ADD LEGENDS TO THE AXES OF THE x VERSUS y PLOTS
    public void setXlegend(String xLegend)
    public void setYlegend(String yLegend)
    Usage:                      reg.setXlegend(xLegend);
    Adds the legend, xLegend, to the x-axis (abscissa) of the x-y plots. The default option is "x axis values".

    Usage:                      reg.setYlegend(yLegend);
    Adds the legend, yLegend, to the y-axis (ordinate) of the x-y plots. The default option is "y axis values".



    RETURN THE BEST ESTIMATES
    public double[] getBestEstimates()
    Usage:                      coeff = reg.getBestEstimates();
    Returns the best estimates of the unknown parameters, a[0], a[1], a[2] . . .



    RETURN THE ERRORS OF THE BEST ESTIMATES
    public double[] getBestEstimatesErrors()
    Usage:                      coeffSd = reg.BestEstimatesErrors();
    Returns the estimates of the errors of the best estimates of the unknown parameters.
    If the regression was a non-linear regression, these have been obtained by obtaining the Hessian matrix, and inverting this to obtain the covariance matrix, from the partial second derivatives of either chi square or the sum of squares with respect to all pairs of estimated parameters calculated as difference equations. As this assumes that the model behaves as a linear model close to the minimum of chi square or the sum of squares, these statistical results, in the case of a non-linear model, should be treated with great caution.



    RETURN THE COEFFICIENTS OF VARIATION
    public double[] getCoeffVar()
    Usage:                      coeffVar = reg.getCoeffVar;
    Returns the coefficients of variation, i.e. the estimated error of each estimated parameter divided by the best estimate expressed as a percentage (multiplied by 100).
    If the regression was a non-linear regression, these have been obtained by first obtaining the Hessian matrix, and inverting this to obtain the covariance matrix, from the partial second derivatives of either chi square or the sum of squares with respect to all pairs of estimated parameters calculated as difference equations. As this assumes that the model behaves as a linear model close to the minimum of chi square or the sum of squares, these statistical results, in the case of a non-linear model, should be treated with great caution.



    RETURN THE t-VALUES OF THE BEST ESTIMATES
    public double[] getTvalues()
    Usage:                      tvalues = reg.getTvalues();
    Returns the the t-values of the best estimates of the unknown parameters, a[0], a[1], a[2] . . .,
    The t-value, t, is defined as
    t = the best estimate divided by its standard error
    and is calculated as
    t = the best estimate divided by the estimate of its error.



    RETURN THE P-VALUES OF THE BEST ESTIMATES
    public double[] getPvalues()
    Usage:                      tvalues = reg.getPvalues();
    Returns the the P-values (P > |t|) of the best estimates of the unknown parameters, a[0], a[1], a[2] . . .
    The P-values are calculated as

    where the t-value, t, is defined immediately above and the definition of the other symbols and details of the calculation of the integral may be found in the Student's t methods documentation in the Stat class.



    RETURN THE CALCULATED y VALUES
    public double[] getYcalc()
    Usage:                      yCalcf = reg.getYcalc();
    Returns the calculated values of the y-value, using the best estimates.



    RETURN THE WEIGHTS
    public double[] getWeights()
    Usage:                      weights = reg.getWeights();
    Returns the current values of the weights. If the weights were entered simply as y measurement errors these, or their scaled values if method serErrorsAsScaled() has been called, will be returned. If they were entered as both x and y measurements the propagated errors used as weights will be returned.



    RETURN THE UNWEIGHTED RESIDUALS
    public double[] getResiduals()
    Usage:                      resid = reg.getResiduals();
    Returns the unweighted residuals, y(observed) - y(calculated using the best estimates).



    RETURN THE WEIGHTED RESIDUALS
    public double[] getWeightedResiduals()
    Usage:                      residW = reg.getWeightedResiduals();
    Returns the weighted residuals, (y(observed) - y(calculated))/(weighting factor).



    RETURN THE SUM OF SQUARES OF THE UNWEIGHTED RESIDUALS
    public double getSumOfSquares()
    public double getSumOfUnweightedResidualSquares()
    Usage:                      ss = reg.getSumOfSquares();
                                      ss = reg.getSumOfUnweightedResidualSquares();
    Returns the sum of the squares, ss:

    where the array observed contains the experimental y values and array calculated contains the y values calculated using the best estimates, for all data points, n.
    The two methods are identical in fuction.



    RETURN THE SUM OF SQUARES OF THE WEIGHTED RESIDUALS
    public double getChiSquare()
    public double getSumOfWeightedResidualSquares()
    Usage:                      chi = reg.getChiSquare();
                                      ss = reg.getSumOfWeightedResidualSquares();
    Returns the weighted sum of the squares, ss:

    for all n data points, i.e. an estimate of Chi Square:

    where the array observed holds the experimental y values, the array calculated holds the y values calculated using the parameter best estimates, weight holds the supplied weighting factors whose squares, ideally, should be the variances of the experimental data points.
    If the data is a distrubution of unscaled frequency measurements (see setTrueFreq), chi square is then calculated as

    where the array observedFreq holds the observed frequency of a values occuring with the ith bin, the array expectedFreq holds the corresponding expected frequency values, where the expected frequency as been equated to the calculated y values.
    If the data is unweighted the sum of squares of the unweighted residuals is returned.
    The two methods are identical in fuction.



    RETURN THE REDUCED CHI SQUARE
    public double getReducedChiSquare()
    Usage:                      redChi = reg.getReducedChiSquare();
    Returns an estimate of the reduced chi square, i.e. the chi square divided by the degrees of freedom, calculated using the best estimates for weighted data. The chi square is calculated as described above under getChiSquare().
    If the data is unweighted the reduced sum of unweighted residuals is returned.



    RETURN THE TOTAL SUM OF WEIGHTED SQUARES
    public double getTotalSumOfWeightedSquares()
    Usage:                      ss = reg.getTotalSumOfWeightedSquares();
    Returns the total sum of the squares, ss:

    for all data points, calculated using the best estimates.
    If no weights, w, have been entered the weights are set to unity.



    RETURN THE REGRESSION SUM OF WEIGHTED SQUARES
    public double getRegrnSumOfWeightedSquares()
    Usage:                      ss = reg.getRegrnSumOfWeightedSquares();
    Returns the regression sum of the squares, ss:

    for all data points, calculated using the best estimates.
    If no weights have been entered the weights are set to unity.



    RETURN THE LINEAR CORRELATION COEFFICIENT
    public double getYYcorrCoeff()
    public double getXYcorrCoeff()
    Usage:                      corrR = reg.getYYcorrCoeff();
    Returns the linear correlation coefficient for the experimental y-data and the calculated y-data.

    Usage:                      corrR = reg.getXYcorrCoeff();
    Returns the linear correlation coefficient for the experimental x and the experimental y data. This is only calculated if there is a single array of x-data and a single array of y-data, otherwise NaN is returned.



    RETURN THE COEFFICIENT OF DETERMINATION
    public double getCoefficientOfDetermination()
    Usage:                      codR = reg.getCoefficientOfDetermination();
    Returns the coefficient of determination, R2:

    The error sum of squares is an alternative name for the sum of squares of the residuals.
    The sum of squares are weighted if weights have been entered.



    RETURN THE ADJUSTED COEFFICIENT OF DETERMINATION
    public double getCoefficientOfDetermination()
    Usage:                      adjR = reg.getAdjustedCoefficientOfDetermination();
    Returns the adjusted coefficient of determination, R2adj:

    R2 is calculated as described immediately above, n is the number of data points and p is the number of parameters.



    RETURN THE COEFFICIENT OF DETERMINATION F-RATIO
    public double getCoeffDeterminationFratio()
    Usage:                      codF = reg.getCoeffDeterminationFratio();
    Returns the F-ratio, F:

    R2 is calculted as described above, n is the number of data points and p is the number of parameters.



    RETURN THE COEFFICIENT OF DETERMINATION F-RATIO PROBABILTY
    public double getCoeffDeterminationFratioProb()
    Usage:                      codP = reg.getCoeffDeterminationFratioProb();
    Returns the F-ratio probabilty, P(F), for the above calculated F-ratio, for degrees of freedom, number of unknown parameters and number of data points - number of unknown parametrs - 1.
    See F-distribution for details of F-ratio probability calculations.



    RETURN THE DEGREES OF FREEDOM
    public int getDegFree()
    Usage:                      df = reg.getDegFree();
    Returns the degrees of freedom, i.e. number of data points - number of estimated parameters



    THE COVARIANCE MATRIX
    The returned covariance matrix is a true variance-covariance matrix for all linear regressions. It is a pseudo-linear approximation for all non-linear regressions obtained from the inverse of the Hessian matrix in which the second partial differentials are calculated numerically.

    Return the Covariance Matrix
    public double[][] getCovMatrix()
    Usage:                      cov = reg.getCovMatrix();
    Returns the variance-covariance matrix (covariance matrix).
    If the regression was a non-linear regression, the covariance matrix has been obtained from the inverse of the Hessian matrix in which the partial second derivatives of either chi square or the sum of squares with respect to all pairs of estimated parameters were calculated as difference equations. As this procedure assumes that the model behaves as a linear model close to the minimum of chi square or the sum of squares, the statistical analysis, in the case of a non-linear model, should be treated with great caution.

    Set the fractional step size for difference formulae [non-linear regression]
    public void setDelta(double delta)
    Usage:                      reg.setDelta(delta);
    Resets the fractional step size, δ, [delta in the above usage] by which a parameter is incremented or decremented, used in calculating the first and second differentil, by a difference formula, needed to form the Hessian which is inverted to give the linear approximation to a covariance matrix in the nonlinear regression, e.g.

    The default value of δ is 1e-4.

    Get the fractional step size for difference formulae [non-linear regression]
    public doubled getDelta()
    Usage:                      delta = reg.getDelta();
    Returns the fractional step size, δ, by which a parameter is incremented or decremented, used in calculating the first and second differential, by a difference formula [see immediately above], needed to form the Hessian which is inverted to give the linear approximation to a covariance matrix in the nonlinear regression.

    Return the Hessian Matrix Inversion Check [non-linear regression]
    public boolean getInversionCheck()
    Usage:                      flag = reg.getInersionCheck();
    Returns true if the regression is linear or if, in the case of a non-linear regression, inversion of the Hessian Matrix, to obtain the Covariance Matrix, was successful. Returns false if the latter inversion failed.

    Return the Covariance Matrix Diagonal Check [non-linear regression]
    public boolean getPosVarCheck()
    Usage:                      flag = reg.getPosVarCheck();
    Returns true if the regression is linear or if, in the case of a non-linear regression, all diagonal elements of the Covariance Matrix, i.e. the variances, are positive. Returns false if any are negative.



    RETURN THE PARAMETER CORRELATION COEFFICIENTS
    public double[][] getCorrCoeffMatrix()
    Usage:                      cov = reg.getCorrCoeffMatrix();
    Returns the matrix of sample correlation coefficients between the estimated parameters.
    If the regression was a non-linear regression, these have been obtained by first obtaining the Hessian matrix, and inverting this to obtain the covariance matrix, from the partial second derivatives of either chi square or the sum of squares with respect to all pairs of estimated parameters calculated as difference equations. As this assumes that the model behaves as a linear model close to the minimum of chi square or the sum of squares, these statistical results, in the case of a non-linear model, should be treated with great caution.



    RETURN THE DURBIN-WATSON d STATISTIC
    public double[] getDurbinWatsonD()
    Usage:                      dwd = reg.getDurbinWatsonD();
    Returns the Durbin-Watson d statistic, used to detect the presence of autocorrelation,

    where ei is the ith unweighted residual, y(experimental) - y(calculated using the best estimates), and n is the number of data points.



    CHECK NORMALITY OF THE RESIDUALS
    public void[] checkResidualNormality()
    Usage:                      reg.checkResidualNormality();
    Pereforms a check of departure from normality in the distribution of the residuals as described under the method fullAnalysis in the Normality class.

    public void[] checkWeightedResidualNormality()
    Usage:                      reg.checkWeightedResidualNormality();
    Pereforms a check of departure from normality in the distribution of the weighted residuals as described under the method fullAnalysis in the Normality class.



    TEST OF ADDITIONAL TERMS [EXTRA SUM OF SQUARES TEST]
    public static ArrayList<Object> testOfAdditionalTerms(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints, double significanceLevel)
    public static ArrayList<Object> testOfAdditionalTerms(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)
    public static ArrayList<Object> testOfAdditionalTerms_ArrayList(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints, double significanceLevel)
    public static ArrayList<Object> testOfAdditionalTerms_ArrayList(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)

    Usage:                      ArrayList<Object> arrayl = Regression.testOfAdditionalTerms(chiSquareR, nParametersR, chiSquareF, nParametersF, nPoints, significanceLevel);
    Usage:                      ArrayList<Object> arrayl = Regression.testOfAdditionalTerms(chiSquareR, nParametersR, chiSquareF, nParametersF, nPoints);

    Usage:                      ArrayList<Object> arrayl = Regression.testOfAdditionalTerms_ArrayList(chiSquareR, nParametersR, chiSquareF, nParametersF, nPoints, significanceLevel);
    Usage:                      ArrayList<Object> arrayl = Regression.testOfAdditionalTerms_ArrayList(chiSquareR, nParametersR, chiSquareF, nParametersF, nPoints);

    This method allows the user to test which of two models provides the best fit to the same set of data. The argument chiSquareR is the chi-square value obtained for a regression to the model with the fewer parameters, i.e. the reduced model, and nParametersR is the number of parameters in this reduced model. The argument chiSquareF is the chi-square value obtained for a regression to the model with the additional parameters, i.e. the fuller model, and nParametersF is the number of parameters in this fuller model. The argument nPoints is the number of data points. If the chi-squared values are not available, i.e. the regressions were not weighted, the chi-square values may be replaced by the relevant sums of squares of the residuals. The optional argument, significanceLevel, is the significance level at which the F-ratio needed for the comparison is calculated. If this argument is not entered a default value of 0.05 (5%) is used.
    The methods Regression.testOfAdditionalTerms and Regression.testOfAdditionalTerms_ArrayList perform the same functions.

    The elements of the returned ArrayList arrayl are:
    public static double testOfAdditionalTermsFratio(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)
    Usage:                      fRatio = Regression.testOfAdditionalTermsFratio(chiSquareR, nParametersR, chiSquareF, nParametersF, nPoints);
    This method also allows the user to test which of two models provides the best fit to the same set of data. The argument chiSquareR is the chi-square value obtained for a regression to the model with the fewer parameters, i.e. the reduced model, and nParametersR is the number of parameters in this reduced model. The argument chiSquareF is the chi-square value obtained for a regression to the model with the additional parameters, i.e. the fuller model, and nParametersF is the number of parameters in this fuller model. The argument nPoints is the number of data points. If the chi-squared values are not available, i.e. the regressions were not weighted, the chi-square values may be replaced by the relevant sums of squares of the residuals.

    This method returns only the F-ratio, as a double primitive variable (symbols as above):

    for a comparison of weighted regressions
    or

    for a comparison of unweighted regressions (extra sum of squares test)

    public static double testOfAdditionalTermsFprobability(double chiSquare1, int nParameters1, double chiSquare2, int nParameters2, int nPoints)
    Usage:                      fProb = Regression.testOfAdditionalTermsFprobablity(chiSquareR, nParametersR, chiSquareF, nParametersF, nPoints);
    This method also allows the user to test which of two models provides the best fit to the same set of data. The argument chiSquareR is the chi-square value obtained for a regression to the model with the fewer parameters, i.e. the reduced model, and nParametersR is the number of parameters in this reduced model. The argument chiSquareF is the chi-square value obtained for a regression to the model with the additional parameters, i.e. the fuller model, and nParametersF is the number of parameters in this fuller model. The argument nPoints is the number of data points. If the chi-squared values are not available, i.e. the regressions were not weighted, the chi-square values may be replaced by the relevant sums of squares of the residuals.

    This method returns only the F-distribution probabilty, as a double primitive variable (symbols as above):
    PF(F; nfuller - nreduced, Ndata - nfuller)



    SETTING THE DENOMINATOR IN STATISTICAL FORMULAE
    public static void setDenominatorToN()
    Usage:                      Regression.setDenominatorToN();
    Sets the denominator of the variance, covariance or standard deviation to the number of data points, n, e.g.

    The default value is (n − 1) unless this has been reset by the Stat class static method, setStaticDenominatorToN().

    public static void setDenominatorToNminusOne()
    Usage:                      Regression.setDenominatorToNminusOne();
    Sets the denominator of the variance, covariance or standard deviation to the number of data points minus one, (n − 1), e.g.

    The is the default value and this method need only be called if the above method (set to n) or the Stat class static method, setStaticDenominatorToN(), has already been called and a reset to (n − 1) is required.



    RESET THE Stat CLASS CONTINUED FRACTION CALCULATION PARAMETERS
    The Stat class regularised incomplete beta function evaluation is called by the Regression class statistical analyses, e.g. in the calculation of p-values. The Stat class regularised incomplete beta function, in turn, calls the Stat contFract method which evaluates a relevant continued fraction. These methods allow the user to reset the default values of the tolerance and maximum number of iterations used in terminating the continued fraction evaluation. These need only be called if there is an indication that the default values may not be appropriate, e.g. via a Stat class warning message.

    public static void resetCFmaxIter(int maxit)
    Usage:                      Regression.resetCFmaxIter(maxit);
    Resets the value of the maximum number of iterations, maxit, allowed in the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularised incomplete beta function (Stat class). The default value is 500.

    public static int getCFmaxIter()
    Usage:                      maxit = Regression.getCFmaxIter();
    Returns the value of the maximum number of iterations, maxit, allowed in the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularised incomplete beta function (Stat class). The default value is 500.

    public static void resetCFtolerance(double tolerance)
    Usage:                      Regression.resetCFtolerance(tolerance);
    Resets the value of the tolerance, tolerance, used to terminate the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularised incomplete beta function (Stat class).The default value is 1.0x10-8.

    public static double getCFtolerance()
    Usage:                      tolerance = Regression.getCFtolerance();
    Returns the value of the tolerance, tolerance, used to terminate the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularised incomplete beta function (Stat class).The default value is 1.0x10-8.




    EXAMPLE PROGAMS



    OTHER CLASSES USED BY THIS CLASS

    This class uses the following classes in this library:



    PERMISSION TO USE

    Permission to use, copy and modify this software and its documentation for NON-COMMERCIAL purposes is granted, without fee, provided that an acknowledgement to the author, Dr Michael Thomas Flanagan at www.ee.ucl.ac.uk/~mflanaga, appears in all copies and associated documentation or publications.

    Public listing of the source codes on the internet is not permitted.

    Redistribution of the source codes or of the flanagan.jar file is not permitted.

    Redistribution in binary form of all or parts of these classes is not permitted.

    Dr Michael Thomas Flanagan makes no representations about the suitability or fitness of the software for any or for a particular purpose. Dr Michael Thomas Flanagan shall not be liable for any damages suffered as a result of using, modifying or distributing this software or its derivatives.



    This page was prepared by Dr Michael Thomas Flanagan