Package de.gsi.math.fitter
Class NonLinearRegressionFitter2
- java.lang.Object
-
- de.gsi.math.fitter.NonLinearRegressionFitter2
-
@Deprecated public class NonLinearRegressionFitter2 extends java.lang.ObjectDeprecated.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 Summary
Fields Modifier and Type Field Description protected double[]bestDeprecated.protected double[]bestSdDeprecated.protected doublecCoeffDeprecated.protected doublechiSquareDeprecated.protected intconstraintMethodDeprecated.protected double[]constraintsDeprecated.protected doubleconstraintToleranceDeprecated.protected double[][]corrCoeffDeprecated.protected double[][]covarDeprecated.protected intdegreesOfFreedomDeprecated.protected doubledeltaDeprecated.protected doubledStepDeprecated.protected doubleeCoeffDeprecated.protected boolean[]fixedDeprecated.protected doublefMinDeprecated.protected double[]fscaleDeprecated.protected doublefTolDeprecated.protected double[][]gradDeprecated.protected static doublehistTolDeprecated.protected booleanignoreDofFcheckDeprecated.protected booleaninvertFlagDeprecated.protected intkonvgeDeprecated.protected intkRestartDeprecated.protected doublelastSSnoConstraintDeprecated.protected booleanlinNonLinDeprecated.protected intmaxConstraintIndexDeprecated.protected intminTestDeprecated.protected booleanmultipleYDeprecated.protected intnConstraintsDeprecated.protected intnDataDeprecated.protected booleannFactorOptionDeprecated.protected intnIterDeprecated.protected booleannlrStatusDeprecated.protected intnMaxDeprecated.protected intnSumConstraintsDeprecated.protected intnTermsDeprecated.protected intnYarraysDeprecated.protected java.util.ArrayList<java.lang.Object>penaltiesDeprecated.protected booleanpenaltyDeprecated.protected int[]penaltyCheckDeprecated.protected int[]penaltyParamDeprecated.protected doublepenaltyWeightDeprecated.protected booleanposVarFlagDeprecated.protected double[]pseudoSdDeprecated.protected double[]pValuesDeprecated.protected doublerCoeffDeprecated.protected doublereducedChiSquareDeprecated.protected VoxelArrayNDresidualDeprecated.protected VoxelArrayNDresidualWDeprecated.protected intscaleOptDeprecated.protected doublesimplexSdDeprecated.protected double[]startHDeprecated.protected booleanstatFlagDeprecated.protected double[]stepDeprecated.protected double[]sumConstraintsDeprecated.protected doublesumOfSquaresDeprecated.protected java.util.ArrayList<java.lang.Object>sumPenaltiesDeprecated.protected booleansumPenaltyDeprecated.protected int[]sumPenaltyCheckDeprecated.protected int[]sumPenaltyNumberDeprecated.protected int[][]sumPenaltyParamDeprecated.protected double[][]sumPlusOrMinusDeprecated.protected booleantrueFreqDeprecated.protected double[]tValuesDeprecated.protected double[]valuesDeprecated.protected VoxelArrayNDweightDeprecated.protected intweightFlagDeprecated.protected booleanweightOptDeprecated.protected VoxelArrayNDxDataDeprecated.protected VoxelArrayNDyCalcDeprecated.protected VoxelArrayNDyDataDeprecated.protected booleanzeroCheckDeprecated.
-
Constructor Summary
Constructors Constructor Description NonLinearRegressionFitter2(double[] xData, double[] yData, double[] weight)Deprecated.Constructor with data with x as 1D array and weights providedNonLinearRegressionFitter2(VoxelArrayND xData, VoxelArrayND yData, VoxelArrayND weights)Deprecated.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 voidaddConstraint(int[] paramIndices, double[] plusOrMinus, int conDir, double constraint)Deprecated.voidaddConstraint(int[] paramIndices, int[] plusOrMinus, int conDir, double constraint)Deprecated.voidaddConstraint(int paramIndex, int conDir, double constraint)Deprecated.protected VoxelArrayNDcheckForZeroWeights(VoxelArrayND weights)Deprecated.Check entered weights for zeros.voidcheckZeroNeg(double[] xx, double[] yy, double[] ww)Deprecated.double[]getBestEstimates()Deprecated.double[]getBestEstimatesErrors()Deprecated.double[]getbestestimatesStandardDeviations()Deprecated.double[]getBestEstimatesStandardDeviations()Deprecated.doublegetChiSquare()Deprecated.doublegetchiSquareProb()Deprecated.double[]getCoeff()Deprecated.double[]getCoeffSd()Deprecated.double[]getCoeffVar()Deprecated.double[][]getCorrCoeffMatrix()Deprecated.double[][]getCovMatrix()Deprecated.doublegetDegFree()Deprecated.doublegetDelta()Deprecated.double[][]getGrad()Deprecated.booleangetInversionCheck()Deprecated.intgetMinTest()Deprecated.intgetNiter()Deprecated.booleangetNlrStatus()Deprecated.intgetNmax()Deprecated.doublegetNMcontract()Deprecated.doublegetNMextend()Deprecated.doublegetNMreflect()Deprecated.intgetNrestarts()Deprecated.intgetNrestartsMax()Deprecated.booleangetPosVarCheck()Deprecated.double[]getPseudoErrors()Deprecated.double[]getPseudoSd()Deprecated.double[]getPvalues()Deprecated.doublegetReducedChiSquare()Deprecated.double[]getResiduals()Deprecated.double[]getScale()Deprecated.doublegetSimplexSd()Deprecated.doublegetSumOfSquares()Deprecated.doublegetTolerance()Deprecated.booleangetTrueFreq()Deprecated.double[]getTvalues()Deprecated.double[]getWeightedResiduals()Deprecated.double[]getXdata()Deprecated.Get the input x valuesdouble[]getYcalc()Deprecated.double[]getYdata()Deprecated.Get the inputed y valuesprotected static doublehalfWidth(double[] xData, double[] yData)Deprecated.static double[][]histogramBins(double[] data, double binWidth, double binZero)Deprecated.static double[][]histogramBins(double[] data, double binWidth, double binZero, double binUpper)Deprecated.voidignoreDofFcheck()Deprecated.protected voidnelderMead(java.lang.Object regFun, double[] start, double[] step, double fTol, int nMax)Deprecated.Nelder and Mead Simplex Simplex Non-linear Regressionprotected intpseudoLinearStats(java.lang.Object regFun)Deprecated.apply linear statistics to a non-linear regressionvoidremoveConstraints()Deprecated.voidsetConstraintTolerance(double tolerance)Deprecated.voidsetData(double[] xData, double[] yData, double[] weights)Deprecated.voidsetData(VoxelArrayND xData, VoxelArrayND yData, VoxelArrayND weights)Deprecated.voidsetDelta(double delta)Deprecated.voidsetMinTest(int n)Deprecated.voidsetNmax(int nmax)Deprecated.voidsetNMcontract(double con)Deprecated.voidsetNMextend(double ext)Deprecated.voidsetNMreflect(double refl)Deprecated.voidsetNrestartsMax(int nrs)Deprecated.voidsetScale(double[] sc)Deprecated.voidsetScale(int n)Deprecated.voidsetTolerance(double tol)Deprecated.voidsetTrueFreq(boolean trFr)Deprecated.protected static booleansetTrueFreqWeights(VoxelArrayND yData, VoxelArrayND weight)Deprecated.voidsimplex(Function1D g, double[] start)Deprecated.voidsimplex(Function1D g, double[] start, double fTol)Deprecated.voidsimplex(Function1D g, double[] start, double[] step)Deprecated.voidsimplex(Function1D g, double[] start, double[] step, double fTol)Deprecated.voidsimplex(Function1D g, double[] start, double[] step, double fTol, int nMax)Deprecated.voidsimplex(Function1D g, double[] start, double[] step, int nMax)Deprecated.voidsimplex(Function1D g, double[] start, double fTol, int nMax)Deprecated.voidsimplex(Function1D g, double[] start, int nMax)Deprecated.voidsimplex2(FunctionND g, double[] start)Deprecated.voidsimplex2(FunctionND g, double[] start, double fTol)Deprecated.voidsimplex2(FunctionND g, double[] start, double[] step)Deprecated.voidsimplex2(FunctionND g, double[] start, double[] step, double fTol)Deprecated.voidsimplex2(FunctionND g, double[] start, double[] step, double fTol, int nMax)Deprecated.voidsimplex2(FunctionND g, double[] start, double[] step, int nMax)Deprecated.voidsimplex2(FunctionND g, double[] start, double fTol, int nMax)Deprecated.voidsimplex2(FunctionND g, double[] start, int nMax)Deprecated.protected static voidsort(double[] x, double[] y, double[] w)Deprecated.protected doublesumSquares(java.lang.Object regFun, double[] testParameter)Deprecated.Calculate the sum of squares of the residuals for non-linear regression
-
-
-
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.
-
xData
protected VoxelArrayND xData
Deprecated.
-
yData
protected VoxelArrayND yData
Deprecated.
-
yCalc
protected VoxelArrayND yCalc
Deprecated.
-
weight
protected VoxelArrayND weight
Deprecated.
-
residual
protected VoxelArrayND residual
Deprecated.
-
residualW
protected VoxelArrayND residualW
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 datayData- y coordinate of input dataweight- 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 datayData- y coordinate of input dataweights- 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 functionstart- initial parameter valuesstep- initial parameter step sizefTol- regression tolerancenMax- 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.
-
setData
public void setData(VoxelArrayND xData, VoxelArrayND yData, VoxelArrayND 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 functiontestParameter- 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.
-
-