ForecastSeasonality: IForecast;
The ForecastSeasonality property determines parameters of forecasting series dependence form adjusted for 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;
Dep: IDependenceForm;
ForecastS: 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;
status := trend.Execute;
If status <> 0 Then
Debug.WriteLine(trend.Errors);
Else
Forms := trend.DependenceForms;
Dep := Forms.Item(1);
d0 := Dep.CriterionValue;
Debug.WriteLine("Dependence form " + Dep.DisplayName);
Debug.WriteLine("Criterion value "+ ": " + d0.ToString);
ForecastS := Dep.ForecastSeasonality;
Debug.WriteLine("=== Forecast series with seasonality ===");
For i := trend.ModelPeriod.LastPoint To ForecastS.Value.Length -1 Do
d0 := ForecastS.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 with seasonality===
20: 9344.6499999999978
21: 9752.1763157894729
22: 10257.854921394395
23: 10698.885816814762
24: 11139.819002050579
25: 11610.554477101843
26: 12179.442241968556
27: 12683.682296650715
28: 13187.824641148321
29: 13721.769275461376
Module execution finished
See also: