You are here: Symbol Reference > Regress Namespace > Types > Regress.TMultiRegressFun Type
Stats Master VCL
ContentsIndex
PreviousUpNext
Regress.TMultiRegressFun Type

Defines multiple regression function.

Pascal
TMultiRegressFun = procedure (const B: TVec; const X: TVecList; const Y: TVec);

The type describes the vectorized regression function of several regression parameters (B array) and multiple independent variables X. The TMultiRegressFun is used in several regression procedure. The X holds a list of independent variables and the result of the function is stored in to the Y parameter. The const parameter of "y" applies to the pointer and not to the contents of the object. When performance is not an issue, the TRegressFun can be easier to use.

Some examples of regression function: Polynomial of 2nd degree (parabola)

// y=b0*x*x + b1*x + b2
procedure SimpleParabola(const B: TVec; const X: TVecList; const y: TVec);
begin
   y.Sqr(x[0]);
   y.Scale(b[0]); //y = b[0]*sqr(x)
   y.AddScaled(x[0], b[1]);  //y = y + x*b[1];
   y.Add(b[2]);
end;
void __fastcall SimpleParabola(TVec * const b, TVecList * const x, TVec * const y)
{
   double* B = b->PValues1D(0);

   y->Sqr(x[0]);
   y->Scale(B[0]); //y = b[0]*sqr(x)
   y->AddScaled(x[0], B[1]);  //y = y + x*b[1];
   y->Add(B[2]);
}
Examples on GitHub

"Eckerle4" function from NIST files:

procedure Eckerle4(const B: TVec; const X: TVecList; const y: TVec);
begin
  //B[0]/B[1] * Exp(-0.5*Sqr((X-B[2])/B[1]));

  y.Normalize(X[0], B[2], B[1]);
  y.Sqr;
  y.Scale(-0.5);
  y.Exp;
  y.Scale(B[0]/B[1]);
end;
void __fastcall Eckerle4(TVec* const b, TVecList* const x, TVec * const y)
{
  double* B = b->PValues1D(0);

  y.Normalize(X[0], B[2], B[1]);
  y.Sqr();
  y.Scale(-0.5);
  y.Exp();
  y.Scale(B[0]/B[1]);
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!