Smets/Wouters 2007: marginal likelihood

Dear Professor Johannes Pfeifer,

I encountered the same issue: the modified harmonic mean estimates obtained by the replication codes differ from the paper.
The estimate obtained by running your code with Dynare 6.2 is -922.1839.
I also estimated the model using the replication code at the AER’s homepage with Dynare version 3 (dyn-mat-v3-065.zip), and the resulting modified harmonic mean estimate is -922.0991
Both of them are much smaller than what is reported in the paper:-905.8.
Do you happen to have some idea of the differences between replication codes and the result reported in the paper?

*Laplace estimate in both your code and the original replication code is the same: -923.0527, which is close to the paper (-923).

Did you use the training sample code

// Calculation the marginal likelihood with training period (40 observations between '56 and '65)
// estimation(optim=('MaxIter',200),datafile=usmodel_data,mode_compute=0,mode_file=usmodel_hist_dsge_f19_7_31_mode  ,first_obs=31,nobs=200,presample=4,lik_init=2,prefilter=0,mh_replic=0,mh_nblocks=2,mh_jscale=0.20,mh_drop=0.2);
// estimation(optim=('MaxIter',200),datafile=usmodel_data,mode_compute=0,mode_file=usmodel_hist_dsge_f19_7_3144_mode,first_obs=31,nobs=44,presample=4,lik_init=2,prefilter=0,mh_replic=0,mh_nblocks=2,mh_jscale=0.20,mh_drop=0.2);

?

Thank you so much for your reply. Now I understand what the problem was.
The code I used is

 estimation(optim=('MaxIter',200),datafile=usmodel_data,mode_compute=0,mode_file=usmodel_mode,first_obs=71,presample=4,lik_init=2,prefilter=0,mh_replic=250000,mh_nblocks=2,mh_jscale=0.20,mh_drop=0.2);

This is because I wanted to replicate the marginal likelihood estimate in Table 2 (-905.8), which I thought was based on the modified harmonic mean estimator (footnote 11), but it was actually not. It is based on Laplace approximation with the codes you provided.
I got the number -905.8 by taking the difference of the two estimates of the marginal likelihoods.

However, is this a valid exercise to take a difference of the marginal likelihoods of two sample periods? I am not sure if the marginal likelihood can be added and subtracted across samples.

You can write the marginal likelihood of a joint sample as the product of the likelihood of the subsamples. Taking the difference of the logs is therefore fine.

Thank you!