this is my code. In the first part is requested to solve a partial equilibrium model. The model works, but in the second part of the exercise is required to create our own impulse response graphs and to compare them with the ones created authomatically by the software. I don't know exactly how to do it: i've part of the code to use but i'm not able to use the data from the policy function to generate matrices in which taking values to plot. the problem is probably more theoretical than a codes' problem.
Can someone help me?
Thank you
- Code: Select all
// MARKET FOR ENGINEERS
/********
*Model in levels*
********/
var s w N P ;
varexo e u; // e=epsilon s u=epsilon d
parameters a0 a1 d0 d1 beta delta ;
a0 = 10;
a1 = 1;
d0 = 1000;
d1 = 1;
beta = 0.99;
delta = 0.02;
model(linear);
P=(1-delta)*beta*P(+1)+(1-delta)^(5)*beta^(5)*w(+5);
s=a0+a1*P+e;
N=(1-delta)*N(-1)+s(-5);
N=d0-d1*w+u;
end;
//steady_state_model;
// the model is already loglinearized so there is no need of writing the initial values of steady state.
steady;
check;
shocks;
var e; stderr 1;
var u; stderr 1;
end;
stoch_simul(periods=500 ,order=1);
//ordering variables s w N P
p_s = 1;
p_w = 2;
p_N = 3;
p_P = 4;
//
% state space representation: S(t) = A*S(t-1) + B*e(t),
% X(t) = C*S(t-1) + D*e(t);
C = [oo_.dr.ghx(oo_.dr.inv_order_var(p_s),:);
oo_.dr.ghx(oo_.dr.inv_order_var(p_w),:);
oo_.dr.ghx(oo_.dr.inv_order_var(p_N),:);
oo_.dr.ghx(oo_.dr.inv_order_var(p_P),:)];
D = [oo_.dr.ghu(oo_.dr.inv_order_var(p_s),:);
oo_.dr.ghu(oo_.dr.inv_order_var(p_w),:);
oo_.dr.ghu(oo_.dr.inv_order_var(p_N),:);
oo_.dr.ghu(oo_.dr.inv_order_var(p_P),:)];
H = 500;
Xirf = zeros(4,H);
Xirf(:,1) = D;
for j = 2:H
Xirf(:,j) = C;
end;