SeasonalMovingAverage: Array;
The SeasonalMovingAverage property determines initial values for seasonal moving average coefficients.
The number of coefficients depends on value of the SeasonalMovingAverageOrder property.
Default initial values of the coefficients are equal to 0.
Sub Main;
Var
ARIMA: SmArima;
d0: Double;
res, i: Integer;
can, InitialValuesAR: Array Of Double;
InitValues: IArimaSpecificationInitialValues;
Begin
ARIMA := New SmArima.Create;
can := New Double[25];
can[00] := 6209;
can[01] := 6385;
can[02] := 6752;
can[03] := 6837;
can[04] := 6495;
can[05] := 6907;
can[06] := 7349;
can[07] := 7213;
can[08] := 7061;
can[09] := 7180;
can[10] := 7132;
can[11] := 7137;
can[12] := 7473;
can[13] := 7722;
can[14] := 8088;
can[15] := 8516;
can[16] := 8941;
can[17] := 9064;
can[18] := 9380;
can[19] := 9746;
can[20] := 9907;
can[21] := 10333;
can[22] := 10863;
can[23] := 11693;
can[24] := 12242;
ARIMA.Serie.Value := can;
ARIMA.ArimaSpecification.AutoRegressionOrder := 1;
ARIMA.ArimaSpecification.MovingAverageOrder := 2;
ARIMA.ArimaSpecification.Cycle := 4;
ARIMA.ArimaSpecification.SeasonalAutoRegressionOrder := 1;
ARIMA.ArimaSpecification.SeasonalMovingAverageOrder := 2;
ARIMA.ArimaSpecification.SeasonalDifferenceOrder := 1;
ARIMA.ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;
ARIMA.Forecast.LastPoint := 50;
ARIMA.MaxIteration := 1000;
InitialValuesAR := New Double[2];
InitialValuesAR[0] := 0.1;
InitialValuesAR[1] := 0.1;
InitValues := ARIMA.InitialValueS;
InitValues.SeasonalMovingAverage := InitialValuesAR;
res := ARIMA.Execute;
Debug.WriteLine(res.ToString);
Debug.WriteLine("==== Forecast ====");
For i := ARIMA.ModelPeriod.LastPoint To ARIMA.Forecast.Value.GetUpperBound(1) Do
d0 := ARIMA.Forecast.Value[i];
Debug.WriteLine(i.ToString + ", " + d0.ToString);
End For;
End Sub Main;
After executing the example the console window displays forecast values:
Module execution started
0
==== Forecast ====
25, 12636.482109016037
26, 13041.24796445494
27, 13601.481085977053
28, 13931.505879643601
29, 14233.620526920235
30, 14578.697968022951
31, 14983.956610447251
32, 15188.40912091774
33, 15448.606272883246
34, 15772.078260862387
35, 16108.401867030516
36, 16257.816475780941
37, 16503.333840743326
38, 16821.648249549682
39, 17129.404367380917
40, 17256.695399946017
41, 17499.446794542913
42, 17819.348823613571
43, 18117.01951840911
44, 18237.114944772329
45, 18481.86866778848
46, 18805.675887157846
47, 19101.360327077888
48, 19220.686702278188
49, 19468.974465713105
Module execution finished
See also: