MIT shocks in deterministic environment


Could you please let me know the best way to simulate a series of MIT shocks, preferably in a deterministic environment?

Also, in a stochastic simulation, how can I give specific values to the shock series? That is, I want my varexo to take specific values in my simulation (for instance, a function similar to set_param_value() to set the exogenous variables).

Thank you,


1 Like

For the second question, it seems the function
can be used to simulate with a different series of exogenous shocks (ex_).

For stochastic simulations, see
The deterministic ones are tricky, because there you have perfect foresight. The right way to do this would be to run a sequence of perfect foresight simulations.

1 Like

Thank you very much Johannes. For the MIT shock in the deterministic environment, I wrote the following code that writes a mod file for every period. It seems to work fine. The baseline model is example1.mod. I want to use it in my class, and I uploaded it here in case others were interested. I appreciate it if you could take a look and let me know if you agree with everything, and if there are obvious ways to improve it.
irf_mit.m (1.7 KB)
write_rbc_dtr_MIT_modFile.m (2.5 KB)

Thank you,

1 Like

Hi, professor. Does that mean we can not set the path of exogenous variable and call simul() directly? Besides, since people have perfect foresight on the whole path of exogenous variable, why do not they solve the optimal path one time but need to “run a sequence of perfect foresight simulations”?

The question above is about a sequence of MIT shocks. MIT shocks are by definition an unforeseen surprise. For that reason, you cannot model a sequence of MIT shocks in one perfect foresight simulation. All shocks in future periods would be known in advance.

Thanks ! Sorry to bother you with this trivial thing, but could you please share some materials about how to simulate MIT shock? I can not find them in Google.

What exactly do you want to do? Simulate one MIT shock t=0? Or a sequence t=0 to t=T?

Thanks for your reply !
What I want to investigate is a sequence of MIT shocks. For MIT shocks in deterministic model, I have read the code of @ghazika1. I am not very sure I have gotten the correct idea. In that code, we need to update the initial and end value and do a sequence of simulation.However, I found what I want to model is an environment that people have no perfect foresight about the sequence of shocks, but they have some expectation that there is going to be shocks and shocks are going to wane. In deterministic model, even we can let the optimization happen before the current period shock realized, people are still perfect foresight and assume there is no shock in the future when picking optimal path. I am thinking that a sequence of shock under stochastic model may fit my environment better. Therefore, I turn to your code, RBC_news_shock_model. I have two questions.
(1) How is the news shock and surprise shock differentiated? Is the difference in period the only one between those two shocks?
(2) I find the code separates shocks at different time into different shocks. Does that means if we want to simulate a sequence of shocks in stochastic model, we need to specify a sequence of vectors?