Results from posterior subdraws versus results from posterior means

Hi all, I was wondering if anyone could help me with a question related to the Bayesian estimation:

For some object of interest (such as smoothed variables or forecasts), would it be different if we calculate its value in the following two methods?

(1) Calculate its value for each posterior subdraw of the parameters, and then take the average across all subdraws;
(2) Calculate its value by fixing the parameter values to their posterior means.

Intuitively, they should be different, because the object of interest is usually a nonlinear function, say f(\cdot), of the estimated parameters, say \hat{\theta}. So usually E[f(\hat{\theta})] \neq f(E[\hat{\theta}]).

As an experiment, I calculated the values of two objects based on the above two methods in an estimated Smets and Wouters (2007) model. The two objects are the smoothed values and forecasts of the real GDP growth.

Method (1) is how Dynare calculates smoothed variables and forecasts after MCMC draws. So I just took two arrays after a Bayesian estimation:

oo_.SmoothedVariables.Mean.gdp_obs
oo_.MeanForecast.Mean.gdp_obs


For method (2), I followed the suggestion from this post,

added three lines in “dynare_estimation_1.m”, removed estimation blocks in the mod-file, fixed the parameter values to their posterior means, changed the estimation command to something like

estimation(smoother, order=1, prefilter=0, datafile=..., xls_sheet=..., xls_range=..., presample=4, mode_compute=0, forecast=40) gdp_obs


and collected the following two arrays:

oo_.SmoothedVariables.gdp_obs
oo_.forecast.Mean.gdp_obs


Interestingly, the forecasts are dissimilar but the smoothed variables are almost the same.

How to explain this difference? Did I do something wrong for the second method?

This is indeed strange. I am mostly puzzled by the right picture. It is unusual that the smoothed variables and shocks are indistinguishable.

That’s also what I think. But just to confirm, the method I described to get forecast / smoothed variables by fixing the parameters to their posterior means is correct, is that right?

I put the m-file (and other related files) that is used to compare these results on this link (as it is 6 MB, exceeding the largest file size allowed to be uploaded here)

I’d really appreciated it if you would have a look. The m-file first calls Dynare to get the results using the second method. It then loads a mat-file "workspace.mat“, which contains the results from the first method.

The file “SW07_posterior_means.mod” corresponds to the second method.
The file “SW07_posterior_subdraws.mod” corresponds to the first method. This one will not be called by Matlab as it time-consuming to get the posterior means again.