Hello everyone,

I’m working with a news shocks model. Milani and Treadwell (2012) find the optimal lag of this type of shock by comparing various model specifications by checking the marginal likelihoods (using Geweke’s harmonic mean approximation for alternative horizons for the news shocks). As far as I know, to find this information it is necessary to run the model to be estimated, which can take several hours. Is there another way to do this model comparison? Thank you.

You could make do with the Laplace approximation to get the marginal data density. That would only involve mode-finding, not the full estimation.

Thank you for your attention, Professor Pfeifer.

Are there any examples of how I can do this in Dynare?

Whenever you run mode-finding and the Hessian at the mode is positive definite, there should be a `oo_.MarginalDensity.ModifiedHarmonicMean`

field storing the result.

Thank you very much for your attention, but it was not clear how to get to that step. Should I use the estimation-command by changing something in the options?

No, as I said, this number should be there whenever you run mode-finding. You can simply set `mh_replic=0`

to save time by shutting off the Bayesian estimation.

Sorry to go back to this point, but the sequence of commands I have used in the estimation is

resid (1);

model_diagnostics;

identification (advanced = 1, graph_format = pdf);

estimation (datafile = brdatach1_29, xls_sheet = brdata, xls_range = A1: C76, mode_check, graph_format = pdf, mh_replic = 0, mh_nblocks = 1, mh_drop = 0.5, mh_jscale = 0.2, mh_conf_sig = 0.90, mode_compute = 6) y pi i;

This sequence takes a lot of time, even using mh-replic = 0 and changing mh_nblocks from 2 to 1. Is there anything else that can be done in this case to save time?

Your time-consuming step is the `mode_compute=6`

. The `mh_nblocks`

does nothing, because you have `mh_replic = 0`

. Why are you using that mode-finder?

I’m using this mode-finder because once I’ve set the optimal number of lags I’m going to work with it, to run the whole estimate. By your question, then, I do not need to use it. What would be the least time consuming option in the Dynare Manual? Thanks a lot, Professor.

I would try `mode_compute=5`

. You should always check the result using the `mode_check`

option.

Professor Pfeifer, thank you very much for your attention. A theoretical question: if I do choose the best model specification with mode_compute=5 and then run the full estimation with another optimizer (if necessary), is the comparison of differentiated specifications no longer valid? I ask this because I have already seen in the forum suggestions to change the mode_compute for the estimation to work. I have already observed this in practice.

If you found the true mode, a change of optimizers should not affect the results, because they should find the same mode again. If they do not, either they got stuck at a local mode or you did not find the correct mode the first time.

Prof Pfeifer, since we exchanged messages, have tried to arrive at the optimal lag of news shocks in my model. The point is that, depending on the lag, I can not find the marginal data density. Dynare reports:

“Log data density [Laplace approximation] is NaN.”

This occurs for some lags, but not for others, keeping everything else constant. I’ve tried changing mode-compute, but that does not work. I would like to know, please, if it is valid to do this comparison of models leaving all parameters calibrated but the standard deviations of the shocks.

Once the optimum lag of the news shock is found, then I return to the full model, to be estimated.

Theoretically, is there something wrong with this procedure?

Thank you.

That means you did not find a proper mode. Given the theoretical evidence that the effect of news shocks typically increases in the anticipation horizon, it does not seems advisable to fix the standard deviation of shocks. I would rather spend more time on mode-finding.

Thank you for your attention and patience, Professor Pfeifer. I can not find the mode only when I leave all parameters and standard deviations free. As I fix the parameters (calibration) and leave the standard deviations free, I get their mode, but I do not know if this is valid.

What do the mode_check plots say in the cases that do not work? Anything suspicious?

Usually, when I find the log of the data density equal to NaN, the check mode shows that there are several points in red big red dots (indicate parameter values for which the model could not be solved, as pointed out in its graphics manual). When I change the news shocks lag, other parameters present problems. I tried to change the initial values, but I did not succeed.

Then you need to find out where the dots are coming from. You should enable `options_.debug=1`

to see the error codes associated with the red dots.

Professor Pfeifer, sorry to go back to the topic, but check_plot shows that I found the global trend for all parameters, for both news_i7 (-7) and news_i3 (-3). For lag of 7 lags, I have the Laplace marginal density, but for lag of 3, I have the following message. Does not seem to be a global mode problem !

POSTERIOR KERNEL OPTIMIZATION PROBLEM!

(minus) the hessian matrix at the “mode” is not positive definite!

=> posterior variance of the estimated parameters are not positive.

You should try to change the initial values of the parameters using

the estimated_params_init block, or use another optimization routine.

Warning: The results below are most likely wrong!

In dynare_estimation_1 (line 316)

In dynare_estimation (line 105)

In tese1new (line 486)

In dynare (line 235)

MODE CHECK

Fval obtained by the minimization routine (minus the posterior/likelihood)): 198.935249

mode_check:: could not solve model for parameter iota at value 1.673, error code: 41

Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

In dynare_estimation_1 (line 339)

In dynare_estimation (line 105)

In tese1new (line 486)

In dynare (line 235)

Log data density [Laplace approximation] is NaN.newlag.mod (4.5 KB)

brdatach1new.xls (35.5 KB)

Got any additional tips? Here is my mod file and the database used. Thank you so much.

The error code is (see `print_info.m`

)

```
error('one (many) parameter(s) do(es) not satisfy the lower bound');
```

Thus, you do not have an interior solution for your mode.