Page 1 of 1

Negative shocks

PostPosted: Fri Jan 16, 2015 4:40 pm
by AS90
How is one to generate negative shocks in Dynare? Thanks.

Re: Negative shocks

PostPosted: Fri Jan 16, 2015 7:33 pm
by jpfeifer
In which context? Simulations or IRFs?

Re: Negative shocks

PostPosted: Sat Jan 17, 2015 12:04 pm
by AS90
IRFs predominantly and both secondly.

Re: Negative shocks

PostPosted: Sat Jan 17, 2015 1:26 pm
by jpfeifer
For simulations, Dynare randomly draws from the shock distribution and some shocks are negative, of course. If you use the simult_ function for generating your own simulations, you can select any shock you like.
For IRFs, Dynare by default draws a positive one standard deviation shocks. If you have an AR(1) process like
Code: Select all
z=rho*z(-1)+eps_z;

and you want an IRF to a negative shock, write the process as
Code: Select all
z=rho*z(-1)-eps_z;

Due to symmetry of the normal distribution, this change does not affect anything in your model.

Re: Negative shocks

PostPosted: Tue Jan 20, 2015 4:52 pm
by AS90
That's right; thank you, sir. By one's own simulations do you mean typing up one's own code? For instance, how could I get this one (attached) to generate IRFs to more than one of the three shocks present within the model? - As in, getting it to reproduce IRFs to the three shocks like in the Dynare code. Thanks.

Re: Negative shocks

PostPosted: Tue Jan 20, 2015 5:26 pm
by jpfeifer
Take a look at the RBC_news_shock_model.mod on my homepage. It shows how to use the simult_ function in Dynare to build any shock sequence for IRFs you like.

Re: Negative shocks

PostPosted: Wed Jan 21, 2015 4:07 pm
by AS90
Thank you; I shall. Yet, I beg your pardon, what I was mainly asking was how to modify the second code, in the "Solutions" section, so as to generate IRFs to more than just one shock, like in Dynare. I'd really appreciate your assistance thereat. I am attaching the notes just for clarity. Gratitude.

Code: Select all
% Solutions

w_solution = NaN(10,T);
x_solution = NaN(10,T);

w_solution(:,1) = [0.1; 0.1; 0.1; 0.1; 0.1; 0.1; 0.1; 0.1; 0.1; 0.1];
x_solution(:,1) = inv(Pi_t_11) * w_solution(:,1);

for t = 2:T
        x_solution(:,t) = inv(Upsilon_11)*Psi_11*x_solution(:,t-1);
        w_solution(:,t) = Pi_t_11*x_solution(:,t);
end

Re: Negative shocks

PostPosted: Thu Jan 22, 2015 1:08 pm
by jpfeifer
I am not familiar with your code and what you are trying to achieve and thus cannot provide support.

Re: Negative shocks

PostPosted: Thu Jan 22, 2015 3:43 pm
by AS90
I was trying to reproduce IRFs to the 3 shocks and not just the first one. Thank you, anyways.