Dear All,

I am replicating the SW2007. I can use the code of BVAR provided by the authors to get the RMSE of VARs, but I don’t know how to calculate the RMSE of the DSGE.

Do you know how to get the RMSE of DSGE with dynare code below?

estimation(optim=(‘MaxIter’,200),datafile=‘usmodel_data.mat’,mode_compute=0,mode_file=mode1,first_obs=71,nobs=100,presample=4,lik_init=2,prefilter=0,mh_replic=0,mh_nblocks=2,mh_jscale=0.20,mh_drop=0.2,forecast=12).

Through this code, I just get the means of the forecast in the oo_.forecast.Mean, but don’t get enough infromation to calculate the RMSE.

Thank you for your help.

Which RMSE exactly do you want to compute?

Just as is shown in the picture, I need compute the DGP, dP, Fedfunds, Hours, Wage, Consumption, Investment, and overall. In the code, they are dy, pinfobs, robs, labobs, dw, dc, dinve,respectively.

As it says in the paper:

The forecast period is 1990:1–2004:4. VAR(1) and BVAR(4) models are

reestimated each quarter, the DSGE model each year.

So you have to reestimate the model, get the forecasts, compute the forecast errors by comparing the forecast to the realization in the data, and then computing the RMSE from this time series of forecast errors.

Yes. I have reestimated it with the code below. But after reestimating, I just got the oo_.forecast.Mean, HPDinf and HPDsup. I do not think these three are enough to get the RMSE. SO, I wonder if my code is right. Or maybe I use a wrong method to calculate the RMSE.

estimation(optim=(‘MaxIter’,200),datafile=‘usmodel_data.mat’,mode_compute=0,mode_file=mode1,first_obs=71,nobs=100,presample=4,lik_init=2,prefilter=0,mh_replic=0,mh_nblocks=2,mh_jscale=0.20,mh_drop=0.2,forecast=12).

Why are those not sufficient?

I used a wrong formula to caculate the RMSE before. And now I update the formula, RMSE=(1/T*∑(oo_.forecast.Mean-Actual data)^2)^(1/2), but my result is not completely the same as SW2007’s, maybe it is because I modifed some equations in the code.

If you want to compare your result to SW, you must not modify anything. But in any case, you should expect slight differences, because the estimation is completely deterministic and there may be small differences arising from using a newer Dynare version.

Got it, thank you so much! I will have a try.