Anticipated vs unanticipated shocks

Hi all,

I have a question about this linked code by Prof Pfeifer. In this example, we have one anticipated news shock and one unanticipated shock. If we were to specify two shocks where both were unanticipated (with still 8 periods in between), would this code be adapted as follows? (Q1)

z=rhoz*z(-1)+eps_z_surprise + eps_z_news;

I guess my question is: is (-8) in line 89 (in the original code) specifying the anticipated nature of the shocks? (Q2)

Relatedly, the following part of the code specifies the timing between the shocks, and it doesn’t inform us anything about anticipation bit. Is that right? (Q3)

shock_matrix(1,strmatch(‘eps_z_news’,M_.exo_names,‘exact’)) = 1;
shock_matrix(1+8,strmatch(‘eps_z_surprise’,M_.exo_names,‘exact’)) = -1;

I hope my question(s) were clear. I just have not worked with anticipated shocks before, so I am trying to understand the notation and which part of the code brings us the anticipated bit (so I can change it).

Thank you so much for your guidance in advance,
Ezgi

  1. To have an anticipated shock, you need to lag the shock. In the original code
    z=rhoz*z(-1)+eps_z_surprise + eps_z_news(-8);
    Here, eps_z_news(-8) indicates that the eps_z_news that became part of the information set at time t only affects z with a lag of 8 periods, i.e. is anticipated for 8 periods. If there were a second anticipated shock, simply have it lagged as well.
  2. The shock_matrix specifies which shock (the columns) realizes at which point in time (periods are along the rows). It has nothing to do per se with anticipation.
1 Like

Exactly. Both of my shocks are unanticipated, so I guess that means I’ll remove the (-8) only and the rest is fine. Many thanks, Johannes!

Wish you happy holidays!
Ezgi

Hey, I have a question similar to this one.

I have a stochastic model (NKM augmented by energy as production factor). I want to have an anticipated shock in which my agents know in period 0 when they awake that there is a energy price subsidy for 10 years of -10% starting 2 quarters later. Thus I want a value of -10% for period 2 to 42 (since it is quarterly). My impulse response to the energy price should be horizontal at -10% between period 2 and 42, for all other periods it should be 0. Can someone please give me a tip on how to implement this in dnyare?

Right now I only managed to get a two periods before anticipated AR(1) shock:
%Law of motion for real energy price
xi = gamma * xi(-1) - v(-2);
%shock
shocks;
var v = 10^2;
end;

Thank you very much for your help!

Best,
Marie

Do you need to do a stochastic simulation for this? It sounds like a straightforward perfect foresight exercise.

Hey, thanks for your answer. My thought was that the agents only anticipate the energy price “shock”/subsidy but they do form beliefs for e.g. future inflation and output (gap) based on the new information. Thus I decided for the stochastic set-up. What would you have done? And what does this mean for my shock simulation?

At first order, there will be certainty equivalence. I woud have gone for a perfect foresight simulation. In such models agents are still forward-looking. But they do not have precautionary behavior due to stochastic shocks potentially happening in the future.