Evaluating Model Fit - simult_

Dear all,

I’d be really grateful if somebody could double check, whether the following approach is either total nonsense or actually correct. In order to compare my model to the data I take the following steps:

  1. Estimate the model and retrieve the series of smoothed shocks.
  2. Feed those shocks into the model calibrated at the posterior mean via simult_
  3. Simulate the model and obtain the model counterparts in deviations from their steady state.
  4. Plot model observables against the data.

The above steps follow the codes written by Johannes for his Dynare paper “Macroeconomic effects of financial shocks: A comment” for counterfactual simulations.

I’m not 100% sure if the above model comparison is actually correct and therefore would be very grateful for any comments.

Thanks for your help.



I just realised what I did was absolute nonsense, because by following the above steps I should more or less get back the observed time series, correct?. Do you have any idea how to simulate data from the model and then plot it against the actual time series to assess the model fit?

If your model was estimated using full information techniques, then the model fits the observed data perfectly. So what is the context you have in mind?
In the Jermann/Quadrini, the RBC model used shocks derived from outside of the model. So here you can evaluate the fit.

Hi Johannes,

Many thanks for your reply. Of course, sorry, you’re right.

Just one last question. I have now tried to replicate the smoothed variables by feeding in the smoothed shocks. There have been numerous questions in this forum about this, that’s why I paid attention to the variable ordering. When I retrieved the smoothed variables I made sure that they follow the declaration as in M._endo_names.

When I execute simult_ I choose the first element of the smoothed variables vector as the initial value. However, as you will see there are still differences between model and time series, especially the third observable. I know you have only limited time but it would be great if you could give me any hint which could potentially explain this. I have attached all relevant codes. Many thanks.


replication_smoothed_variables.zip (33.6 KB)

Did you follow https://github.com/DynareTeam/dynare/blob/master/tests/kalman_filter_smoother/compare_results_simulation/fs2000.mod ?

Thanks for your reply Johannes. Yes, I came across this example but used your Jermann/Quadrini codes. I have now followed closely the fs2000 mod file to replicate the smoothed series. The good news is I was able to identify one more mistake and it brought the model and data series closer together. However, there’s still a difference between them… Do you think this has something to do with the initial values?

I have to retrieve my smoothed variables from:


and not


Under the second path I can only find the smoothed variables which I had explicitly defined after the estimation command. Do you think obtaining the variables from the first path might be the problem? But then they should be identical.

Under the link you can find all relevant files.


I have to say I think I’m gonna give up. I even estimated the model again for the last 500,000 draws but without any success… maybe I have done something in the past which causes now the problems. As I’m not planning to perform a counterfactual shock exercise at this stage I leave it for now.

However, I have run the fs2000 mod file, where I first received an error message due to a cell-array problem. After fixing it, the model produced perfectly the observed series. In case you also also experience the cell-array error after running the fs2000 mod file, I have attached the updated codes.

fs2000.mod (4.9 KB)

Which Dynare version are you using? The unstable version (4.6) is moving to cell arrays instead of character arrays.

That explains it, I’m using the 4.5.4 version. Thanks for your help.