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

The following example performs ordinal logistic regression. There are three levels of response and two intercepts in the output to distinguish the three levels.

Uses Math387, MtxExp, Regress, Optimization;
procedure Example;
var y, b, theta, StdErr: Vector;
    A: Matrix;
    FMin: double;
    StopReason: TOptStopReason;
begin
   y.SetIt(false,[1,1,2,1,3,2,3,2,3,3]);
  A.SetIt(false,10,1,[1,
                      2,
                      3,
                      4,
                      5,
                      6,
                      7,
                      8,
                      9,
                      10]);
  LogisticRegress(y,A,b,theta,StdErr,FMin,StopReason);
  // b = (0.801), theta=(2.779,5.366)
end;
#include "MtxExpr.hpp"
#include "Regress.hpp"
#include "Math387.hpp"
void __fastcall Example()
{
  sMatrix A;
  sVector y,b,theta,se;
  double min;
  TOptStopReason stopreason;

  y.SetIt(false,OPENARRAY(double,(1,1,2,1,3,2,3,2,3,3)));
  A.SetIt(10,1,false,OPENARRAY(double,(1,2,3,4,5,6,7,8,9,10)));
  LogisticRegress(y,A,b,theta,se,min,stopreason);
  // b = (0.801), theta=(2.779,5.366)
Copyright (c) 1999-2025 by Dew Research. All rights reserved.