generated from MCHatcher/RE_solutions_structural_change_OLD
-
Notifications
You must be signed in to change notification settings - Fork 1
/
General_case_date_0_announcement_sunspots.m
76 lines (53 loc) · 2.05 KB
/
General_case_date_0_announcement_sunspots.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
%Announcement in the first period, indeterminacy example
%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;
T_tild = 8; % Final date before terminal structure
T = 1; % Start of implementation period
T_sim = 21; % Simulation length
%T_sim = 51;
% Model and calibration
run Insert_NK_forward_guidance_indeterminacy
% 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; % temporary 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;
Gama = (B1t - B2t*Omeg) \ B4t;
Psi = (B1t - B2t*Omeg) \ (B2t*Psi + B5t);
Omeg = (B1t - B2t*Omeg) \ B3t;
if t >= T_tild+1
Omeg = Omega_tild;
Gama = Gama_tild;
Psi = Psi_tild;
end
Omeg_t(:,:,t) = Omeg;
Gama_t(:,:,t) = Gama;
Psi_t(:,:,t) = Psi;
end
%Prepare for simulations
X = X_init;
%For comparison
X_fin = X_init;
%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 terminal structure (for comparison if wanted)
X_fin = Omega_tild*X_fin + Gama_tild*e_vec(:,t) + Psi_tild;
X_stack_fin(:,t) = X_fin;
Periods(t) = t-1; %To plot from period 0
end
%NK_inflation_target_plotter
NK_forward_guidance_plotter