TMtxNonLinReg Class

Header: Dew.Stats/StatTools.h · Cross-compiler
tObjectTMtxComponentTMtxNonLinReg

class TMtxNonLinReg : public TMtxComponent;

Performs nonlinear regression.

How to use TMtxNonLinReg component?

  • Drop a TMtxNonLinReg component on the form.
  • Define TMtxNonLinReg::X the vector of independent variables.
  • Define TMtxNonLinReg::Y the vector of dependent variables. Make sure that X and Y have the same length.
  • Define initial estimates for TMtxNonLinReg::B regression parameters.
  • (Optionaly) define TMtxNonLinReg::Weights. If you'll use weights, set TMtxNonLinReg::UseWeights property to true.
  • Define regression function.
  • (Optionally) define the derivative procedure. If you don't define derivative procedure then the numeric approximation will be used to calculate the derivative at specific point.
  • Define the optimization method. Depending on your function different methods will give better/worse results.
  • (Optionally) define desired tolerance for result.
  • Define the maximum number of steps for optimization method. Internal optimization method will stop when number of iterations exceeds MaxIter or internal minimum precision is within Tolerance.
  • Verbose property, if assigned, stores Fun, evaluated at each iteration step. Optionally, you can also assign TOptControl object to the Verbose property. This allows the optimization procedure to be interrupted from another thread and optionally also allows logging and iteration count monitoring.

In case of performance problems consider using TMtxMultiNonLinReg. That component internally performs vectorized optimization process. It can also be used to speed-up nonlinear regression with only one independent variable by 10-20x.

Results:

Constructors

NameDescription
TMtxNonLinReg (2)

Destructors

NameDescription
~TMtxNonLinReg

Properties

NameTypeDescription
AutoUpdateboolIf true then changing any of the TMtxNonLinReg properties will trigger the TMtxNonLinReg::Recalc method.
BTVec*Stores the regression coefficients.
BlockAssignboolBlock streaming of specific properties when storing only a "template".
DeriveProcedureTDeriveProcDefines derivatives of regression function.
DirtyboolWhen any of the TMtxNonLinReg properties changes, this property is automatically set to true.
EditorActiveboolReturns True, if the component editor is displayed.
GradTolerancedoubleDefines minimal allowed gradient C-Norm.
MaxIterationintDefines one of the conditions for terminating the regression coefficient calculation.
NameDewString
OptMethodTOptMethodOptimization method used.
ReferenceTReferenceList*Stores a list of components that have to be notified, when this component is destroyed.
RegressFunctionTRegressFunDefines the regression function of several regression parameters.
SoftSearchboolDefines line search algorithm for Quasi-Newton and Conjugate methods.
StopReasonTOptStopReasonReturns the reason why regression parameters calculation stopped.
TolerancedoubleDefines one of the conditions for terminating the regression coefficient calculation.
UseWeightsboolWeighted non-linear regression.
VerbosetStrings*If not nil then the optimization method uses it for logging each optimization step.
WeightsTVec*Weights.
XTVec*Vector of independant variables.
YTVec*Vector of the dependant variable.
YCalcTVec*Vector of calculated values.

Methods

NameDescription
AllowStreamingReturns the negatated value of BlockAssign.
AssignAssign values of all published properties from Source.
AssignTemplateAssign values of "template-like" published properties from Source.
EditorClassTo be overriden in descendanr classses.
LoadFromStreamLoad the component from Src stream.
LoadTemplateFromFileLoad a template from file.
LoadTemplateFromStreamLoad a template from stream.
RecalcTriggers non-linear regression recalculation.
ReferenceRemoved
ResetReset is called after loading the data from stream or file.
SaveTemplateToFileSave template to file.
SaveTemplateToStreamSave template to stream.
SaveToStreamSave the component to Dst stream.

Fields

NameTypeDescription
IterationsintNumber of iterations needed to converge to solution.
Tagintptr_t