Page 1 of 1

Exogenous stochastic shocks

PostPosted: Tue Apr 18, 2017 11:28 am
by bmg
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

Re: Exogenous stochastic shocks

PostPosted: Tue Apr 18, 2017 7:26 pm
by jpfeifer
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
Code: Select all
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
Code: Select all
simult_

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

Re: Exogenous stochastic shocks

PostPosted: Wed Apr 19, 2017 11:12 am
by bmg
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.

Re: Exogenous stochastic shocks

PostPosted: Mon Apr 24, 2017 6:43 am
by jpfeifer
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).

Re: Exogenous stochastic shocks

PostPosted: Mon Apr 24, 2017 10:53 am
by bmg
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.

Re: Exogenous stochastic shocks

PostPosted: Tue Apr 25, 2017 11:06 am
by bmg
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_

Code: Select all
...
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.

Re: Exogenous stochastic shocks

PostPosted: Tue Apr 25, 2017 6:30 pm
by jpfeifer
Actually, you cannot use
Code: Select all
simult_

in this case as it only does purely stochastic simulations, but up to order=3. You instead need to use
Code: Select all
simultxdet.m

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