Class NonLinearRegressionFitter


  • public class NonLinearRegressionFitter
    extends java.lang.Object
    Non-linear regression class Nelder & Mead simplex algorithm being the primary back-bone of this implementation initial implementation based on the package provided by: Michael Thomas Flanagan at www.ee.ucl.ac.uk/~mflanaga The code has been cleaned up and adapted to further support multi-dimensional fits
    Author:
    rstein
    • Constructor Summary

      Constructors 
      Constructor Description
      NonLinearRegressionFitter​(double[][] xData, double[] yData)
      Constructor with data with x as 2D array and no weights provided
      NonLinearRegressionFitter​(double[][] xxData, double[][] yyData)
      Constructor with data with x and y as 2D arrays and no weights provided
      NonLinearRegressionFitter​(double[][] xxData, double[][] yyData, double[][] wWeight)
      Constructor with data with x and y as 2D arrays and weights provided
      NonLinearRegressionFitter​(double[][] xData, double[] yData, double[] weight)
      Constructor with data with x as 2D array and weights provided
      NonLinearRegressionFitter​(double[] xxData, double[] yData)
      Constructor with data with x as 1D array and no weights provided
      NonLinearRegressionFitter​(double[] xxData, double[][] yyData)
      Constructor with data with x as 1D array and y as a 2D array and no weights provided
      NonLinearRegressionFitter​(double[] xxData, double[][] yyData, double[][] wWeight)
      Constructor with data with x as 1D array and y as 2D array and weights provided
      NonLinearRegressionFitter​(double[] xxData, double[] yData, double[] weight)
      Constructor with data with x as 1D array and weights provided
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addConstraint​(int[] paramIndices, double[] plusOrMinus, int conDir, double constraint)
      add a multiple parameter constraint boundary for the non-linear regression
      void addConstraint​(int[] paramIndices, int[] plusOrMinus, int conDir, double constraint)
      add a multiple parameter constraint boundary for the non-linear regression
      void addConstraint​(int paramIndex, int conDir, double constraint)
      add a single parameter constraint boundary for the non-linear regression
      protected double[] checkForZeroWeights​(double[] weight)
      Check entered weights for zeros.
      double checkYallSmall​(double yPeak, java.lang.String ss)
      check y values for all y are very small value
      void checkZeroNeg​(double[] xx, double[] yy, double[] ww)
      check for zero and negative values
      protected static java.util.ArrayList<java.lang.Object> dataSign​(double[] data)
      Deprecated.
      replace with optimised routines
      void enterData​(double[][] xData, double[] yData)
      Enter data with x as 2D array and no weights provided
      void enterData​(double[][] xxData, double[][] yyData)
      Enter data with x and y as 2D arrays and no weights provided
      void enterData​(double[][] xxData, double[][] yyData, double[][] wWeight)
      data entry, all 2D arrays
      void enterData​(double[][] xData, double[] yData, double[] weight)
      Enter data methods
      void enterData​(double[] xxData, double[] yData)
      Enter data with x as 1D array and no weights provided
      void enterData​(double[] xxData, double[][] yyData)
      Enter data with x as 1D array and y as a 2D array and no weights provided
      void enterData​(double[] xxData, double[][] yyData, double[][] wWeight)
      Enter data
      void enterData​(double[] xxData, double[] yData, double[] weight)
      Enter data as 1D arrays
      protected void generalLinearStats​(double[][] xd)
      Generalised linear regression statistics (protected method called by linear(), linearGeneral() and polynomial())
      double getAdjustedR()
      Get the Adjusted Sample Correlation Coefficient
      double getAdjustedR2()
      Get the Adjusted Sample Correlation Coefficient Squared
      double[] getBestEstimates()
      Get the best estimates of the unknown parameters
      double[] getBestEstimatesErrors()
      Get the estimates of the errors of the best estimates of the unknown parameters
      double[] getBestEstimatesStandardDeviations()
      Get the estimates of the standard deviations of the best estimates of the unknown parameters
      double getChiSquare()
      Get the chi square estimate
      double getchiSquareProb()
      Get the chi square probablity
      double[] getCoeff()
      Get the best estimates of the unknown parameters
      double[] getCoeffSd()
      Get the estimates of the errors of the best estimates of the unknown parameters
      double[] getCoeffVar()
      Get the cofficients of variations of the best estimates of the unknown parameters
      double[][] getCorrCoeffMatrix()
      Get the correlation coefficient matrix
      double[][] getCovMatrix()
      Get the covariance matrix
      double getDegFree()
      Get the degrees of freedom
      double getDelta()
      Get the non-linear regression fractional step size used in numerical differencing
      double[][] getGrad()
      Get the non-linear regression pre and post minimum gradients
      boolean getInversionCheck()
      Get the non-linear regression statistics Hessian matrix inversion status flag
      int getMinTest()
      Get the non-linear regression convergence test option
      double getMultipleF()
      Get the Multiple Correlation Coefficient F ratio
      int getNiter()
      Get the number of iterations in nonlinear regression
      boolean getNlrStatus()
      Get the non-linear regression status true if convergence was achieved false if convergence not achieved before maximum number of iterations current values then returned
      int getNmax()
      Get the maximum number of iterations allowed in nonlinear regression
      double getNMcontract()
      Get the Nelder and Mead contraction coefficient [gamma]
      double getNMextend()
      Get the Nelder and Mead extension coefficient [beta]
      double getNMreflect()
      Get the Nelder and Mead reflection coefficient [alpha]
      int getNrestarts()
      Get the number of restarts in nonlinear regression
      int getNrestartsMax()
      Get the maximum number of restarts allowed in nonlinear regression
      boolean getPosVarCheck()
      Get the non-linear regression statistics Hessian matrix inverse diagonal status flag
      double[] getPseudoErrors()
      Get the pseudo-estimates of the errors of the best estimates of the unknown parameters
      double[] getPseudoSd()
      Get the pseudo-estimates of the errors of the best estimates of the unknown parameters
      double[] getPvalues()
      Get the p-values of the best estimates
      double getReducedChiSquare()
      Get the reduced chi square estimate
      double[] getResiduals()
      Get the unweighed residuals, y(experimental) - y(calculated)
      double getSampleR()
      Get the Sample Correlation Coefficient
      double getSampleR2()
      Get the Sample Correlation Coefficient Squared
      double[] getScale()  
      double getSimplexSd()
      Get the simplex sd at the minimum
      double getSumOfSquares()
      Get the unweighed sum of squares of the residuals
      double getTolerance()
      Get the non-linear regression tolerance
      boolean getTrueFreq()
      Get the true frequency test, trueFreq
      double[] getTvalues()
      Get the t-values of the best estimates
      double[] getWeightedResiduals()
      Get the weighted residuals, (y(experimental) - y(calculated))/weight
      double[][] getXdata()
      Get the input x values
      double[] getYcalc()
      Get the calculated y values
      double[] getYdata()
      Get the input y values
      protected static double halfWidth​(double[] xData, double[] yData)
      returns estimate of half-height width
      void ignoreDofFcheck()
      Ignore check on whether degrees of freedom are greater than zero
      boolean infinityCheck​(double yPeak, int peaki)
      Check for y value = infinity
      protected void multCorrelCoeff​(double[] yy, double[] yyCalc, double[] ww)
      Calculate the multiple correlation coefficient
      protected void nelderMead​(java.lang.Object regFun, double[] start, double[] step, double fTol, int nMax)
      Nelder and Mead Simplex Simplex Non-linear Regression
      protected int pseudoLinearStats​(java.lang.Object regFun)
      apply linear statistics to a non-linear regression
      void removeConstraints()
      remove all constraint boundaries for the non-linear regression
      void setConstraintTolerance​(double tolerance)
      Reset the tolerance used in a fixed value constraint
      protected void setDefaultValues​(double[][] xData, double[] yData, double[] weight)
      Set data and default values
      void setDelta​(double delta)
      Set the non-linear regression fractional step size used in numerical differencing
      void setMinTest​(int n)
      Reset the non-linear regression convergence test option
      void setNmax​(int nmax)
      Set the maximum number of iterations allowed in nonlinear regression
      void setNMcontract​(double con)
      Reset the Nelder and Mead contraction coefficient [gamma]
      void setNMextend​(double ext)
      Reset the Nelder and Mead extension coefficient [beta]
      void setNMreflect​(double refl)
      Reset the Nelder and Mead reflection coefficient [alpha]
      void setNrestartsMax​(int nrs)  
      void setScale​(double[] sc)
      Reset scaling factors (scaleOpt 2, see above for scaleOpt 0 and 1)
      void setScale​(int n)
      Reset scaling factors (scaleOpt 0 and 1, see below for scaleOpt 2)
      void setTolerance​(double tol)
      Set the non-linear regression tolerance
      void setTrueFreq​(boolean trFr)
      Reset the true frequency test, trueFreq true if yData values are true frequencies, e.g.
      protected static boolean setTrueFreqWeights​(double[] yData, double[] weight)  
      void simplex​(Function1D g, double[] start)
      Nelder and Mead simplex Default tolerance Default maximum iterations Default step option - all step[i] = dStep
      void simplex​(Function1D g, double[] start, double fTol)
      Nelder and Mead simplex Default maximum iterations Default step option - all step[i] = dStep
      void simplex​(Function1D g, double[] start, double[] step)
      Nelder and Mead simplex
      void simplex​(Function1D g, double[] start, double[] step, double fTol)
      Nelder and Mead simplex Default maximum iterations
      void simplex​(Function1D g, double[] start, double[] step, double fTol, int nMax)
      Nelder and Mead Simplex Simplex Non-linear Regression
      void simplex​(Function1D g, double[] start, double[] step, int nMax)
      Nelder and Mead simplex Default tolerance
      void simplex​(Function1D g, double[] start, double fTol, int nMax)
      Nelder and Mead simplex Default step option - all step[i] = dStep
      void simplex​(Function1D g, double[] start, int nMax)
      Nelder and Mead simplex Default tolerance Default step option - all step[i] = dStep
      void simplex2​(FunctionND g, double[] start)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      void simplex2​(FunctionND g, double[] start, double fTol)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      void simplex2​(FunctionND g, double[] start, double[] step)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      void simplex2​(FunctionND g, double[] start, double[] step, double fTol)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      void simplex2​(FunctionND g, double[] start, double[] step, double fTol, int nMax)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      void simplex2​(FunctionND g, double[] start, double[] step, int nMax)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      void simplex2​(FunctionND g, double[] start, double fTol, int nMax)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      void simplex2​(FunctionND g, double[] start, int nMax)
      Deprecated.
      do not use yet in a production environment, needs some clean-up
      protected static void sort​(double[] x, double[] y, double[] w)
      sort elements x, y and w arrays of doubles into ascending order of the x array using selection sort method
      protected double sumSquares​(java.lang.Object regFun, double[] testParameter)
      Calculate the sum of squares of the residuals for non-linear regression
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • histTol

        protected static double histTol
      • nData0

        protected int nData0
      • nData

        protected int nData
      • nXarrays

        protected int nXarrays
      • nYarrays

        protected int nYarrays
      • nTerms

        protected int nTerms
      • degreesOfFreedom

        protected int degreesOfFreedom
      • xData

        protected double[][] xData
      • yData

        protected double[] yData
      • yCalc

        protected double[] yCalc
      • weight

        protected double[] weight
      • residual

        protected double[] residual
      • residualW

        protected double[] residualW
      • weightOpt

        protected boolean weightOpt
      • weightFlag

        protected int weightFlag
      • best

        protected double[] best
      • bestSd

        protected double[] bestSd
      • pseudoSd

        protected double[] pseudoSd
      • tValues

        protected double[] tValues
      • pValues

        protected double[] pValues
      • chiSquare

        protected double chiSquare
      • reducedChiSquare

        protected double reducedChiSquare
      • sumOfSquares

        protected double sumOfSquares
      • lastSSnoConstraint

        protected double lastSSnoConstraint
      • covar

        protected double[][] covar
      • corrCoeff

        protected double[][] corrCoeff
      • sampleR

        protected double sampleR
      • sampleR2

        protected double sampleR2
      • adjustedR

        protected double adjustedR
      • adjustedR2

        protected double adjustedR2
      • multipleF

        protected double multipleF
      • adjustedF

        protected double adjustedF
      • linNonLin

        protected boolean linNonLin
      • trueFreq

        protected boolean trueFreq
      • nlrStatus

        protected boolean nlrStatus
      • scaleOpt

        protected int scaleOpt
      • fscale

        protected double[] fscale
      • zeroCheck

        protected boolean zeroCheck
      • penalty

        protected boolean penalty
      • sumPenalty

        protected boolean sumPenalty
      • nConstraints

        protected int nConstraints
      • nSumConstraints

        protected int nSumConstraints
      • maxConstraintIndex

        protected int maxConstraintIndex
      • constraintTolerance

        protected double constraintTolerance
      • penalties

        protected java.util.ArrayList<java.lang.Object> penalties
      • sumPenalties

        protected java.util.ArrayList<java.lang.Object> sumPenalties
      • penaltyCheck

        protected int[] penaltyCheck
      • sumPenaltyCheck

        protected int[] sumPenaltyCheck
      • penaltyWeight

        protected double penaltyWeight
      • penaltyParam

        protected int[] penaltyParam
      • sumPenaltyParam

        protected int[][] sumPenaltyParam
      • sumPlusOrMinus

        protected double[][] sumPlusOrMinus
      • sumPenaltyNumber

        protected int[] sumPenaltyNumber
      • constraints

        protected double[] constraints
      • sumConstraints

        protected double[] sumConstraints
      • constraintMethod

        protected int constraintMethod
      • nMax

        protected int nMax
      • nIter

        protected int nIter
      • konvge

        protected int konvge
      • kRestart

        protected int kRestart
      • fMin

        protected double fMin
      • fTol

        protected double fTol
      • rCoeff

        protected double rCoeff
      • eCoeff

        protected double eCoeff
      • cCoeff

        protected double cCoeff
      • startH

        protected double[] startH
      • step

        protected double[] step
      • dStep

        protected double dStep
      • grad

        protected double[][] grad
      • delta

        protected double delta
      • invertFlag

        protected boolean invertFlag
      • posVarFlag

        protected boolean posVarFlag
      • minTest

        protected int minTest
      • simplexSd

        protected double simplexSd
      • statFlag

        protected boolean statFlag
      • multipleY

        protected boolean multipleY
      • values

        protected double[] values
      • fixed

        protected boolean[] fixed
      • ignoreDofFcheck

        protected boolean ignoreDofFcheck
      • nFactorOption

        protected boolean nFactorOption
    • Constructor Detail

      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[] xxData,
                                         double[] yData)
        Constructor with data with x as 1D array and no weights provided
        Parameters:
        xxData - ???
        yData - ???
      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[] xxData,
                                         double[] yData,
                                         double[] weight)
        Constructor with data with x as 1D array and weights provided
        Parameters:
        xxData - ???
        yData - ???
        weight - ???
      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[] xxData,
                                         double[][] yyData)
        Constructor with data with x as 1D array and y as a 2D array and no weights provided
        Parameters:
        xxData - ???
        yyData - ???
      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[] xxData,
                                         double[][] yyData,
                                         double[][] wWeight)
        Constructor with data with x as 1D array and y as 2D array and weights provided
        Parameters:
        xxData - ???
        yyData - ???
        wWeight - ???
      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[][] xData,
                                         double[] yData)
        Constructor with data with x as 2D array and no weights provided
        Parameters:
        xData - ???
        yData - ???
      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[][] xData,
                                         double[] yData,
                                         double[] weight)
        Constructor with data with x as 2D array and weights provided
        Parameters:
        xData - ???
        yData - ???
        weight - ???
      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[][] xxData,
                                         double[][] yyData)
        Constructor with data with x and y as 2D arrays and no weights provided
        Parameters:
        xxData - ???
        yyData - ???
      • NonLinearRegressionFitter

        public NonLinearRegressionFitter​(double[][] xxData,
                                         double[][] yyData,
                                         double[][] wWeight)
        Constructor with data with x and y as 2D arrays and weights provided
        Parameters:
        xxData - ???
        yyData - ???
        wWeight - ???
    • Method Detail

      • addConstraint

        public void addConstraint​(int paramIndex,
                                  int conDir,
                                  double constraint)
        add a single parameter constraint boundary for the non-linear regression
        Parameters:
        paramIndex - parameter index
        conDir - ???
        constraint - ???
      • addConstraint

        public void addConstraint​(int[] paramIndices,
                                  double[] plusOrMinus,
                                  int conDir,
                                  double constraint)
        add a multiple parameter constraint boundary for the non-linear regression
        Parameters:
        paramIndices - parameter indices
        plusOrMinus - positive/negative range constraint
        conDir - direction of fit constraint
        constraint - ???
      • addConstraint

        public void addConstraint​(int[] paramIndices,
                                  int[] plusOrMinus,
                                  int conDir,
                                  double constraint)
        add a multiple parameter constraint boundary for the non-linear regression
        Parameters:
        paramIndices - parameter indices
        plusOrMinus - positive/negative range constraint
        conDir - direction of fit constraint
        constraint - ???
      • checkForZeroWeights

        protected double[] checkForZeroWeights​(double[] weight)
        Check entered weights for zeros. If more than 40% are zero or less than zero, all weights replaced by unity If less than 40% are zero or less than zero, the zero or negative weights are replaced by the average of their nearest neighbours
        Parameters:
        weight - weight vector
        Returns:
        conditioned vector
      • checkYallSmall

        public double checkYallSmall​(double yPeak,
                                     java.lang.String ss)
        check y values for all y are very small value
        Parameters:
        yPeak - ???
        ss - ???
        Returns:
        true: if a very small value has been removed
      • checkZeroNeg

        public void checkZeroNeg​(double[] xx,
                                 double[] yy,
                                 double[] ww)
        check for zero and negative values
        Parameters:
        xx - ???
        yy - ???
        ww - ???
      • enterData

        public void enterData​(double[] xxData,
                              double[] yData)
        Enter data with x as 1D array and no weights provided
        Parameters:
        xxData - ???
        yData - ???
      • enterData

        public void enterData​(double[] xxData,
                              double[] yData,
                              double[] weight)
        Enter data as 1D arrays
        Parameters:
        xxData - ???
        yData - ???
        weight - ???
      • enterData

        public void enterData​(double[] xxData,
                              double[][] yyData)
        Enter data with x as 1D array and y as a 2D array and no weights provided
        Parameters:
        xxData - ???
        yyData - ???
      • enterData

        public void enterData​(double[] xxData,
                              double[][] yyData,
                              double[][] wWeight)
        Enter data
        Parameters:
        xxData - 1D array
        yyData - 2D array
        wWeight - ???
      • enterData

        public void enterData​(double[][] xData,
                              double[] yData)
        Enter data with x as 2D array and no weights provided
        Parameters:
        xData - ???
        yData - ???
      • enterData

        public void enterData​(double[][] xData,
                              double[] yData,
                              double[] weight)
        Enter data methods
        Parameters:
        xData - 2D array
        yData - 1D array
        weight - 1D array
      • enterData

        public void enterData​(double[][] xxData,
                              double[][] yyData)
        Enter data with x and y as 2D arrays and no weights provided
        Parameters:
        xxData - ???
        yyData - ???
      • enterData

        public void enterData​(double[][] xxData,
                              double[][] yyData,
                              double[][] wWeight)
        data entry, all 2D arrays
        Parameters:
        xxData - ???
        yyData - ???
        wWeight - ???
      • generalLinearStats

        protected void generalLinearStats​(double[][] xd)
        Generalised linear regression statistics (protected method called by linear(), linearGeneral() and polynomial())
        Parameters:
        xd - ???
      • getAdjustedR

        public double getAdjustedR()
        Get the Adjusted Sample Correlation Coefficient
        Returns:
        Adjusted Sample Correlation Coefficient
      • getAdjustedR2

        public double getAdjustedR2()
        Get the Adjusted Sample Correlation Coefficient Squared
        Returns:
        Adjusted Sample Correlation Coefficient Squared
      • getBestEstimates

        public double[] getBestEstimates()
        Get the best estimates of the unknown parameters
        Returns:
        best estimates of the unknown parameters
      • getBestEstimatesErrors

        public double[] getBestEstimatesErrors()
        Get the estimates of the errors of the best estimates of the unknown parameters
        Returns:
        estimates of the errors of the best estimates
      • getBestEstimatesStandardDeviations

        public double[] getBestEstimatesStandardDeviations()
        Get the estimates of the standard deviations of the best estimates of the unknown parameters
        Returns:
        estimates of the standard deviations
      • getChiSquare

        public double getChiSquare()
        Get the chi square estimate
        Returns:
        chi square estimate
      • getchiSquareProb

        public double getchiSquareProb()
        Get the chi square probablity
        Returns:
        chi square probablity
      • getCoeff

        public double[] getCoeff()
        Get the best estimates of the unknown parameters
        Returns:
        estimates of the unknown parameters
      • getCoeffSd

        public double[] getCoeffSd()
        Get the estimates of the errors of the best estimates of the unknown parameters
        Returns:
        estimates of the errors of the best estimates
      • getCoeffVar

        public double[] getCoeffVar()
        Get the cofficients of variations of the best estimates of the unknown parameters
        Returns:
        cofficients of variations of the best estimates
      • getCorrCoeffMatrix

        public double[][] getCorrCoeffMatrix()
        Get the correlation coefficient matrix
        Returns:
        correlation coefficient matrix
      • getCovMatrix

        public double[][] getCovMatrix()
        Get the covariance matrix
        Returns:
        covariance matrix
      • getDegFree

        public double getDegFree()
        Get the degrees of freedom
        Returns:
        degrees of freedom
      • getDelta

        public double getDelta()
        Get the non-linear regression fractional step size used in numerical differencing
        Returns:
        non-linear regression fractional step size used in numerical differencing
      • getGrad

        public double[][] getGrad()
        Get the non-linear regression pre and post minimum gradients
        Returns:
        non-linear regression pre and post minimum gradients
      • getInversionCheck

        public boolean getInversionCheck()
        Get the non-linear regression statistics Hessian matrix inversion status flag
        Returns:
        non-linear regression statistics Hessian matrix inversion status flag
      • getMinTest

        public int getMinTest()
        Get the non-linear regression convergence test option
        Returns:
        non-linear regression convergence test option
      • getMultipleF

        public double getMultipleF()
        Get the Multiple Correlation Coefficient F ratio
        Returns:
        Multiple Correlation Coefficient F ratio
      • getNiter

        public int getNiter()
        Get the number of iterations in nonlinear regression
        Returns:
        number of iterations in nonlinear regression
      • getNlrStatus

        public boolean getNlrStatus()
        Get the non-linear regression status true if convergence was achieved false if convergence not achieved before maximum number of iterations current values then returned
        Returns:
        the non-linear regression status
      • getNmax

        public int getNmax()
        Get the maximum number of iterations allowed in nonlinear regression
        Returns:
        maximum number of iterations allowed in nonlinear regression
      • getNMcontract

        public double getNMcontract()
        Get the Nelder and Mead contraction coefficient [gamma]
        Returns:
        Nelder and Mead contraction coefficient [gamma]
      • getNMextend

        public double getNMextend()
        Get the Nelder and Mead extension coefficient [beta]
        Returns:
        Nelder and Mead extension coefficient [beta]
      • getNMreflect

        public double getNMreflect()
        Get the Nelder and Mead reflection coefficient [alpha]
        Returns:
        Nelder and Mead reflection coefficient [alpha]
      • getNrestarts

        public int getNrestarts()
        Get the number of restarts in nonlinear regression
        Returns:
        number of restarts in nonlinear regression
      • getNrestartsMax

        public int getNrestartsMax()
        Get the maximum number of restarts allowed in nonlinear regression
        Returns:
        maximum number of restarts allowed in nonlinear regression
      • getPosVarCheck

        public boolean getPosVarCheck()
        Get the non-linear regression statistics Hessian matrix inverse diagonal status flag
        Returns:
        non-linear regression statistics Hessian matrix inverse diagonal status flag
      • getPseudoErrors

        public double[] getPseudoErrors()
        Get the pseudo-estimates of the errors of the best estimates of the unknown parameters
        Returns:
        pseudo-estimates of the errors of the best estimates
      • getPseudoSd

        public double[] getPseudoSd()
        Get the pseudo-estimates of the errors of the best estimates of the unknown parameters
        Returns:
        pseudo-estimates of the errors of the best estimates
      • getPvalues

        public double[] getPvalues()
        Get the p-values of the best estimates
        Returns:
        p-values of the best estimates
      • getReducedChiSquare

        public double getReducedChiSquare()
        Get the reduced chi square estimate
        Returns:
        reduced chi square estimate
      • getResiduals

        public double[] getResiduals()
        Get the unweighed residuals, y(experimental) - y(calculated)
        Returns:
        unweighed residuals, y(experimental) - y(calculated)
      • getSampleR

        public double getSampleR()
        Get the Sample Correlation Coefficient
        Returns:
        Sample Correlation Coefficient
      • getSampleR2

        public double getSampleR2()
        Get the Sample Correlation Coefficient Squared
        Returns:
        Sample Correlation Coefficient Squared
      • getScale

        public double[] getScale()
        Returns:
        scaling factors
      • getSimplexSd

        public double getSimplexSd()
        Get the simplex sd at the minimum
        Returns:
        simplex sd at the minimum
      • getSumOfSquares

        public double getSumOfSquares()
        Get the unweighed sum of squares of the residuals
        Returns:
        unweighed sum of squares of the residuals
      • getTolerance

        public double getTolerance()
        Get the non-linear regression tolerance
        Returns:
        non-linear regression tolerance
      • getTrueFreq

        public boolean getTrueFreq()
        Get the true frequency test, trueFreq
        Returns:
        trueFreq
      • getTvalues

        public double[] getTvalues()
        Get the t-values of the best estimates
        Returns:
        t-values of the best estimates
      • getWeightedResiduals

        public double[] getWeightedResiduals()
        Get the weighted residuals, (y(experimental) - y(calculated))/weight
        Returns:
        weighted residuals
      • getXdata

        public double[][] getXdata()
        Get the input x values
        Returns:
        input x values
      • getYcalc

        public double[] getYcalc()
        Get the calculated y values
        Returns:
        calculated y values
      • getYdata

        public double[] getYdata()
        Get the input y values
        Returns:
        input y values
      • ignoreDofFcheck

        public void ignoreDofFcheck()
        Ignore check on whether degrees of freedom are greater than zero
      • infinityCheck

        public boolean infinityCheck​(double yPeak,
                                     int peaki)
        Check for y value = infinity
        Parameters:
        yPeak - ???
        peaki - ???
        Returns:
        true if an infinity value has been removed
      • multCorrelCoeff

        protected void multCorrelCoeff​(double[] yy,
                                       double[] yyCalc,
                                       double[] ww)
        Calculate the multiple correlation coefficient
        Parameters:
        yy - ???
        yyCalc - ???
        ww - ???
      • nelderMead

        protected void nelderMead​(java.lang.Object regFun,
                                  double[] start,
                                  double[] step,
                                  double fTol,
                                  int nMax)
        Nelder and Mead Simplex Simplex Non-linear Regression
        Parameters:
        regFun - function to be fitted to
        start - initial parameter values
        step - initial parameter step values
        fTol - tolerance
        nMax - maximum number of iterations
      • pseudoLinearStats

        protected int pseudoLinearStats​(java.lang.Object regFun)
        apply linear statistics to a non-linear regression
        Parameters:
        regFun - test function
        Returns:
        pseudo linear statistics
      • removeConstraints

        public void removeConstraints()
        remove all constraint boundaries for the non-linear regression
      • setConstraintTolerance

        public void setConstraintTolerance​(double tolerance)
        Reset the tolerance used in a fixed value constraint
        Parameters:
        tolerance - fitting tolerance threshold
      • setDefaultValues

        protected void setDefaultValues​(double[][] xData,
                                        double[] yData,
                                        double[] weight)
        Set data and default values
        Parameters:
        xData - ???
        yData - ???
        weight - ???
      • setDelta

        public void setDelta​(double delta)
        Set the non-linear regression fractional step size used in numerical differencing
        Parameters:
        delta - non-linear regression fractional step size used in numerical differencing
      • setMinTest

        public void setMinTest​(int n)
        Reset the non-linear regression convergence test option
        Parameters:
        n - 0 or 1
      • setNmax

        public void setNmax​(int nmax)
        Set the maximum number of iterations allowed in nonlinear regression
        Parameters:
        nmax - maximum number of iterations
      • setNMcontract

        public void setNMcontract​(double con)
        Reset the Nelder and Mead contraction coefficient [gamma]
        Parameters:
        con - Nelder and Mead contraction coefficient [gamma]
      • setNMextend

        public void setNMextend​(double ext)
        Reset the Nelder and Mead extension coefficient [beta]
        Parameters:
        ext - extension coefficient beta
      • setNMreflect

        public void setNMreflect​(double refl)
        Reset the Nelder and Mead reflection coefficient [alpha]
        Parameters:
        refl - alpha parameter
      • setNrestartsMax

        public void setNrestartsMax​(int nrs)
        Parameters:
        nrs - maximum number of restarts allowed in nonlinear regression
      • setScale

        public void setScale​(double[] sc)
        Reset scaling factors (scaleOpt 2, see above for scaleOpt 0 and 1)
        Parameters:
        sc - scaling factor
      • setScale

        public void setScale​(int n)
        Reset scaling factors (scaleOpt 0 and 1, see below for scaleOpt 2)
        Parameters:
        n - 0 or 1
      • setTolerance

        public void setTolerance​(double tol)
        Set the non-linear regression tolerance
        Parameters:
        tol - non-linear regression tolerance
      • setTrueFreq

        public void setTrueFreq​(boolean trFr)
        Reset the true frequency test, trueFreq true if yData values are true frequencies, e.g. in a fit to Gaussian; false if not if true chiSquarePoisson (see above) is also calculated
        Parameters:
        trFr - ???
      • simplex

        public void simplex​(Function1D g,
                            double[] start)
        Nelder and Mead simplex Default tolerance Default maximum iterations Default step option - all step[i] = dStep
        Parameters:
        g - function
        start - initial parameter values
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double fTol)
        Nelder and Mead simplex Default maximum iterations Default step option - all step[i] = dStep
        Parameters:
        g - function
        start - initial parameter values
        fTol - fitting tolerance
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double fTol,
                            int nMax)
        Nelder and Mead simplex Default step option - all step[i] = dStep
        Parameters:
        g - function
        start - initial parameter values
        fTol - fitting tolerance
        nMax - maximum number of iterations
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step)
        Nelder and Mead simplex
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step,
                            double fTol)
        Nelder and Mead simplex Default maximum iterations
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
        fTol - fitting tolerance
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step,
                            double fTol,
                            int nMax)
        Nelder and Mead Simplex Simplex Non-linear Regression
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
        fTol - fitting tolerance
        nMax - maximum number of iterations
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step,
                            int nMax)
        Nelder and Mead simplex Default tolerance
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
        nMax - maximum number of iterations
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            int nMax)
        Nelder and Mead simplex Default tolerance Default step option - all step[i] = dStep
        Parameters:
        g - function
        start - initial parameter values
        nMax - maximum number of iterations
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead simplex Default tolerance Default maximum iterations Default step option - all step[i] = dStep
        Parameters:
        g - function to fit
        start - initial parameter values
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start,
                             double fTol)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead simplex Default maximum iterations Default step option - all step[i] = dStep
        Parameters:
        g - function to fit
        start - initial parameter values
        fTol - fitting tolerance
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start,
                             double fTol,
                             int nMax)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead simplex Default step option - all step[i] = dStep
        Parameters:
        g - function to fit
        start - initial parameter values
        fTol - fitting tolerance
        nMax - maximum number of iterations
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead simplex Default tolerance Default maximum iterations
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step,
                             double fTol)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead simplex Default maximum iterations
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
        fTol - fitting tolerance
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step,
                             double fTol,
                             int nMax)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead Simplex Simplex2 Non-linear Regression
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
        fTol - fitting tolerance
        nMax - maximum number of iterations
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step,
                             int nMax)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead simplex Default tolerance
        Parameters:
        g - function
        start - initial parameter values
        step - initial parameter step values
        nMax - maximum number of iterations
      • simplex2

        @Deprecated
        public void simplex2​(FunctionND g,
                             double[] start,
                             int nMax)
        Deprecated.
        do not use yet in a production environment, needs some clean-up
        Nelder and Mead simplex Default tolerance Default step option - all step[i] = dStep
        Parameters:
        g - function to fit
        start - initial parameter values
        nMax - maximum number of iterations
      • sumSquares

        protected double sumSquares​(java.lang.Object regFun,
                                    double[] testParameter)
        Calculate the sum of squares of the residuals for non-linear regression
        Parameters:
        regFun - test function
        testParameter - test parameter
        Returns:
        sum of squares
      • dataSign

        @Deprecated
        protected static java.util.ArrayList<java.lang.Object> dataSign​(double[] data)
        Deprecated.
        replace with optimised routines
        check data arrays for sign, max, min and peak
        Parameters:
        data - input data
        Returns:
        data arrays for sign, max, min and peak
      • halfWidth

        protected static double halfWidth​(double[] xData,
                                          double[] yData)
        returns estimate of half-height width
        Parameters:
        xData - x coordinate of input data
        yData - y coordinate of input data
        Returns:
        estimate of half-height width
      • setTrueFreqWeights

        protected static boolean setTrueFreqWeights​(double[] yData,
                                                    double[] weight)
      • sort

        protected static void sort​(double[] x,
                                   double[] y,
                                   double[] w)
        sort elements x, y and w arrays of doubles into ascending order of the x array using selection sort method
        Parameters:
        x - ???
        y - ???
        w - ???