AutoRegressionOrder: Array;
The AutoRegressionOrder property sets autoregresion orders.
For a vector autoregression the value of this property is ignored, if both ISmVectorAutoRegress.ImpulseAROrder and ISmVectorAutoRegress.ImpulsePeriod properties are defined, the model is calculated with the autoregression having the order 1, 2, 3, … ImpulseAROrder. Also the matrix of impulse response function values ISlEquation.ImpulseMatrix is computed.
Sub Main;
Var
ar1, ar2: Array[0..15] Of Double;
j,status: Integer;
var1: ISmVectorAutoRegress;
Eqs: ISlEquations;
Eq: ISlEquation;
ARO: Array[0..0] Of Integer;
Sub Print(Data: Array Of Double);
Var
i: Integer;
d: Double;
Begin
Debug.WriteLine("---Begin---");
For i := 0 To Data.Length - 1 Do
If Double.IsNan(Data[i]) Then
Debug.WriteLine(i.ToString + ", ---empty---");
Else
d := Data[i];
Debug.WriteLine(i.ToString + ", " + d.ToString);
End If;
End For;
Debug.WriteLine("---End---");
End Sub Print;
Begin
//Endogenous1
ar1[0] := 3;
ar1[1] := 8;
ar1[2] := 12;
ar1[3] := 10;
ar1[4] := 26;
ar1[5] := 21;
ar1[6] := 35;
ar1[7] := 29;
ar1[8] := 40;
ar1[9] := 39;
ar1[10] := 51;
ar1[11] := 50;
ar1[12] := 59;
ar1[13] := 58;
ar1[14] := 65;
ar1[15] := 72;
//Endogenous2
ar2[0] := 5;
ar2[1] := 3;
ar2[2] := 9;
ar2[3] := 13;
ar2[4] := 25;
ar2[5] := 21;
ar2[6] := 30;
ar2[7] := 33;
ar2[8] := 43;
ar2[9] := 37;
ar2[10] := 49;
ar2[11] := 47;
ar2[12] := 60;
ar2[13] := 59;
ar2[14] := 69;
ar2[15] := 68;
ARO[0] := 1;
var1 := New SmVectorAutoRegress.Create;
Eqs := var1.Equations;
Eq := Eqs.Add;
Eq.Serie.Value := ar1;
Eq.AutoRegressionOrder := ARO;
Eq.Forecast.LastPoint := 16;
Eq.Intercept.Mode := InterceptMode.AutoEstimate;
Eq := Eqs.Add;
Eq.Serie.Value := ar2;
Eq.AutoRegressionOrder := ARO;
Eq.Forecast.LastPoint := 16;
Eq.Intercept.Mode := InterceptMode.AutoEstimate;
var1.ModelPeriod.FirstPoint := 1;
var1.ModelPeriod.LastPoint := 16;
status := var1.Execute;
If status <> 0 Then
Debug.Writeline(var1.Errors);
Else
For j := 0 To Eqs.Count-1 Do
Debug.WriteLine("=== Modeling series for equation " + j.ToString + " ===");
Print(Eqs.Item(j).Fitted);
Debug.WriteLine("=== End ===");
End For;
End If;
End Sub Main;
After executing the example the console window displays modeling series of vector autoregression equations:
Module execution started
=== Modeling series for equation 0 ===
---Begin---
0, 3
1, 11.780866278560829
2, 9.6620878425255832
3, 15.334229806209933
4, 19.283705270102999
5, 30.339907789294269
6, 26.642503557556452
7, 34.862635094905549
8, 37.986787484925152
9, 47.284313328302964
10, 41.504140836552075
11, 52.704384059832066
12, 50.801666679929887
13, 63.079304209238586
14, 62.145950607298587
15, 71.587517154765109
---End---
=== End ===
=== Modeling series for equation 1 ===
---Begin---
0, 5
1, 9.477262385252077
2, 9.2531005180612524
3, 14.590209286325603
4, 17.002584880366989
5, 29.64085427655543
6, 25.509933305311773
7, 35.479648317368031
8, 36.18415084184047
9, 46.143193546263412
10, 41.54260422537147
11, 53.19884769173003
12, 51.501646929794411
13, 63.147218088519658
14, 62.175864466323112
15, 71.152881240916187
---End---
=== End ===
Module execution finished
See also: