IRFs using decision rules

Dear all,

I am trying to produce IRFs using the decision rules generated by Dynare. According to the manual, at the first order approximation the stylized approximation of the model is: y_{t}=y_s+A*(y_{t-1}-y_s)+B*u_{t}. If I get this correctly, feeding a 1sd to the first exogenous variable (sd=0.0073) to get a 20 period IRF should be like this:

[code]u_1 = [0.0073 0 0 0 0]’;
u_f = zeros([5 19]);
u_t = [u_1 u_f];

y = oo_.dr.ys;

for i=1:20
y(:,i+1) = oo_.dr.ys + oo_.dr.ghx*(y([3 6 7 12 17 18 19 20],i)-oo_.dr.ys([3 6 7 12 17 18 19 20])) + oo_.dr.ghu*u_t(:,i);
IRF(:,i) = y(:,i+1)-oo_.dr.ys;

where I have 8 state variables, the monetary base, capital, net worth, the price of capital and 4 variables ruling the shocks process (m, k, n, q, e, b, A, x). The state variables are selected in order declaration, which in this case is the same as DR-order, since I have no mixed variables.

My problem is that with this I cannot replicate the IRFs produced automatically with stoch_simul, but rather get some explosive path for the IRFs. The code of the model is also attached.

Any help is much appreciated!
CD08_nonlinear_ss5_ed.mod (9.47 KB)

For things like this, please use the simult_ function of Dynare. For an example, see e.g.

Thank you Johannes! This is very helpful, it works perfectly fine for first, second and third order approximations.