-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunc_ocp.m
103 lines (75 loc) · 4.36 KB
/
func_ocp.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
function [out1,out2,out3] = func_ocp(flag,s,xx,ep,e,sigma,rho,kappa,lx,beta,rnstst)
% Function file for OPTIMAL COMMITMENT POLICY WITH ZERO FLOOR ON THE NOMINAL INTEREST RATE
% Program for the article "Optimal and Simple Monetary Policy Rules
% with Zero Floor on the Nominal Interest Rate",
% International Journal of Central Banking, Vol. 4(2), pages 73-127, June
% (C) Anton Nakov
rn = s(:,1);
phi1_lag = s(:,2);
phi2_lag = s(:,3);
n = length(rn);
if ~isempty(ep)
E_pi = ep(:,1);
E_x = ep(:,2);
end
if ~isempty(xx)
pi = xx(:,1);
x = xx(:,2);
i = xx(:,3);
end
switch flag
case 'b'; % BOUND FUNCTION
out1(:,1) = -inf*ones(n,1); % pi low
out1(:,2) = -inf*ones(n,1); % x low
out1(:,3) = zeros(n,1); % i low
out2(:,1) = inf*ones(n,1); % pi high
out2(:,2) = inf*ones(n,1); % x high
out2(:,3) = inf*ones(n,1); % i high
case 'f'; % EQUILIBRIUM FUNCTION
out1(:,1) = pi - beta*E_pi - kappa*x; % f1 (NKPC)
out1(:,2) = x - E_x + 1/sigma*(i - E_pi - rn); % f2 (NIS)
out1(:,3) = i.*((kappa/sigma +1)/beta*phi1_lag + kappa*phi2_lag - kappa*pi - lx*x); % f3 (ZB)
out2(:,1,1) = ones(n,1); % f1pi
out2(:,1,2) = -kappa*ones(n,1); % f1x
out2(:,1,3) = zeros(n,1); % f1i
out2(:,2,1) = zeros(n,1); % f2pi
out2(:,2,2) = ones(n,1); % f2x
out2(:,2,3) = 1/sigma*ones(n,1); % f2i
out2(:,3,1) = -kappa*i; % f3pi
out2(:,3,2) = -lx*i; % f3x
out2(:,3,3) = ((kappa/sigma +1)/beta*phi1_lag + kappa*phi2_lag - kappa*pi - lx*x); % f3i
out3(:,1,1) = -beta*ones(n,1); % f1E_pi
out3(:,1,2) = zeros(n,1); % f1E_x
out3(:,2,1) = -ones(n,1)/sigma; % f2E_pi
out3(:,2,2) = -ones(n,1); % f2E_x
out3(:,3,1) = zeros(n,1); % f3E_pi
out3(:,3,2) = zeros(n,1); % f3E_x
case 'g'; % STATE TRANSITION FUNCTION
out1(:,1) = rho*rn + (1-rho)*rnstst + e; % g1
out1(:,2) = (kappa/sigma +1)/beta*phi1_lag + kappa*phi2_lag - kappa*pi - lx*x; % g2
out1(:,3) = phi2_lag + phi1_lag/(beta*sigma) - pi; % g3
out2(:,1,1) = zeros(n,1); % g1pi
out2(:,1,2) = zeros(n,1); % g1x
out2(:,1,3) = zeros(n,1); % g1i
out2(:,2,1) = -kappa*ones(n,1); % g2pi
out2(:,2,2) = -lx*ones(n,1); % g2x
out2(:,2,3) = zeros(n,1); % g2i
out2(:,3,1) = -ones(n,1); % g3pi
out2(:,3,2) = zeros(n,1); % g3x
out2(:,3,3) = zeros(n,1); % g3i
case 'h'; % EXPECTATION FUNCTION
out1(:,1) = pi; % E_pi
out1(:,2) = x; % E_x
out2(:,1,1) = ones(n,1); % E_pi_pi
out2(:,1,2) = zeros(n,1); % E_pi_x
out2(:,1,3) = zeros(n,1); % E_pi_i
out2(:,2,1) = zeros(n,1); % E_x_pi
out2(:,2,2) = ones(n,1); % E_x_x
out2(:,2,3) = zeros(n,1); % E_x_i
out3(:,1,1) = zeros(n,1); % E_pi_rn
out3(:,2,1) = zeros(n,1); % E_x_rn
out3(:,1,2) = zeros(n,1); % E_pi_phi1_lag
out3(:,2,2) = zeros(n,1); % E_x_phi1_lag
out3(:,1,3) = zeros(n,1); % E_pi_phi2_lag
out3(:,2,3) = zeros(n,1); % E_x_phi2_lag
end