# Exogenous stochastic shocks

Hello
I am a not very experienced Dynare user running a model of a developing country that is expected to produce oil soon and for a limited number of years. The government will collect revenues from an international company that will develop the oil fields. The government will use the revenues for a certain policy (let say transfers to households). The government revenues depend on the realization of oil price and a contract between the government and the international company. If the contract were simple (for instance a flat rate on the value of oil production), there would not be any problem to simulate the model, as I can specify an stochastic process for oil prices.

Unfortunately the oil contract is not that simple, as it includes very different and not proportional tax figures that require a separate Monte Carlo simulation. I cannot introduce that Monte Carlo routine into a Dynare routine. From that simulation I obtain a large number of different sequences of government revenues that I cannot model estimating an stochastic process (the production lasts for a limited and uncertain number of years, the starting year and the final year are also uncertain). I would like to simulate the macro model for every sequence of revenues that I obtain from my external Monte Carlo simulation. It would be possible to do it in a deterministic setting just specifying the revenues as an exogenous sequence of shocks (as discussed in section 4.8 of the Dynare manual) . However, I am interested in simulating the model in an stochastic setting, so would it be possible to specify a particular sequence of exogenous shocks in an stochastic environment?

Thank you very much for your help.

Best regards,
BMG

The two usual questions:

1. What does a stochastic simulation buy you here? At first order, you will get certainty equivalence. Do you want to go to higher order?
2. Is the sequence of exogenous stochastic shocks known at time t or not. If the full sequence is known in advance, we are talking about

`varexo_det` and you may as well use a perfect foresight model. If instead you want to simulate a stochastic sequence of surprise shocks, then stochastic simulations are the way to go. In that case, you need the

``simult_``

function to feed in the sequence of shocks. See github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_news_shock_model/RBC_news_shock_model.mod for an example.

Thanks for your reply. Regarding the questions:

1. The model is quite standard, so I guess that a first order approximation would be fine (actually when I run the model with a second order approximation I have explosive IRFs and the pruning option is not delivering “smooth” IRFs).
2. The sequence of exogenous stochastic shocks is unknown, so I use the simult_ command to feed the model in with a particular sequence of shocks. As I cannot model the government revenues as an stochastic process (the revenues are transitory and come from the interaction of oil prices and a complicated oil contract) I proceed the following way:
a) I run a Monte Carlo simulation obtaining many different sequences of government revenues. I have to do this outside Dynare.
b) I feed the model in with a particular sequence of government revenues using the simult_ command. I introduce in the model an “artificial” stochastic process for the revenues (revenues_t = ro * revenues_steady_state + epsilon_t) in which the steady state value for revenues is set as 0 and epsilon_t is the sequence of the government revenues.

With this procedure I am implicitly considering, at each t, the whole amount of government revenues as an unanticipated shock. What I would like to have are the government revenues divided in two parts: one anticipated (deterministic) and one unanticipated without having to specify any “fake” stochastic process for the revenues. Is it possible to do it in Dynare?

I very much appreciate your help.

1. That is strange and may indicate more general problems with the model.
2. In that case, you need to have 2 shocks, one exogenous deterministic one (varexo_det) and one stochastic one (varexo).
1. I will check the model to see if there is any problem behind the second order issue.
2. I will use the exogenous deterministic one (varexo_det) and one stochastic one (varexo) into the simult_ command.

Thanks for your help Johannes.

Dear Johannes

Setting the values for the varexo_det variable to be used by stoch_simul is simple (just to declare the values in the shocks section). However, what I am not being able to do is to set the values of the exogenous deterministic variable to be used by the simult_ command.
In simult_(y0,dr,ex_,iorder) I can set a particular sequence for the stochastic shock specifying it through ex_, but I don’t know how to set the exogenous sequence of varexo_det to be used inside simult_

``````...
shocks;
var eo; stderr 1; //stochastic shock declared at varexo
var eanticip;  //deterministic shock declared at varexo_det
periods 1:35;
values 0.1;
end;

stoch_simul (order=1, irf=100, nograph);

ex_=xlsread(REVENUES',1,'G154:G188'); //exogenous sequence of the stochastic shock eo

irf = simult_(oo_.steady_state,oo_.dr,ex_,1); ``````

Is there any way to do it?

Thanks for your help.

Actually, you cannot use

``simult_``

in this case as it only does purely stochastic simulations, but up to order=3. You instead need to use

``simultxdet.m``

which only works up to order=2, but allows for varexo_det.