public class NonLinearRegressionFitter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected double |
adjustedF |
protected double |
adjustedR |
protected double |
adjustedR2 |
protected double[] |
best |
protected double[] |
bestSd |
protected double |
cCoeff |
protected double |
chiSquare |
protected int |
constraintMethod |
protected double[] |
constraints |
protected double |
constraintTolerance |
protected double[][] |
corrCoeff |
protected double[][] |
covar |
protected int |
degreesOfFreedom |
protected double |
delta |
protected double |
dStep |
protected double |
eCoeff |
protected boolean[] |
fixed |
protected double |
fMin |
protected double[] |
fscale |
protected double |
fTol |
protected double[][] |
grad |
protected static double |
histTol |
protected boolean |
ignoreDofFcheck |
protected boolean |
invertFlag |
protected int |
konvge |
protected int |
kRestart |
protected double |
lastSSnoConstraint |
protected boolean |
linNonLin |
protected int |
maxConstraintIndex |
protected int |
minTest |
protected double |
multipleF |
protected boolean |
multipleY |
protected int |
nConstraints |
protected int |
nData |
protected int |
nData0 |
protected boolean |
nFactorOption |
protected int |
nIter |
protected boolean |
nlrStatus |
protected int |
nMax |
protected int |
nSumConstraints |
protected int |
nTerms |
protected int |
nXarrays |
protected int |
nYarrays |
protected ArrayList<Object> |
penalties |
protected boolean |
penalty |
protected int[] |
penaltyCheck |
protected int[] |
penaltyParam |
protected double |
penaltyWeight |
protected boolean |
posVarFlag |
protected double[] |
pseudoSd |
protected double[] |
pValues |
protected double |
rCoeff |
protected double |
reducedChiSquare |
protected double[] |
residual |
protected double[] |
residualW |
protected double |
sampleR |
protected double |
sampleR2 |
protected int |
scaleOpt |
protected double |
simplexSd |
protected double[] |
startH |
protected boolean |
statFlag |
protected double[] |
step |
protected double[] |
sumConstraints |
protected double |
sumOfSquares |
protected ArrayList<Object> |
sumPenalties |
protected boolean |
sumPenalty |
protected int[] |
sumPenaltyCheck |
protected int[] |
sumPenaltyNumber |
protected int[][] |
sumPenaltyParam |
protected double[][] |
sumPlusOrMinus |
protected boolean |
trueFreq |
protected double[] |
tValues |
protected double[] |
values |
protected double[] |
weight |
protected int |
weightFlag |
protected boolean |
weightOpt |
protected double[][] |
xData |
protected double[] |
yCalc |
protected double[] |
yData |
protected boolean |
zeroCheck |
| Constructor and 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
|
| Modifier and Type | Method and 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,
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 ArrayList<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(Object regFun,
double[] start,
double[] step,
double fTol,
int nMax)
Nelder and Mead Simplex Simplex Non-linear Regression
|
protected int |
pseudoLinearStats(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(Object regFun,
double[] testParameter)
Calculate the sum of squares of the residuals for non-linear regression
|
protected static double histTol
protected int nData0
protected int nData
protected int nXarrays
protected int nYarrays
protected int nTerms
protected int degreesOfFreedom
protected double[][] xData
protected double[] yData
protected double[] yCalc
protected double[] weight
protected double[] residual
protected double[] residualW
protected boolean weightOpt
protected int weightFlag
protected double[] best
protected double[] bestSd
protected double[] pseudoSd
protected double[] tValues
protected double[] pValues
protected double chiSquare
protected double reducedChiSquare
protected double sumOfSquares
protected double lastSSnoConstraint
protected double[][] covar
protected double[][] corrCoeff
protected double sampleR
protected double sampleR2
protected double adjustedR
protected double adjustedR2
protected double multipleF
protected double adjustedF
protected boolean linNonLin
protected boolean trueFreq
protected boolean nlrStatus
protected int scaleOpt
protected double[] fscale
protected boolean zeroCheck
protected boolean penalty
protected boolean sumPenalty
protected int nConstraints
protected int nSumConstraints
protected int maxConstraintIndex
protected double constraintTolerance
protected int[] penaltyCheck
protected int[] sumPenaltyCheck
protected double penaltyWeight
protected int[] penaltyParam
protected int[][] sumPenaltyParam
protected double[][] sumPlusOrMinus
protected int[] sumPenaltyNumber
protected double[] constraints
protected double[] sumConstraints
protected int constraintMethod
protected int nMax
protected int nIter
protected int konvge
protected int kRestart
protected double fMin
protected double fTol
protected double rCoeff
protected double eCoeff
protected double cCoeff
protected double[] startH
protected double[] step
protected double dStep
protected double[][] grad
protected double delta
protected boolean invertFlag
protected boolean posVarFlag
protected int minTest
protected double simplexSd
protected boolean statFlag
protected boolean multipleY
protected double[] values
protected boolean[] fixed
protected boolean ignoreDofFcheck
protected boolean nFactorOption
public NonLinearRegressionFitter(double[] xxData,
double[] yData)
xxData - ???yData - ???public NonLinearRegressionFitter(double[] xxData,
double[] yData,
double[] weight)
xxData - ???yData - ???weight - ???public NonLinearRegressionFitter(double[] xxData,
double[][] yyData)
xxData - ???yyData - ???public NonLinearRegressionFitter(double[] xxData,
double[][] yyData,
double[][] wWeight)
xxData - ???yyData - ???wWeight - ???public NonLinearRegressionFitter(double[][] xData,
double[] yData)
xData - ???yData - ???public NonLinearRegressionFitter(double[][] xData,
double[] yData,
double[] weight)
xData - ???yData - ???weight - ???public NonLinearRegressionFitter(double[][] xxData,
double[][] yyData)
xxData - ???yyData - ???public NonLinearRegressionFitter(double[][] xxData,
double[][] yyData,
double[][] wWeight)
xxData - ???yyData - ???wWeight - ???public void addConstraint(int paramIndex,
int conDir,
double constraint)
paramIndex - parameter indexconDir - ???constraint - ???public void addConstraint(int[] paramIndices,
double[] plusOrMinus,
int conDir,
double constraint)
paramIndices - parameter indicesplusOrMinus - positive/negative range constraintconDir - direction of fit constraintconstraint - ???public void addConstraint(int[] paramIndices,
int[] plusOrMinus,
int conDir,
double constraint)
paramIndices - parameter indicesplusOrMinus - positive/negative range constraintconDir - direction of fit constraintconstraint - ???protected double[] checkForZeroWeights(double[] weight)
weight - weight vectorpublic double checkYallSmall(double yPeak,
String ss)
yPeak - ???ss - ???public void checkZeroNeg(double[] xx,
double[] yy,
double[] ww)
xx - ???yy - ???ww - ???public void enterData(double[] xxData,
double[] yData)
xxData - ???yData - ???public void enterData(double[] xxData,
double[] yData,
double[] weight)
xxData - ???yData - ???weight - ???public void enterData(double[] xxData,
double[][] yyData)
xxData - ???yyData - ???public void enterData(double[] xxData,
double[][] yyData,
double[][] wWeight)
xxData - 1D arrayyyData - 2D arraywWeight - ???public void enterData(double[][] xData,
double[] yData)
xData - ???yData - ???public void enterData(double[][] xData,
double[] yData,
double[] weight)
xData - 2D arrayyData - 1D arrayweight - 1D arraypublic void enterData(double[][] xxData,
double[][] yyData)
xxData - ???yyData - ???public void enterData(double[][] xxData,
double[][] yyData,
double[][] wWeight)
xxData - ???yyData - ???wWeight - ???protected void generalLinearStats(double[][] xd)
xd - ???public double getAdjustedR()
public double getAdjustedR2()
public double[] getBestEstimates()
public double[] getBestEstimatesErrors()
public double[] getBestEstimatesStandardDeviations()
public double getChiSquare()
public double getchiSquareProb()
public double[] getCoeff()
public double[] getCoeffSd()
public double[] getCoeffVar()
public double[][] getCorrCoeffMatrix()
public double[][] getCovMatrix()
public double getDegFree()
public double getDelta()
public double[][] getGrad()
public boolean getInversionCheck()
public int getMinTest()
public double getMultipleF()
public int getNiter()
public boolean getNlrStatus()
public int getNmax()
public double getNMcontract()
public double getNMextend()
public double getNMreflect()
public int getNrestarts()
public int getNrestartsMax()
public boolean getPosVarCheck()
public double[] getPseudoErrors()
public double[] getPseudoSd()
public double[] getPvalues()
public double getReducedChiSquare()
public double[] getResiduals()
public double getSampleR()
public double getSampleR2()
public double[] getScale()
public double getSimplexSd()
public double getSumOfSquares()
public double getTolerance()
public boolean getTrueFreq()
public double[] getTvalues()
public double[] getWeightedResiduals()
public double[][] getXdata()
public double[] getYcalc()
public double[] getYdata()
public void ignoreDofFcheck()
public boolean infinityCheck(double yPeak,
int peaki)
yPeak - ???peaki - ???protected void multCorrelCoeff(double[] yy,
double[] yyCalc,
double[] ww)
yy - ???yyCalc - ???ww - ???protected void nelderMead(Object regFun, double[] start, double[] step, double fTol, int nMax)
regFun - function to be fitted tostart - initial parameter valuesstep - initial parameter step valuesfTol - tolerancenMax - maximum number of iterationsprotected int pseudoLinearStats(Object regFun)
regFun - test functionpublic void removeConstraints()
public void setConstraintTolerance(double tolerance)
tolerance - fitting tolerance thresholdprotected void setDefaultValues(double[][] xData,
double[] yData,
double[] weight)
xData - ???yData - ???weight - ???public void setDelta(double delta)
delta - non-linear regression fractional step size used in numerical differencingpublic void setMinTest(int n)
n - 0 or 1public void setNmax(int nmax)
nmax - maximum number of iterationspublic void setNMcontract(double con)
con - Nelder and Mead contraction coefficient [gamma]public void setNMextend(double ext)
ext - extension coefficient betapublic void setNMreflect(double refl)
refl - alpha parameterpublic void setNrestartsMax(int nrs)
nrs - maximum number of restarts allowed in nonlinear regressionpublic void setScale(double[] sc)
sc - scaling factorpublic void setScale(int n)
n - 0 or 1public void setTolerance(double tol)
tol - non-linear regression tolerancepublic void setTrueFreq(boolean trFr)
trFr - ???public void simplex(Function1D g, double[] start)
g - functionstart - initial parameter valuespublic void simplex(Function1D g, double[] start, double fTol)
g - functionstart - initial parameter valuesfTol - fitting tolerancepublic void simplex(Function1D g, double[] start, double fTol, int nMax)
g - functionstart - initial parameter valuesfTol - fitting tolerancenMax - maximum number of iterationspublic void simplex(Function1D g, double[] start, double[] step)
g - functionstart - initial parameter valuesstep - initial parameter step valuespublic void simplex(Function1D g, double[] start, double[] step, double fTol)
g - functionstart - initial parameter valuesstep - initial parameter step valuesfTol - fitting tolerancepublic void simplex(Function1D g, double[] start, double[] step, double fTol, int nMax)
g - functionstart - initial parameter valuesstep - initial parameter step valuesfTol - fitting tolerancenMax - maximum number of iterationspublic void simplex(Function1D g, double[] start, double[] step, int nMax)
g - functionstart - initial parameter valuesstep - initial parameter step valuesnMax - maximum number of iterationspublic void simplex(Function1D g, double[] start, int nMax)
g - functionstart - initial parameter valuesnMax - maximum number of iterations@Deprecated public void simplex2(FunctionND g, double[] start)
g - function to fitstart - initial parameter values@Deprecated public void simplex2(FunctionND g, double[] start, double fTol)
g - function to fitstart - initial parameter valuesfTol - fitting tolerance@Deprecated public void simplex2(FunctionND g, double[] start, double fTol, int nMax)
g - function to fitstart - initial parameter valuesfTol - fitting tolerancenMax - maximum number of iterations@Deprecated public void simplex2(FunctionND g, double[] start, double[] step)
g - functionstart - initial parameter valuesstep - initial parameter step values@Deprecated public void simplex2(FunctionND g, double[] start, double[] step, double fTol)
g - functionstart - initial parameter valuesstep - initial parameter step valuesfTol - fitting tolerance@Deprecated public void simplex2(FunctionND g, double[] start, double[] step, double fTol, int nMax)
g - functionstart - initial parameter valuesstep - initial parameter step valuesfTol - fitting tolerancenMax - maximum number of iterations@Deprecated public void simplex2(FunctionND g, double[] start, double[] step, int nMax)
g - functionstart - initial parameter valuesstep - initial parameter step valuesnMax - maximum number of iterations@Deprecated public void simplex2(FunctionND g, double[] start, int nMax)
g - function to fitstart - initial parameter valuesnMax - maximum number of iterationsprotected double sumSquares(Object regFun, double[] testParameter)
regFun - test functiontestParameter - test parameter@Deprecated protected static ArrayList<Object> dataSign(double[] data)
data - input dataprotected static double halfWidth(double[] xData,
double[] yData)
xData - x coordinate of input datayData - y coordinate of input dataprotected static boolean setTrueFreqWeights(double[] yData,
double[] weight)
protected static void sort(double[] x,
double[] y,
double[] w)
x - ???y - ???w - ???Copyright © 2020 GSI Helmholtzzentrum für Schwerionenforschung GmbH. All rights reserved.