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

Logistic regression.

Pascal
procedure LogisticRegress(const y: TVec; const n: TVec; const b: TVec; const A: TMtx = nil; Offset: double = 0.0; const YCalc: TVec = nil; const BStd: TVec = nil; Tolerance: double = EPS); overload;
Parameters 
Description 
response vector containing binomial counts. 
number of trials for each count. Y is assumed to be binomial(p,N). 
regression parameter estimates. 
matrix of covariates, including the constant vector if required. 
Offset 
offset if required. 
YCalc 
fitted values. 
BStd 
Regression parameter estimates errors.This is an estimate of the precision of the B estimates. 
Tolerance 
Default precision for reweighted LQR. 

Fit logistic regression model.

The following example calculates coefficients for simple logistic regression. The counts are out of 10 in each case and there is one covariate[1].

Uses MtxExpr, Regress;
procedure Example;
var y,n,B: Vector;
begin
  y.SetIt(false,[2,0,3,1,5,5,6,9,5,9]);
  n.Size(y);
  n.SetVal(10.0);

  LogisticRegress(y,n,B);
end;
#include "MtxExpr.hpp"
#include "Regress.hpp"
#include "Math387.hpp"
void __fastcall Example()
{
  sVector y,n,B,ycalc;
  y.SetIt(false,OPENARRAY(double,(2,0,3,1,5,5,6,9,5,9)));
  n.Size(y);
  n.SetVal(10.0);

  LogisticRegress(y,n,B);
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!