Package de.gsi.math.fitter
Class NonLinearRegressionFitter
- java.lang.Object
-
- de.gsi.math.fitter.NonLinearRegressionFitter
-
public class NonLinearRegressionFitter extends java.lang.ObjectNon-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
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleadjustedFprotected doubleadjustedRprotected doubleadjustedR2protected double[]bestprotected double[]bestSdprotected doublecCoeffprotected doublechiSquareprotected intconstraintMethodprotected double[]constraintsprotected doubleconstraintToleranceprotected double[][]corrCoeffprotected double[][]covarprotected intdegreesOfFreedomprotected doubledeltaprotected doubledStepprotected doubleeCoeffprotected boolean[]fixedprotected doublefMinprotected double[]fscaleprotected doublefTolprotected double[][]gradprotected static doublehistTolprotected booleanignoreDofFcheckprotected booleaninvertFlagprotected intkonvgeprotected intkRestartprotected doublelastSSnoConstraintprotected booleanlinNonLinprotected intmaxConstraintIndexprotected intminTestprotected doublemultipleFprotected booleanmultipleYprotected intnConstraintsprotected intnDataprotected intnData0protected booleannFactorOptionprotected intnIterprotected booleannlrStatusprotected intnMaxprotected intnSumConstraintsprotected intnTermsprotected intnXarraysprotected intnYarraysprotected java.util.ArrayList<java.lang.Object>penaltiesprotected booleanpenaltyprotected int[]penaltyCheckprotected int[]penaltyParamprotected doublepenaltyWeightprotected booleanposVarFlagprotected double[]pseudoSdprotected double[]pValuesprotected doublerCoeffprotected doublereducedChiSquareprotected double[]residualprotected double[]residualWprotected doublesampleRprotected doublesampleR2protected intscaleOptprotected doublesimplexSdprotected double[]startHprotected booleanstatFlagprotected double[]stepprotected double[]sumConstraintsprotected doublesumOfSquaresprotected java.util.ArrayList<java.lang.Object>sumPenaltiesprotected booleansumPenaltyprotected int[]sumPenaltyCheckprotected int[]sumPenaltyNumberprotected int[][]sumPenaltyParamprotected double[][]sumPlusOrMinusprotected booleantrueFreqprotected double[]tValuesprotected double[]valuesprotected double[]weightprotected intweightFlagprotected booleanweightOptprotected double[][]xDataprotected double[]yCalcprotected double[]yDataprotected booleanzeroCheck
-
Constructor Summary
Constructors Constructor Description NonLinearRegressionFitter(double[][] xData, double[] yData)Constructor with data with x as 2D array and no weights providedNonLinearRegressionFitter(double[][] xxData, double[][] yyData)Constructor with data with x and y as 2D arrays and no weights providedNonLinearRegressionFitter(double[][] xxData, double[][] yyData, double[][] wWeight)Constructor with data with x and y as 2D arrays and weights providedNonLinearRegressionFitter(double[][] xData, double[] yData, double[] weight)Constructor with data with x as 2D array and weights providedNonLinearRegressionFitter(double[] xxData, double[] yData)Constructor with data with x as 1D array and no weights providedNonLinearRegressionFitter(double[] xxData, double[][] yyData)Constructor with data with x as 1D array and y as a 2D array and no weights providedNonLinearRegressionFitter(double[] xxData, double[][] yyData, double[][] wWeight)Constructor with data with x as 1D array and y as 2D array and weights providedNonLinearRegressionFitter(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 voidaddConstraint(int[] paramIndices, double[] plusOrMinus, int conDir, double constraint)add a multiple parameter constraint boundary for the non-linear regressionvoidaddConstraint(int[] paramIndices, int[] plusOrMinus, int conDir, double constraint)add a multiple parameter constraint boundary for the non-linear regressionvoidaddConstraint(int paramIndex, int conDir, double constraint)add a single parameter constraint boundary for the non-linear regressionprotected double[]checkForZeroWeights(double[] weight)Check entered weights for zeros.doublecheckYallSmall(double yPeak, java.lang.String ss)check y values for all y are very small valuevoidcheckZeroNeg(double[] xx, double[] yy, double[] ww)check for zero and negative valuesprotected static java.util.ArrayList<java.lang.Object>dataSign(double[] data)Deprecated.replace with optimised routinesvoidenterData(double[][] xData, double[] yData)Enter data with x as 2D array and no weights providedvoidenterData(double[][] xxData, double[][] yyData)Enter data with x and y as 2D arrays and no weights providedvoidenterData(double[][] xxData, double[][] yyData, double[][] wWeight)data entry, all 2D arraysvoidenterData(double[][] xData, double[] yData, double[] weight)Enter data methodsvoidenterData(double[] xxData, double[] yData)Enter data with x as 1D array and no weights providedvoidenterData(double[] xxData, double[][] yyData)Enter data with x as 1D array and y as a 2D array and no weights providedvoidenterData(double[] xxData, double[][] yyData, double[][] wWeight)Enter datavoidenterData(double[] xxData, double[] yData, double[] weight)Enter data as 1D arraysprotected voidgeneralLinearStats(double[][] xd)Generalised linear regression statistics (protected method called by linear(), linearGeneral() and polynomial())doublegetAdjustedR()Get the Adjusted Sample Correlation CoefficientdoublegetAdjustedR2()Get the Adjusted Sample Correlation Coefficient Squareddouble[]getBestEstimates()Get the best estimates of the unknown parametersdouble[]getBestEstimatesErrors()Get the estimates of the errors of the best estimates of the unknown parametersdouble[]getBestEstimatesStandardDeviations()Get the estimates of the standard deviations of the best estimates of the unknown parametersdoublegetChiSquare()Get the chi square estimatedoublegetchiSquareProb()Get the chi square probablitydouble[]getCoeff()Get the best estimates of the unknown parametersdouble[]getCoeffSd()Get the estimates of the errors of the best estimates of the unknown parametersdouble[]getCoeffVar()Get the cofficients of variations of the best estimates of the unknown parametersdouble[][]getCorrCoeffMatrix()Get the correlation coefficient matrixdouble[][]getCovMatrix()Get the covariance matrixdoublegetDegFree()Get the degrees of freedomdoublegetDelta()Get the non-linear regression fractional step size used in numerical differencingdouble[][]getGrad()Get the non-linear regression pre and post minimum gradientsbooleangetInversionCheck()Get the non-linear regression statistics Hessian matrix inversion status flagintgetMinTest()Get the non-linear regression convergence test optiondoublegetMultipleF()Get the Multiple Correlation Coefficient F ratiointgetNiter()Get the number of iterations in nonlinear regressionbooleangetNlrStatus()Get the non-linear regression status true if convergence was achieved false if convergence not achieved before maximum number of iterations current values then returnedintgetNmax()Get the maximum number of iterations allowed in nonlinear regressiondoublegetNMcontract()Get the Nelder and Mead contraction coefficient [gamma]doublegetNMextend()Get the Nelder and Mead extension coefficient [beta]doublegetNMreflect()Get the Nelder and Mead reflection coefficient [alpha]intgetNrestarts()Get the number of restarts in nonlinear regressionintgetNrestartsMax()Get the maximum number of restarts allowed in nonlinear regressionbooleangetPosVarCheck()Get the non-linear regression statistics Hessian matrix inverse diagonal status flagdouble[]getPseudoErrors()Get the pseudo-estimates of the errors of the best estimates of the unknown parametersdouble[]getPseudoSd()Get the pseudo-estimates of the errors of the best estimates of the unknown parametersdouble[]getPvalues()Get the p-values of the best estimatesdoublegetReducedChiSquare()Get the reduced chi square estimatedouble[]getResiduals()Get the unweighed residuals, y(experimental) - y(calculated)doublegetSampleR()Get the Sample Correlation CoefficientdoublegetSampleR2()Get the Sample Correlation Coefficient Squareddouble[]getScale()doublegetSimplexSd()Get the simplex sd at the minimumdoublegetSumOfSquares()Get the unweighed sum of squares of the residualsdoublegetTolerance()Get the non-linear regression tolerancebooleangetTrueFreq()Get the true frequency test, trueFreqdouble[]getTvalues()Get the t-values of the best estimatesdouble[]getWeightedResiduals()Get the weighted residuals, (y(experimental) - y(calculated))/weightdouble[][]getXdata()Get the input x valuesdouble[]getYcalc()Get the calculated y valuesdouble[]getYdata()Get the input y valuesprotected static doublehalfWidth(double[] xData, double[] yData)returns estimate of half-height widthvoidignoreDofFcheck()Ignore check on whether degrees of freedom are greater than zerobooleaninfinityCheck(double yPeak, int peaki)Check for y value = infinityprotected voidmultCorrelCoeff(double[] yy, double[] yyCalc, double[] ww)Calculate the multiple correlation coefficientprotected voidnelderMead(java.lang.Object regFun, double[] start, double[] step, double fTol, int nMax)Nelder and Mead Simplex Simplex Non-linear Regressionprotected intpseudoLinearStats(java.lang.Object regFun)apply linear statistics to a non-linear regressionvoidremoveConstraints()remove all constraint boundaries for the non-linear regressionvoidsetConstraintTolerance(double tolerance)Reset the tolerance used in a fixed value constraintprotected voidsetDefaultValues(double[][] xData, double[] yData, double[] weight)Set data and default valuesvoidsetDelta(double delta)Set the non-linear regression fractional step size used in numerical differencingvoidsetMinTest(int n)Reset the non-linear regression convergence test optionvoidsetNmax(int nmax)Set the maximum number of iterations allowed in nonlinear regressionvoidsetNMcontract(double con)Reset the Nelder and Mead contraction coefficient [gamma]voidsetNMextend(double ext)Reset the Nelder and Mead extension coefficient [beta]voidsetNMreflect(double refl)Reset the Nelder and Mead reflection coefficient [alpha]voidsetNrestartsMax(int nrs)voidsetScale(double[] sc)Reset scaling factors (scaleOpt 2, see above for scaleOpt 0 and 1)voidsetScale(int n)Reset scaling factors (scaleOpt 0 and 1, see below for scaleOpt 2)voidsetTolerance(double tol)Set the non-linear regression tolerancevoidsetTrueFreq(boolean trFr)Reset the true frequency test, trueFreq true if yData values are true frequencies, e.g.protected static booleansetTrueFreqWeights(double[] yData, double[] weight)voidsimplex(Function1D g, double[] start)Nelder and Mead simplex Default tolerance Default maximum iterations Default step option - all step[i] = dStepvoidsimplex(Function1D g, double[] start, double fTol)Nelder and Mead simplex Default maximum iterations Default step option - all step[i] = dStepvoidsimplex(Function1D g, double[] start, double[] step)Nelder and Mead simplexvoidsimplex(Function1D g, double[] start, double[] step, double fTol)Nelder and Mead simplex Default maximum iterationsvoidsimplex(Function1D g, double[] start, double[] step, double fTol, int nMax)Nelder and Mead Simplex Simplex Non-linear Regressionvoidsimplex(Function1D g, double[] start, double[] step, int nMax)Nelder and Mead simplex Default tolerancevoidsimplex(Function1D g, double[] start, double fTol, int nMax)Nelder and Mead simplex Default step option - all step[i] = dStepvoidsimplex(Function1D g, double[] start, int nMax)Nelder and Mead simplex Default tolerance Default step option - all step[i] = dStepvoidsimplex2(FunctionND g, double[] start)Deprecated.do not use yet in a production environment, needs some clean-upvoidsimplex2(FunctionND g, double[] start, double fTol)Deprecated.do not use yet in a production environment, needs some clean-upvoidsimplex2(FunctionND g, double[] start, double[] step)Deprecated.do not use yet in a production environment, needs some clean-upvoidsimplex2(FunctionND g, double[] start, double[] step, double fTol)Deprecated.do not use yet in a production environment, needs some clean-upvoidsimplex2(FunctionND g, double[] start, double[] step, double fTol, int nMax)Deprecated.do not use yet in a production environment, needs some clean-upvoidsimplex2(FunctionND g, double[] start, double[] step, int nMax)Deprecated.do not use yet in a production environment, needs some clean-upvoidsimplex2(FunctionND g, double[] start, double fTol, int nMax)Deprecated.do not use yet in a production environment, needs some clean-upvoidsimplex2(FunctionND g, double[] start, int nMax)Deprecated.do not use yet in a production environment, needs some clean-upprotected static voidsort(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 methodprotected doublesumSquares(java.lang.Object regFun, double[] testParameter)Calculate the sum of squares of the residuals for non-linear regression
-
-
-
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 indexconDir- ???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 indicesplusOrMinus- positive/negative range constraintconDir- direction of fit constraintconstraint- ???
-
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 indicesplusOrMinus- positive/negative range constraintconDir- direction of fit constraintconstraint- ???
-
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 arrayyyData- 2D arraywWeight- ???
-
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 arrayyData- 1D arrayweight- 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 tostart- initial parameter valuesstep- initial parameter step valuesfTol- tolerancenMax- 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- functionstart- 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- functionstart- initial parameter valuesfTol- 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- functionstart- initial parameter valuesfTol- fitting tolerancenMax- maximum number of iterations
-
simplex
public void simplex(Function1D g, double[] start, double[] step)
Nelder and Mead simplex- Parameters:
g- functionstart- initial parameter valuesstep- 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- functionstart- initial parameter valuesstep- initial parameter step valuesfTol- 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- functionstart- initial parameter valuesstep- initial parameter step valuesfTol- fitting tolerancenMax- maximum number of iterations
-
simplex
public void simplex(Function1D g, double[] start, double[] step, int nMax)
Nelder and Mead simplex Default tolerance- Parameters:
g- functionstart- initial parameter valuesstep- initial parameter step valuesnMax- 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- functionstart- initial parameter valuesnMax- 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-upNelder and Mead simplex Default tolerance Default maximum iterations Default step option - all step[i] = dStep- Parameters:
g- function to fitstart- 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-upNelder and Mead simplex Default maximum iterations Default step option - all step[i] = dStep- Parameters:
g- function to fitstart- initial parameter valuesfTol- 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-upNelder and Mead simplex Default step option - all step[i] = dStep- Parameters:
g- function to fitstart- initial parameter valuesfTol- fitting tolerancenMax- 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-upNelder and Mead simplex Default tolerance Default maximum iterations- Parameters:
g- functionstart- initial parameter valuesstep- 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-upNelder and Mead simplex Default maximum iterations- Parameters:
g- functionstart- initial parameter valuesstep- initial parameter step valuesfTol- 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-upNelder and Mead Simplex Simplex2 Non-linear Regression- Parameters:
g- functionstart- initial parameter valuesstep- initial parameter step valuesfTol- fitting tolerancenMax- 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-upNelder and Mead simplex Default tolerance- Parameters:
g- functionstart- initial parameter valuesstep- initial parameter step valuesnMax- 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-upNelder and Mead simplex Default tolerance Default step option - all step[i] = dStep- Parameters:
g- function to fitstart- initial parameter valuesnMax- 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 functiontestParameter- test parameter- Returns:
- sum of squares
-
dataSign
@Deprecated protected static java.util.ArrayList<java.lang.Object> dataSign(double[] data)
Deprecated.replace with optimised routinescheck 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 datayData- 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- ???
-
-