# Setting problems: "periods" and "stoch_simul"

Dear all

I am trying to run the Hansen model and have some findings. It would be good if you can confirm what I think.

When I tried to run the stoch_simul in dynare 4, it got two different results with the settings of “periods” and “stoch_simul” and computed results. ( it’s kind of I am playing with them). Let me use different situations to explain:

## periods 20100; : : : stoch_simul(hp_filter = 1600, order = 1); statistic1 = 100*sqrt(diag(oo_.var(1:7,1:7)))./oo_.mean(1:7)’;

``````The above codes can work but the results are totally out of that of the original paper.
``````

===========================================================================

## %periods 20100; <—(which mean i do not run this code): : stoch_simul(hp_filter = 1600, order = 1); statistic1 = 100*sqrt(diag(oo_.var(1:7,1:7)))./oo_.mean(1:7)’;

``````The above codes cannot work for the last line.  But if i change the last line to be
statistic1 = 100*sqrt(diag(oo_.var(1:7,1:7)))./oo_.mean(1:7);
which means not transpose the mean of variables, and the above codes work.
``````

===========================================================================

Now my questions are
(1) when i want to run “hp filter”, is that necessary to set the “periods”?
(2) can someone tell me that the Hansen model runs with simulation or not. It seems that the hp_filter does the simulation job already, and i don’t need to set “periods” again, otherwise the results (e.g. the standard deviation of variables) will be too big.
(3) if it is no need to run “periods” when i run Hansen model, then what case for setting the “periods” and “stoch_simul” at the same time?
(4) why sometime we need to transpose the mean figures and somtimes don’t?

Thanks for all the sharing and solving my confusions.

Hi,

If the periods keyword is used, then Dynare computes the simulated moments. Without this keyword Dynare computes the theoretical moments. The hp filter option does not affect this, because we are able to compute the theoretical 2nd order moments of hp dentrended data.

The transpose thing is a bug we have to fix…

Best,
Stéphane.

Hi, the bug is fixed in the trunk. The theoretical mean (stored in oo_.mean) or the simulated mean (again stored in oo_.mean) is a column vector.

Stéphane.