Monte Carlo exercise


I am using a simple 3 equation hybrid NK model and I want to simulate the model 10,000 times to obtain 10,000 sample of 500 observations of my endogenous variables. I am new to Dynare and has tried many things but I don’t see to be able to figure out how to do this. I was wondering whether it is possible to do this within Dynare and how I would save the results of each loops?. My .mod file is attached. Thank you.
nkm2.mod (885 Bytes)

Hi, you could do the following:

for ii=1:10000 stoch_simul(order=1,replic = 50,drop=0,periods=500,irf=0,nomoments) y p r; simseries{ii,1}=oo_.endo_simul; simseries{ii,2}=oo_.exo_simul; end save simseries simseries;
Each row of the resulting cell array simseries contains in the first column the simulated series for the endogenous variablese and in the second column the exogenous variables. You could replace or add any other variables to the cell array.