I’d like to use ‘simult_’ to shock the model with a predefined matrix of shockvalues (in this case a vector of random variables, that I also use for another simulation within the same work)
for each exogenoues variable and each period, but I really don’t understand how to use this instruction.
I looked at JPfeifers examplary RBC news shock model (This), but i don’t get the intuition behind that.
You initialize the shock matrix. It will always be shock_matrix = zeros(options_.irf,M_.exo_nbr); %create shock matrix with number of time periods in columns
Then you set the shocks that you want. The row index sets the time period, the column index the shock:
// set shocks for pure news
shock_matrix(1,strmatch('eps_z_news',M_.exo_names,'exact')) = 1; %set news shock to 1 (use any shock size you want)
sets a shock of size 1 for the first period (therefore in the first row) for the exogenous variable eps_z_news. The command strmatch('eps_z_news',M_.exo_names,'exact')
is used to find the column in which eps_z_news is stored. So for a different shock, you need to change the name string.
Dear Professor Pfeifer,
I’ve read your code RBC_news_shock_model.mod and have several question if I may ask you:
You claim one shock is anticipated to happen in period 8, while the other shock is a surprise from period 1:8 . But in your code both of them are defined as stochastic shocks, which means they are not anticipated. How could we understand that?
In the last part of your code, you wrote
shock_matrix(1+8,strmatch(‘eps_z_surprise’,M_.exo_names,‘exact’)) = -1; %8 periods later use counteracting shock of -1
is the “1+8” just means 9 or means [1:8] from period 1 to 8 ? (see the TFP lines below)
In the output figures, “z” remain 0, while TFP increase in period 1, and then drop until period 8, and finally climb back to 0. How could “z” remain 0 while TFP fluctuates?
4.could the two shocks be equivalently combined into one shock like this?:
I am sorry I am referring to an old thread. But I need to create a user defined shock in my problem. I had two questions about the model posted above by Fimo, if you could kindly clear my doubts.
It seems impulse response graphs will not be produced in the above mentioned model. Is the command stoch_simul doing anything in the model?
Can we do a third order approximation in the above model? If stoch_simul is redundant, then where do we put order=3?
Hi,
I wonder if it is possible to obtain the simulated series in response to both shocks simultaneously.
Specifically, the simulation result whereby TFP rises first because of the stochastic shock (here, by 1) then falls in period 9 once the anticipated shock materializes (here, by -0.5 from its value in period 8) .
In fact, I would have thought it was ‘y2’ obtained from the code below…
However, that doesn’t seem to be the case, right? The simulated TFP does not shoot up in period 1 following the stochastic TFP shock, but rises by 0.5 in period 9 (showing just the net impact on TFP after the anticipated news shock arrived) instead.
And that’s why you were referring these irfs to a “pure” TFP news shock.
I wonder if it is possible to obtain the series reflecting effects of both shocks simultaneously.
Or do I just combine the first 8 periods generated from the TFP surprise shock alone with y2 period 9 onwards…(this doesn’t sound right tho).
I am not following. What exactly is the experiment you are trying to do? An anticipated shock in the first period does only increase TFP in the future, not today. That is what’s clearly visible in the figure.
I want to see the impact of both shocks on the economy. In the first period, a positive TFP hits the economy. I would expect the TPF and hence Y etc. to react already. Only once the economy reaches period 9, the anticipated negative news shock materialize, and the TFP falls from 1 (or around 1 ) by -0.5…
OH! You are so RIGHT. Apologize for being reckless. And thank you so much for patiently responding to my queries. I got it now.
On my final question: The solving algorithm of the anticipated shock here is identical to the prefect foresight command, right? Since both make use of the simult_ command. So, essentially, I cannot get the economy in which a stochastic shock hits in the first period, and a policy (anticipated) being implement says on period 8. I wonder if you have any suggestions on how to deal with this.