-
Notifications
You must be signed in to change notification settings - Fork 3
/
General_case_abritrary_announcement_date.m
82 lines (60 loc) · 2.23 KB
/
General_case_abritrary_announcement_date.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
%Arbitrary announcement date T_ann, applied to:
%Ireland (2007) NK Model, replicates Cagliarini and Kulish (2013, Fig 3)
%To study a different example, simply change the parameters and matrices
%Model structures are defined in the 'Insert' files
%Written by Michael Hatcher ([email protected]). Any errors are my own.
clc; clear; close all;
% Announcement date and final date before terminal structure
T_ann = 4; T_tild = 7;
T_sim = 15; %Simulation length
% Model and calibration
%run Insert_NK_forward_guidance
run Insert_NK_inflation_target
% Fixed structure solutions (Cho and Moreno 2011, JEDC)
run Cho_and_Moreno
%Indicator variable
ind = ones(T_sim,1); ind(T_tild+1:T_sim,1) = 0; %permanent structural change
%Initial values for recursion
Omeg = Omega_tild; Gama = Gama_tild; Psi = Psi_tild;
%Computation of matrix recursion
for t=T_sim:-1:1
B1t = ind(t)*B1 + (1-ind(t))*B1_tild;
B2t = ind(t)*B2 + (1-ind(t))*B2_tild;
B3t = ind(t)*B3 + (1-ind(t))*B3_tild;
B4t = ind(t)*B4 + (1-ind(t))*B4_tild;
B5t = ind(t)*B5 + (1-ind(t))*B5_tild;
Omeg = (B1t - B2t*Omeg) \ B3t;
Gama = (B1t - B2t*Omeg) \ B4t;
Psi = (B1t - B2t*Omeg) \ (B2t*Psi + B5t);
if t >= T_tild+1
Omeg = Omega_tild;
Gama = Gama_tild;
Psi = Psi_tild;
end
if t <= T_ann-1
Omeg = Omega_bar;
Gama = Gama_bar;
Psi = Psi_bar;
end
Omeg_t(:,:,t) = Omeg;
Gama_t(:,:,t) = Gama;
Psi_t(:,:,t) = Psi;
end
%Prepare for simulations
X = X_init;
%For comparison
X_orig = X; X_fin = X_init_new;
%Simulation results
for t=1:T_sim
X = Omeg_t(:,:,t)*X + Gama_t(:,:,t)*e_vec(:,t) + Psi_t(:,:,t);
%Store for later
X_stack(:,t) = X;
%Under original structure
X_orig = Omega_bar*X_orig + Gama_bar*e_vec(:,t) + Psi_bar;
X_stack_orig(:,t) = X_orig;
%Under terminal structure
X_fin = Omega_tild*X_fin + Gama_tild*e_vec(:,t) + Psi_tild;
X_stack_fin(:,t) = X_fin;
Periods(t) = t;
end
NK_inflation_target_plotter