Explained: IEmSerie;
Explained: Prognoz.Platform.Interop.Modeller.IEmSerie;
The Explained property determines explained series.
If the explanatory series is not specified, correct calculation of the Chow Stability Test method is not possible.
To execute the example, add links to the Modeller, Stat system assemblies.
Sub ChowTest;
Var
ExprMod: IExpressModeller;
Ar: Array[14] Of Double;
Series: IEmSeries;
Serie: IEmSerie;
Sett: IEmChowTestSettings;
ExpList: IEmSeriesList;
Period: IEmPeriodSettings;
Gr: Array[14] Of Integer;
Begin
ExprMod := New ExpressModeller.Create;
Ar[0] := 56; Ar[1] := 45; Ar[2] := 23; Ar[3] := 45;
Ar[4] := 65; Ar[5] := 23; Ar[6] := 54; Ar[7] := 87;
Ar[8] := 67; Ar[9] := 98; Ar[10] := 89; Ar[13] := 79;
Ar[11] := Double.Nan; Ar[12] := Double.Nan;
ExprMod.Series.Add(Ar, "X1", "Data series 1");
Ar[0] := 58; Ar[1] := 50; Ar[2] := 26; Ar[4] := 72;
Ar[5] := 28; Ar[6] := 62; Ar[7] := 95; Ar[8] := 74;
Ar[10] := 94; Ar[11] := 100; Ar[12] := 54; Ar[13] := 81;
Ar[3] := Double.Nan; Ar[9] := Double.Nan;
ExprMod.Series.Add(Ar, "X2", "Data series 2");
Sett := ExprMod.CreateChowTestSettings;
Series := ExprMod.Series;
// Setting explained series
Serie := Series.ItemByName("X1");
Sett.Explained := Serie;
// Setting explanatory series
Serie := Series.ItemByName("X2");
ExpList := Sett.Explanatories;
ExpList.Add(Serie);
// Using constant in the calculation
Sett.HasConstant := True;
// Setting test type
Sett.TestType := ChowTestType.Forecast;
// Setting significance level
Sett.ConfidenceLevel := 0.1;
// Grouping the observations
Gr[0] := 0; Gr[1] := 0; Gr[2] := 0; Gr[3] := 0;
Gr[4] := 0; Gr[5] := 1; Gr[6] := 1; Gr[7] := 1;
Gr[8] := 1; Gr[9] := 1; Gr[10] := 1; Gr[11] := 1;
Gr[12] := 1; Gr[13] := 1;
Sett.GroupSeparator := Gr;
// Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 0;
Period.EndPeriod := 13;
// Performing calculation
ExprMod.EvaluateMethod("C:\ChowTest.html", Sett, True);
End Sub ChowTest;
Example execution result: the Chow Stability Test method is calculated with set parameters, calculation report is saved to the file C:\ChowTest.html.
Imports Prognoz.Platform.Interop.Modeller;
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
ExprMod: IExpressModeller;
Ar: Array[14] Of Double;
Series: IEmSeries;
Serie: IEmSerie;
Sett: IEmChowTestSettings;
ExpList: IEmSeriesList;
Period: IEmPeriodSettings;
Gr: Array[14] Of Integer;
Begin
ExprMod := New ExpressModeller.Create();
Ar[0] := 56; Ar[1] := 45; Ar[2] := 23; Ar[3] := 45;
Ar[4] := 65; Ar[5] := 23; Ar[6] := 54; Ar[7] := 87;
Ar[8] := 67; Ar[9] := 98; Ar[10] := 89; Ar[13] := 79;
Ar[11] := Double.Nan; Ar[12] := Double.Nan;
ExprMod.Series.Add(Ar, "X1", "Data series 1");
Ar[0] := 58; Ar[1] := 50; Ar[2] := 26; Ar[4] := 72;
Ar[5] := 28; Ar[6] := 62; Ar[7] := 95; Ar[8] := 74;
Ar[10] := 94; Ar[11] := 100; Ar[12] := 54; Ar[13] := 81;
Ar[3] := Double.Nan; Ar[9] := Double.Nan;
ExprMod.Series.Add(Ar, "X2", "Data series 2");
Sett := ExprMod.CreateChowTestSettings();
Series := ExprMod.Series;
// Setting explained series
Serie := Series.ItemByName["X1"];
Sett.Explained := Serie;
// Setting explanatory series
Serie := Series.ItemByName["X2"];
ExpList := Sett.Explanatories;
ExpList.Add(Serie);
// Using constant in the calculation
Sett.HasConstant := True;
// Setting test type
Sett.TestType := ChowTestType.ctForecast;
// Setting significance level
Sett.ConfidenceLevel := 0.1;
// Grouping the observations
Gr[0] := 0; Gr[1] := 0; Gr[2] := 0; Gr[3] := 0;
Gr[4] := 0; Gr[5] := 1; Gr[6] := 1; Gr[7] := 1;
Gr[8] := 1; Gr[9] := 1; Gr[10] := 1; Gr[11] := 1;
Gr[12] := 1; Gr[13] := 1;
Sett.GroupSeparator := Gr;
// Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 0;
Period.EndPeriod := 13;
// Performing calculation
ExprMod.EvaluateMethod("C:\ChowTest.html", Sett, True);
End Sub;
Example execution result: the Chow Stability Test method is calculated with set parameters, calculation report is saved to the file C:\ChowTest.html.
See also: