ISlQualityTable.Count

Syntax

Count: Integer;

Description

The Count property returns the number of rows in a table.

Example

This example describes setting calculation parameters for the Binary Regression method. Add a link to the system assembly Stat.

Sub UserProc;
Var
    bm: SmBinaryModel;
    can: Array Of Double;
    bin2: Array Of Integer;
    i, res, mm: Integer;
    Intercept: IIntercept;
    Explanatories: ISlSeries;
    GuessingTable: ISlQualityTable;
    GuessTableItem: ISlQualitySet;
Begin
// Set explanatory series values
    can := New double[9];
    can[00] := 6.209; can[05] := 5;
    can[01] := 6.385; can[06] := 6;
    can[02] := 6.29; can[07] := 7;
    can[03] := 6.25; can[08] := 8;
    can[04] := 6.1;
// Set explained series values
    bin2 := New integer[5];
    bin2[00] := 1; bin2[03] := 0;
    bin2[01] := 1; bin2[04] := 0;
    bin2[02] := 0;
    bm := New SmBinaryModel.Create;
// Set values for the first and the last points of the identification period
    bm.ModelPeriod.FirstPoint := 1;
    bm.ModelPeriod.LastPoint := 5;
// Set value for the last forecast point
    bm.Forecast.LastPoint := 14;
// Select constant estimation method
    Intercept := bm.ModelCoefficients.Intercept;
    Intercept.Mode := InterceptMode.AutoEstimate;
// Select missing data treatment method
    bm.MissingData.Method := MissingDataMethod.SampleAverage;
// Select model type
    bm.BinaryDistr := BinaryDistrType.Probit;
// Set value of group division and accuracy
    bm.ClassificationCutOff := 0.5;
    bm.Tolerance := 0.001;
// Set explained series
    bm.BinaryExplained := bin2;
// Set explanatory series
    Explanatories := bm.Explanatories;
    Explanatories.Add.Value := can;
    Explanatories.Item(0).Include := True;
// Perform calculation and display error  messages
    bm.Execute;
    Debug.WriteLine(bm.Errors);
// Display calculation results
    If (res = 0Then
    // Table of binary model fitting quality
        Debug.WriteLine("Fitting quality description");
        GuessingTable := bm.GuessingTable;
        For mm := 0 To GuessingTable.Count - 1 Do
            GuessTableItem := GuessingTable.Item(mm);
            i := GuessTableItem.Actual;
            Debug.WriteLine(mm.ToString + ". Fact: " + i.ToString);
            i := GuessTableItem.Prediction;
            Debug.WriteLine(mm.ToString + ". Predicted: " + i.ToString);
            i := GuessTableItem.CorrectPrediction;
            Debug.WriteLine(mm.ToString + ". Predicted correctly: " + i.ToString);
        End For;
        GuessingTable.Clear;
    End If;
End Sub UserProc;

After executing the example calculation parameters are set. The console window displays calculation results and values describing quality of binary model selection. Then table of binary model fitting quality is to be cleared.

Module execution started

No errors

Selection quality description

0. Fact: 3

0. Predicted: 3

0. Predicted correctly: 2

1. Fact: 2

1. Predicted: 2

1. Predicted correctly: 1

Module execution finished

See also:

ISlQualityTable