-
Notifications
You must be signed in to change notification settings - Fork 8
/
dyn_multipliers.m
35 lines (29 loc) · 1.14 KB
/
dyn_multipliers.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function PHI = dyn_multipliers(K,maxlag,F,N)
%**************************************************************************
% PURPOSE: Computing dynamic multipliers' matrices of the VAR
%--------------------------------------------------------------------------
% INPUT:
% - K: total number of endogenous variables in the VAR
% - maxlag: maximum lag order of endogenous and weakly exogenous variables
% - F: three-dim matrix (K x K x maxlag) containing estimated
% coefficients of the VAR (i.e. of reduced form representation)
% - N: forecast horizon
%--------------------------------------------------------------------------
% OUTPUT:
% - PHI: three-dim matrix (K x K x (N+1)) containing dynamic multipliers of
% the VAR
%--------------------------------------------------------------------------
%**************************************************************************
for i=1:maxlag
PHIx(:,:,i) = zeros(K); %#ok
end
PHIx(:,:,maxlag+1) = eye(K);
for t=maxlag+2:maxlag+N+1
acc = 0;
for j=1:maxlag
acc = acc + F(:,:,j)*PHIx(:,:,t-j);
end
PHIx(:,:,t) = acc;
end
% reindicize
PHI = PHIx(:,:,maxlag+1:end);