Class NonLinearRegressionFitter2


  • @Deprecated
    public class NonLinearRegressionFitter2
    extends java.lang.Object
    Deprecated.
    need to fix the n-dimensional handling - do not use (yet)
    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, appears in all copies The code has been cleaned up and adapted to support true MxN multi-dimensional fits
    Author:
    rstein
    • Field Detail

      • histTol

        protected static double histTol
        Deprecated.
      • nData

        protected int nData
        Deprecated.
      • nYarrays

        protected int nYarrays
        Deprecated.
      • nTerms

        protected int nTerms
        Deprecated.
      • degreesOfFreedom

        protected int degreesOfFreedom
        Deprecated.
      • weightOpt

        protected boolean weightOpt
        Deprecated.
      • weightFlag

        protected int weightFlag
        Deprecated.
      • best

        protected double[] best
        Deprecated.
      • bestSd

        protected double[] bestSd
        Deprecated.
      • pseudoSd

        protected double[] pseudoSd
        Deprecated.
      • tValues

        protected double[] tValues
        Deprecated.
      • pValues

        protected double[] pValues
        Deprecated.
      • chiSquare

        protected double chiSquare
        Deprecated.
      • reducedChiSquare

        protected double reducedChiSquare
        Deprecated.
      • sumOfSquares

        protected double sumOfSquares
        Deprecated.
      • lastSSnoConstraint

        protected double lastSSnoConstraint
        Deprecated.
      • covar

        protected double[][] covar
        Deprecated.
      • corrCoeff

        protected double[][] corrCoeff
        Deprecated.
      • linNonLin

        protected boolean linNonLin
        Deprecated.
      • trueFreq

        protected boolean trueFreq
        Deprecated.
      • nlrStatus

        protected boolean nlrStatus
        Deprecated.
      • scaleOpt

        protected int scaleOpt
        Deprecated.
      • fscale

        protected double[] fscale
        Deprecated.
      • zeroCheck

        protected boolean zeroCheck
        Deprecated.
      • penalty

        protected boolean penalty
        Deprecated.
      • sumPenalty

        protected boolean sumPenalty
        Deprecated.
      • nConstraints

        protected int nConstraints
        Deprecated.
      • nSumConstraints

        protected int nSumConstraints
        Deprecated.
      • maxConstraintIndex

        protected int maxConstraintIndex
        Deprecated.
      • constraintTolerance

        protected double constraintTolerance
        Deprecated.
      • penalties

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

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

        protected int[] penaltyCheck
        Deprecated.
      • sumPenaltyCheck

        protected int[] sumPenaltyCheck
        Deprecated.
      • penaltyWeight

        protected double penaltyWeight
        Deprecated.
      • penaltyParam

        protected int[] penaltyParam
        Deprecated.
      • sumPenaltyParam

        protected int[][] sumPenaltyParam
        Deprecated.
      • sumPlusOrMinus

        protected double[][] sumPlusOrMinus
        Deprecated.
      • sumPenaltyNumber

        protected int[] sumPenaltyNumber
        Deprecated.
      • constraints

        protected double[] constraints
        Deprecated.
      • sumConstraints

        protected double[] sumConstraints
        Deprecated.
      • constraintMethod

        protected int constraintMethod
        Deprecated.
      • nMax

        protected int nMax
        Deprecated.
      • nIter

        protected int nIter
        Deprecated.
      • konvge

        protected int konvge
        Deprecated.
      • kRestart

        protected int kRestart
        Deprecated.
      • fMin

        protected double fMin
        Deprecated.
      • fTol

        protected double fTol
        Deprecated.
      • rCoeff

        protected double rCoeff
        Deprecated.
      • eCoeff

        protected double eCoeff
        Deprecated.
      • cCoeff

        protected double cCoeff
        Deprecated.
      • startH

        protected double[] startH
        Deprecated.
      • step

        protected double[] step
        Deprecated.
      • dStep

        protected double dStep
        Deprecated.
      • grad

        protected double[][] grad
        Deprecated.
      • delta

        protected double delta
        Deprecated.
      • invertFlag

        protected boolean invertFlag
        Deprecated.
      • posVarFlag

        protected boolean posVarFlag
        Deprecated.
      • minTest

        protected int minTest
        Deprecated.
      • simplexSd

        protected double simplexSd
        Deprecated.
      • statFlag

        protected boolean statFlag
        Deprecated.
      • multipleY

        protected boolean multipleY
        Deprecated.
      • values

        protected double[] values
        Deprecated.
      • fixed

        protected boolean[] fixed
        Deprecated.
      • ignoreDofFcheck

        protected boolean ignoreDofFcheck
        Deprecated.
      • nFactorOption

        protected boolean nFactorOption
        Deprecated.
    • Constructor Detail

      • NonLinearRegressionFitter2

        public NonLinearRegressionFitter2​(double[] xData,
                                          double[] yData,
                                          double[] weight)
        Deprecated.
        Constructor with data with x as 1D array and weights provided
        Parameters:
        xData - x coordinate of input data
        yData - y coordinate of input data
        weight - weighting vector
      • NonLinearRegressionFitter2

        public NonLinearRegressionFitter2​(VoxelArrayND xData,
                                          VoxelArrayND yData,
                                          VoxelArrayND weights)
        Deprecated.
        Constructor with data with x as 1D array and weights provided
        Parameters:
        xData - x coordinate of input data
        yData - y coordinate of input data
        weights - weighting vector
    • Method Detail

      • addConstraint

        public void addConstraint​(int paramIndex,
                                  int conDir,
                                  double constraint)
        Deprecated.
      • addConstraint

        public void addConstraint​(int[] paramIndices,
                                  double[] plusOrMinus,
                                  int conDir,
                                  double constraint)
        Deprecated.
      • addConstraint

        public void addConstraint​(int[] paramIndices,
                                  int[] plusOrMinus,
                                  int conDir,
                                  double constraint)
        Deprecated.
      • checkForZeroWeights

        protected VoxelArrayND checkForZeroWeights​(VoxelArrayND weights)
        Deprecated.
        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:
        weights - weighting vector
        Returns:
        the regularised weight vector
      • checkZeroNeg

        public void checkZeroNeg​(double[] xx,
                                 double[] yy,
                                 double[] ww)
        Deprecated.
      • getBestEstimates

        public double[] getBestEstimates()
        Deprecated.
      • getBestEstimatesErrors

        public double[] getBestEstimatesErrors()
        Deprecated.
      • getbestestimatesStandardDeviations

        public double[] getbestestimatesStandardDeviations()
        Deprecated.
      • getBestEstimatesStandardDeviations

        public double[] getBestEstimatesStandardDeviations()
        Deprecated.
      • getChiSquare

        public double getChiSquare()
        Deprecated.
      • getchiSquareProb

        public double getchiSquareProb()
        Deprecated.
      • getCoeff

        public double[] getCoeff()
        Deprecated.
      • getCoeffSd

        public double[] getCoeffSd()
        Deprecated.
      • getCoeffVar

        public double[] getCoeffVar()
        Deprecated.
      • getCorrCoeffMatrix

        public double[][] getCorrCoeffMatrix()
        Deprecated.
      • getCovMatrix

        public double[][] getCovMatrix()
        Deprecated.
      • getDegFree

        public double getDegFree()
        Deprecated.
      • getDelta

        public double getDelta()
        Deprecated.
      • getGrad

        public double[][] getGrad()
        Deprecated.
      • getInversionCheck

        public boolean getInversionCheck()
        Deprecated.
      • getMinTest

        public int getMinTest()
        Deprecated.
      • getNiter

        public int getNiter()
        Deprecated.
      • getNlrStatus

        public boolean getNlrStatus()
        Deprecated.
      • getNmax

        public int getNmax()
        Deprecated.
      • getNMcontract

        public double getNMcontract()
        Deprecated.
      • getNMextend

        public double getNMextend()
        Deprecated.
      • getNMreflect

        public double getNMreflect()
        Deprecated.
      • getNrestarts

        public int getNrestarts()
        Deprecated.
      • getNrestartsMax

        public int getNrestartsMax()
        Deprecated.
      • getPosVarCheck

        public boolean getPosVarCheck()
        Deprecated.
      • getPseudoErrors

        public double[] getPseudoErrors()
        Deprecated.
      • getPseudoSd

        public double[] getPseudoSd()
        Deprecated.
      • getPvalues

        public double[] getPvalues()
        Deprecated.
      • getReducedChiSquare

        public double getReducedChiSquare()
        Deprecated.
      • getResiduals

        public double[] getResiduals()
        Deprecated.
      • getScale

        public double[] getScale()
        Deprecated.
      • getSimplexSd

        public double getSimplexSd()
        Deprecated.
      • getSumOfSquares

        public double getSumOfSquares()
        Deprecated.
      • getTolerance

        public double getTolerance()
        Deprecated.
      • getTrueFreq

        public boolean getTrueFreq()
        Deprecated.
      • getTvalues

        public double[] getTvalues()
        Deprecated.
      • getWeightedResiduals

        public double[] getWeightedResiduals()
        Deprecated.
      • getXdata

        public double[] getXdata()
        Deprecated.
        Get the input x values
        Returns:
        array with x coordinates
      • getYcalc

        public double[] getYcalc()
        Deprecated.
      • getYdata

        public double[] getYdata()
        Deprecated.
        Get the inputed y values
        Returns:
        array with input y coordinates
      • ignoreDofFcheck

        public void ignoreDofFcheck()
        Deprecated.
      • nelderMead

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

        protected int pseudoLinearStats​(java.lang.Object regFun)
        Deprecated.
        apply linear statistics to a non-linear regression
        Parameters:
        regFun - test function
        Returns:
        0 if method fully successful; -1 posVarFlag or invertFlag is false; -2 posVarFlag and invertFlag are false
      • removeConstraints

        public void removeConstraints()
        Deprecated.
      • setConstraintTolerance

        public void setConstraintTolerance​(double tolerance)
        Deprecated.
      • setData

        public void setData​(double[] xData,
                            double[] yData,
                            double[] weights)
        Deprecated.
      • setDelta

        public void setDelta​(double delta)
        Deprecated.
      • setMinTest

        public void setMinTest​(int n)
        Deprecated.
      • setNmax

        public void setNmax​(int nmax)
        Deprecated.
      • setNMcontract

        public void setNMcontract​(double con)
        Deprecated.
      • setNMextend

        public void setNMextend​(double ext)
        Deprecated.
      • setNMreflect

        public void setNMreflect​(double refl)
        Deprecated.
      • setNrestartsMax

        public void setNrestartsMax​(int nrs)
        Deprecated.
      • setScale

        public void setScale​(double[] sc)
        Deprecated.
      • setScale

        public void setScale​(int n)
        Deprecated.
      • setTolerance

        public void setTolerance​(double tol)
        Deprecated.
      • setTrueFreq

        public void setTrueFreq​(boolean trFr)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double fTol)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double fTol,
                            int nMax)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step,
                            double fTol)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step,
                            double fTol,
                            int nMax)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            double[] step,
                            int nMax)
        Deprecated.
      • simplex

        public void simplex​(Function1D g,
                            double[] start,
                            int nMax)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start,
                             double fTol)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start,
                             double fTol,
                             int nMax)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step,
                             double fTol)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step,
                             double fTol,
                             int nMax)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start,
                             double[] step,
                             int nMax)
        Deprecated.
      • simplex2

        public void simplex2​(FunctionND g,
                             double[] start,
                             int nMax)
        Deprecated.
      • sumSquares

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

        protected static double halfWidth​(double[] xData,
                                          double[] yData)
        Deprecated.
      • histogramBins

        public static double[][] histogramBins​(double[] data,
                                               double binWidth,
                                               double binZero)
        Deprecated.
      • histogramBins

        public static double[][] histogramBins​(double[] data,
                                               double binWidth,
                                               double binZero,
                                               double binUpper)
        Deprecated.
      • setTrueFreqWeights

        protected static boolean setTrueFreqWeights​(VoxelArrayND yData,
                                                    VoxelArrayND weight)
        Deprecated.
      • sort

        protected static void sort​(double[] x,
                                   double[] y,
                                   double[] w)
        Deprecated.