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

In the following example we generate some data. Then we fit multiple linear function to this data and retreive it's regression coefficients.

Uses MtxExpr, RegModels;
procedure Example);
var Y,B: Vector;
  X: Matrix;
begin
  X.SetIt(3,2,false,[1.0, 2.0,
                    -3.2, 2.5,
                    8.0, -0.5]);
  Y.SetIt(false, [-3.0, 0.25, 8.0]);
  MulLinFit(B,X,Y,true);
  // B = (18.646428571, -1.9464285714, -9.85 )
end;
#include "MtxExpr.hpp"
#include "Math387.hpp"
#include "RegModels.hpp"
#include "MtxVecTee.hpp"
void __fastcall Example();
{
  sMatrix X;
  sVector Y,B;
  X->SetIt(3,2,false,OPENARRAY(double,(1.0, 2.0,
            -3.2, 2.5,
            8.0, -0.5)));
  Y->SetIt(false, OPENARRAY(double,(-3.0, 0.25, 9.0)));
  MulLinFit(B,X,Y,true,NULL);
  // B = (18.646428571, -1.9464285714, -9.85 )
}
Copyright (c) 1999-2025 by Dew Research. All rights reserved.