Stats Master VCL
|
Defines the regression function of several regression parameters.
property RegressFunction: TMultiRegressFun;
In the following example we define general polynomial of second degree (three parameters) and also the procedure for derivatives:
// y=b0*x*x + b1*x + b2 i.e. parabola procedure SimpleParabola(const B: TVec; const X: TVecList; const Y: TVec): double; begin // SimpleParabola := b[0]*Sqr(x) + b[1]*x + b[2]; y.Sqr(x[0]); y.Scale(b[0)); y.AddScaled(x[0], b[1]); y.Add(b[2]); end; // procedure for derivatives procedure SimplePabolaDeriv(const RegressFun: TRegressFun; const X: TVecList const Y: TVec; const Pars: TVec; const Grad: TVecList); begin Grad[0].Sqr(x[0]); // Grad[0] := Sqr(x); Grad[1].Copy(x[0]); // Grad[1] := x; Grad[2].Size(x[0]); // Grad[2] := 1; Grad[2].SetVal(1); end; begin // ... MtxNonLinReg1.RegressFunction := SimpleParabola; MtxNonLinReg1.DeriveProcedure := SimpleParabolaDeriv; end;
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
|
What do you think about this topic? Send feedback!
|