Static Simulation

Is there a way to run a static simulation in Dynare? That is, run a simulation while providing the model with specific data for specific variables?

Thank you,

Adam Shapiro

Dear Adam,

can you give more details about what you want to do and maybe the algebra going with it. Thanks


Specifically, I would like to simulate a model using the exogenous shocks obtained from bayesian estimation.

From your manual it looks like this can be achieved by saving the shocks from the “results.mat” file from the estimation and then use the option “shocks_file =results.mat” in the simul(…) command.

I believe that there are two ways of simulating the model at this point:

(1) Dynamic simulation: The model is “fully” simulated in that all state variables are taken from the result of the model’s simulation last period. (I believe this is what Dynare does by default)

(2) Static simulation: Certain state variables each period are taken from data. The state variables for which there is no data available are then simulated.

I am wondering if Dynare is able to perform the Static Simulation.

In my case I am working with the following model:

pistar(0)= (Wt(0)(alph0.5*(pi_up+pi_low)+(1-alph)pdot(0))+ (1 - Wt(0))pdot(0));
Wt(0) = (.32125
pdot(0) = (prhopdot(-1)+b1pdot(+1)+ csiygap(0) + pdot_(0));
rff(0) = (rlag
rff(-1) + (1-rlag)(rhobar + pdot(0)+ api(pdot(0) - pistar(0))+ ayygap(0)) + rff_(0));
ygap(0) =(yl1
ygap(-1)- yl2ygap(-2)+ yfygap(+1)- yrho*(rho(-1) - rhobar) + ygap_(0));
rff(0) = pdot(+1) + (rho(0) - (1.0/dur)*(rho(+1) - rho(0)));

I do have data for the following endogenous variables: pdot, ygap, and rff
I do not have data for the endogenous variables: Wt, pistar, and rho
The exogenous shocks are rff_, pdot_, and ygap_

Thanks again,

Adam Shapiro

Dear Adam,

I will post an example on how to do it, but it will take me a little while. I have already a long list of promised examples …

Kind regards



Thank you Michel

Here is an example. The model is in example5.mod and the shock values in example5_shocks.txt

Tell me if it helps


example5_shocks.txt (3.32 KB)
example5.mod (1.53 KB)

Thank you for the example Michel. However, I think this example is not doing exactly what I am trying to do.

What I am trying to do is simulate a couple variables for which there exist no data. In other words, use the model to back-out “hidden” variables that exist in the model, but not in any data source.

To do this, I am taking the following approach – which does not seem to be working for some reason.

  1. Estimate the model to obtain the parameters and exogenous shocks. The exogenous shocks are saved in the oo_ file.

  2. I then simulate model, in a deterministic context, with the shocks saved from the estimation in the oo_ file. I save them in a file called datafile.mat. I have been doing this with the shocks(shocks_file = datafile.mat) command. For example:

shocks(shocks_file = datafile);
var pdot_;
periods 1;
values 0;
var rff_;
periods 1;
values 0;
var ygap_;
periods 1;
values 0;

For those variables for which I have data, the simulation should give me back a time series that looks like the data that I put into the estimation process. It is not doing so. Instead, much of the simulated time-sereis I am getting back (i.e. what I get when I use the rplot command at the end of the simulation) looks quite different from the data. Other times it resembles the data, but is not quite there.

Perhaps you could help explain why the approach I have taken is not working correctly in Dynare.

In order to better simulate the hidden variables, I was wondering if I could put the data directly into the simulation, just like I put the shocks into the simulation – this would be the static simulation. This would not involve solving the model for policy functions as is shown in your example, but rather use the model to map out the variables for which there is no data. Is there a command to simulate the model with some of the endogenous variables updated each period with the actual data?