ImpulseMatrix: Array;
The ImpulseMatrix property returns matrix of impulse response function values.
To calculate the matrix, define the following properties: ISmVectorAutoRegress.ImpulseAROrder and ISmVectorAutoRegress.ImpulsePeriod.
If at least one of the parameters ImpulseAROrder or ImpulsePeriod is not specified, a vector autoregressive model is calculated, model autoregression is defined by the ISlEquation.AutoRegressionOrder vector, and ImpulseMatrix is not calculated.
When both ImpulseAROrder and ImpulsePeriod are specified, the values of the AutoRegressionOrder parameter are ignored, and the model is calculated with autoregression of the type 1, 2, 3, … ImpulseAROrder. ImpulseMatrix is calculated.
Sub Main;
Var
ar1, ar2, ar3: Array[0..15] Of Double;
i,j,status: Integer;
d: Double;
var1: ISmVectorAutoRegress;
Eqs: ISlEquations;
Eq: ISlEquation;
ARO: Array[0..0] Of Integer;
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;
//Endogenous3
ar3[0] := 7;
ar3[1] := 2;
ar3[2] := 11;
ar3[3] := 14;
ar3[4] := 18;
ar3[5] := 22;
ar3[6] := 32;
ar3[7] := 28;
ar3[8] := 39;
ar3[9] := 44;
ar3[10] := 50;
ar3[11] := 54;
ar3[12] := 58;
ar3[13] := 57;
ar3[14] := 71;
ar3[15] := 72;
var1 := New SmVectorAutoRegress.Create;
Eqs := var1.Equations;
Eq := Eqs.Add;
Eq.Serie.Value := ar1;
Eq.AutoRegressionOrder := ARO;
Eq := Eqs.Add;
Eq.Serie.Value := ar2;
Eq := Eqs.Add;
Eq.Serie.Value := ar3;
var1.ModelPeriod.FirstPoint := 1;
var1.ModelPeriod.LastPoint := 16;
var1.ImpulseAROrder := 1;
var1.ImpulsePeriod := 10;
status := var1.Execute;
Debug.Writeline("Status = " + status.tostring);
Debug.Writeline("Errors = " + var1.Errors);
Debug.WriteLine(" == IMPULSE MATRIX 1 == ");
For i := 0 To var1.ImpulsePeriod-1 Do //by observations (rows)
Debug.Write(i.ToString+ ": ");
For j := 0 To var1.Equations.Count-1 Do //by variables (columns)
d := var1.Equations.Item(0).ImpulseMatrix[i,j];
Debug.Write(d.ToString + ", ");
End For;
Debug.WriteLine(" ");
End For;
Debug.WriteLine("======");
End Sub Main;
After executing the example the console window displays impulse matrix for the first equation.
Module execution started
Status = 0
Errors = No errors
== IMPULSE MATRIX 1 ==
0: 5.8210734347857747, 0, 0,
1: 4.7254838309991269, 1.2383321318793281, 2.6820853585513604,
2: 5.9075270312058059, 1.0779088108003716, 1.6549290337899745,
3: 6.1589812302649936, 1.2798916217967296, 2.3518675511390472,
4: 6.8688532037234804, 1.3605275651990483, 2.350215937995614,
5: 7.4659376074868238, 1.5058786773330226, 2.6652313651194883,
6: 8.1939119743921545, 1.6414366188806042, 2.8790029169578659,
7: 8.9599782425868462, 1.7995470093648307, 3.1671793576593283,
8: 9.8112285544027475, 1.9685903751252565, 3.4602110321587385,
9: 10.737739182962329, 2.1552869084727471, 3.7902238564618638,
======
Module execution finished
See also: