You are here: Symbol Reference > StatTools Namespace > Classes > TMtxMultiNonLinReg Class > TMtxMultiNonLinReg Properties > TMtxMultiNonLinReg.RegressFunction Property
Stats Master VCL
ContentsIndex
PreviousUpNext
TMtxMultiNonLinReg.RegressFunction Property

Defines the regression function of several regression parameters.

Pascal
property RegressFunction: TMultiRegressFun;

Defines the regression function of several regression parameters B and independent variable X.

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;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!