You are here: Symbol Reference > RegModels Namespace > Functions > RegModels.LineEval Function
Stats Master VCL
ContentsIndex
PreviousUpNext
RegModels.LineEval Function

Evaluates b[0] + b[1]*X for given values in X vector, parameters in B array, and returns the results in XHat vector.

Pascal
procedure LineEval(Const B: Array of double; const X: TVec; const YHat: TVec); overload;

Size and Complex properties of XHat vector are adjusted automatically.

Use this version if you want to evaluate linear function for multiple values at the same time. This is a lot faster than calling single value version for each x value.

Evaluate linear function for multiple values at the same time.

Uses MtxExpr, MtxVecTee, Series, RegModels;
procedure Example(Series1: TLineSeries);
  var Y,X: Vector;
begin
  X.Size(100);
  X.Ramp(-5.0, 0.05); // x= -5.0, -4.95, ... -0.05
  // Y = b[0] + b[1]*X
  LineEval([1,3],X,Y);
  DrawValues(X,Y,Series1,false);
end;
#include "Math387.hpp"
#include "RegModels.hpp"
#include "MtxExpr.hpp"
#include "MtxVecTee.hpp"
void __fastcall Example(TLineSeries* series);
{
  sVector X,Y;
  X.Size(100,false);
  X.Ramp(-5.0, 0.1); // x= -5.0, -4.9, ..., +4.9
  LineEval(OPENARRAY(double,(1.0, 3.0)),X,Y);
  DrawValues(X,Y,series,false);
}
Examples on GitHub
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!