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:
| Name | Type | Description |
|---|
| AutoUpdate | bool | If true then changing any of the TMtxNonLinReg properties will trigger the TMtxNonLinReg::Recalc method. |
| B | TVec* | Stores the regression coefficients. |
| BlockAssign | bool | Block streaming of specific properties when storing only a "template". |
| DeriveProcedure | TDeriveProc | Defines derivatives of regression function. |
| Dirty | bool | When any of the TMtxNonLinReg properties changes, this property is automatically set to true. |
| EditorActive | bool | Returns True, if the component editor is displayed. |
| GradTolerance | double | Defines minimal allowed gradient C-Norm. |
| MaxIteration | int | Defines one of the conditions for terminating the regression coefficient calculation. |
| Name | DewString | |
| OptMethod | TOptMethod | Optimization method used. |
| Reference | TReferenceList* | Stores a list of components that have to be notified, when this component is destroyed. |
| RegressFunction | TRegressFun | Defines the regression function of several regression parameters. |
| SoftSearch | bool | Defines line search algorithm for Quasi-Newton and Conjugate methods. |
| StopReason | TOptStopReason | Returns the reason why regression parameters calculation stopped. |
| Tolerance | double | Defines one of the conditions for terminating the regression coefficient calculation. |
| UseWeights | bool | Weighted non-linear regression. |
| Verbose | tStrings* | If not nil then the optimization method uses it for logging each optimization step. |
| Weights | TVec* | Weights. |
| X | TVec* | Vector of independant variables. |
| Y | TVec* | Vector of the dependant variable. |
| YCalc | TVec* | Vector of calculated values. |