MovingAverage: Array;
The MovingAverage property determines initial values for moving average coefficients.
The number of coefficients depends on value of the MovingAverageOrder 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.DifferenceOrder := 1;
ARIMA.ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;
ARIMA.Forecast.ConfidenceLevel := 0.95;
ARIMA.Forecast.LastPoint := 50;
ARIMA.MaxIteration := 1000;
InitialValuesAR := New Double[2];
InitialValuesAR[0] := 0.1;
InitialValuesAR[1] := 0.1;
InitValues := ARIMA.InitialValueS;
InitValues.MovingAverage := 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 forecasting values:
Module execution started
0
==== Forecast ====
25, 12425.810419205925
26, 12695.724449493046
27, 12940.041585091012
28, 13191.892544856892
29, 13441.526106485915
30, 13691.812305392867
31, 13941.906416370519
32, 14192.057063764079
33, 14442.191071036965
34, 14692.32997592516
35, 14942.46743931926
36, 15192.60532698213
37, 15442.743089771793
38, 15692.880889314853
39, 15943.018678040442
40, 16193.15646994989
41, 16443.294260922248
42, 16693.432052170414
43, 16943.569843337402
44, 17193.707634528284
45, 17443.845425712134
46, 17693.983216898054
47, 17944.121008083363
48, 18194.258799268853
49, 18444.396590454289
Module execution finished
See also: