ISlQualitySet.Prediction

Syntax

Prediction: Integer;

Description

The Prediction property determines the number of predicted values.

Example

This example describes setting calculation parameters for the Binary Regression method.

Sub Main;

Var

bm: SmBinaryModel;

can: Array Of Double;

bin2: Array Of Integer;

i, res, mm: Integer;

Intercept: IIntercept;

Explanatories: ISlSeries;

GuessingTable: ISlQualityTable;

GuessTableItem: ISlQualitySet;

Begin

// Specify 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;

// Specify 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;

// Specify values for the first and the last sample period points

bm.ModelPeriod.FirstPoint := 1;

bm.ModelPeriod.LastPoint := 5;

// Specify value of the last forecast point

bm.Forecast.LastPoint := 14;

// Specify method of constant estimation

Intercept := bm.ModelCoefficients.Intercept;

Intercept.Mode := InterceptMode.AutoEstimate;

// Specify method of missing data treatment

bm.MissingData.Method := MissingDataMethod.SampleAverage;

// Specify model type

bm.BinaryDistr := BinaryDistrType.Probit;

// Set value for group division and accuracy

bm.ClassificationCutOff := 0.5;

bm.Tolerance := 0.001;

// Specify explained series

bm.BinaryExplained := bin2;

// Specify explanatory series

Explanatories := bm.Explanatories;

Explanatories.Add.Value := can;

Explanatories.Item(0).Include := True;

// Perform calculations and show error messages

bm.Execute;

Debug.WriteLine(bm.Errors);

// Show calculation results

If (res = 0) Then

// Table of binary model selection quality

Debug.WriteLine("Description of selection quality");

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;

End If;

End Sub Main;

After executing the example calculation parameters are set. The console window displays calculation results and values describing quality of binary model selection:

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:

ISlQualitySet