Forecast: IForecast;
The Forecast property determines parameters of forecasting series dependence form without seasonality. The last forecast point and significance of confidence bounds are set in the ISmCurveEstimation.ForecastLastPoint and ISmCurveEstimation.ForecastConfidenceLevel properties respectively.
Sub Main;
Var
trend: SmCurveEstimation;
d0: Double;
status, i: Integer;
ar: Array Of Double;
Forms: IDependenceForms;
Forecast: IForecast;
Begin
trend := New SmCurveEstimation.Create;
ar := New Double[25];
ar[00] := 4110;
ar[01] := 4280;
ar[02] := 4459;
ar[03] := 4545;
ar[04] := 4664;
ar[05] := 4861;
ar[06] := 5195;
ar[07] := 5389;
ar[08] := 5463;
ar[09] := 5610;
ar[10] := 5948;
ar[11] := 6218;
ar[12] := 6521;
ar[13] := 6788;
ar[14] := 7222;
ar[15] := 7486;
ar[16] := 7832;
ar[17] := 8153;
ar[18] := 8468;
ar[19] := 9054;
ar[20] := 9499;
ar[21] := 9866;
ar[22] := 10217;
ar[23] := 10763;
ar[24] := 10683;
trend.Explained.Value := ar;
trend.Explanatory.IsTrend := True;
trend.ModelPeriod.LastPoint := 20;
trend.ForecastLastPoint := 30;
trend.SeasonalComponent.Mode := SeasonalityType.additive;
trend.SeasonalComponent.Cycle := 4;
Forms := trend.DependenceForms;
status := trend.Execute;
If status <> 0 Then
Debug.WriteLine(trend.Errors);
Else
d0 := Forms.Item(1).CriterionValue;
Debug.WriteLine("Dependence form " + Forms.Item(1).DisplayName);
Debug.WriteLine("Criterion value "+ ": " + d0.ToString);
Forecast := Forms.Item(1).Forecast;
Debug.WriteLine("=== Forecast series ===");
For i := trend.ModelPeriod.LastPoint To Forecast.Value.Length - 1 Do
d0 := Forecast.Value[i];
Debug.WriteLine(i.ToString + ", " + d0.ToString);
End For;
End If;
End Sub Main;
After executing the example the console window displays the following results:
Module execution started
Dependence form: Quadratic
Criterion value: 0.99853888260620427
=== Forecast series ===
20, 9359.9562499999975
21, 9785.0450657894726
22, 10225.936171394394
23, 10682.629566814761
24, 11155.125252050579
25, 11643.423227101843
26, 12147.523491968555
27, 12667.426046650715
28, 13203.130891148321
29, 13754.638025461376
Module execution finished
See also: