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?