GuessingTable: ISlQualityTable;
The GuessingTable property returns a collection of values that describe the quality of binary model selection.
The collection of values forms the following table:
Fact (ISlQualitySet.Actual) |
Predicted (ISlQualitySet.Prediction) |
Predicted correctly (ISlQualitySet.CorrectPrediction) |
|
Number: 0 | 3 | 3 | 2 |
Number: 1 | 2 | 2 | 1 |
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
bm: SmBinaryModel;
can: Array[9] Of Double;
bin2: Array[5] Of Integer;
i, res, mm: Integer;
Intercept: IIntercept;
Explanatories: ISlSeries;
GuessingTable: ISlQualityTable;
GuessTableItem: ISlQualitySet;
Begin
bm := New SmBinaryModel.Create;
// Set values of explanatory series
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[00] := 1; bin2[03] := 0;
bin2[01] := 1; bin2[04] := 0;
bin2[02] := 0;
// 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 := 9;
// Set model type
bm.BinaryDistr := BinaryDistrType.Probit;
// Set value of group division and accuracy
bm.ClassificationCutOff := 0.5;
bm.Tolerance := 0.001;
// Set method of calculating the constant
Intercept := bm.ModelCoefficients.Intercept;
Intercept.Mode := InterceptMode.AutoEstimate;
// Set explained series
bm.BinaryExplained := bin2;
// Set explanatory series
Explanatories := bm.Explanatories;
Explanatories.Add.Value := can;
// Perform calculation and display error messages
res:= bm.Execute;
// Display calculation results
If (res = 0) Then
// Table of binary model fitting quality
Debug.WriteLine("Fitting quality description");
GuessingTable := bm.GuessingTable;
For mm := 0 To 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;
Else
Debug.WriteLine(bm.Errors);
End If;
End Sub UserProc;
After executing the example the console window displays calculation results and values describing quality of binary model selection:
Selection quality description
0. Fact: 3
0. Predicted: 3
0. Predicted correctly: 2
1. Fact: 2
1. Predicted: 2
1. Predicted correctly: 1
See also: