Dear all,
I think I found a serious bug in estimation which I think could potentially lead to delivering wrong results. It looks as if both the 4.3 and Master branches are affected. Dynare 4.2.5 is clean as this bug was introduced when we fixed
“When running estimation or identification on models with non-diagonal structural error covariance matrices while not simultaneously estimating the correlation between shocks (i.e. calibrating the correlation) Dynare handles the off-diagonal elements incorrectly or crashes”
The issue is the following: As soon as you estimate a correlation in the covariance matrix, the updating in set_all_parameters was not completely based on the most recent parameter draw. Instead, we used a mixture of the old and new correlation.
In the old code we have after updating the variances in Sigma_e based on the current draw the following
if ~isempty(M.Correlation_matrix) Sigma_e = diag(sqrt(diag(Sigma_e)))*M.Correlation_matrix*diag(sqrt(diag(Sigma_e))); end
Note that this is the Correlation matrix of the last draw. If correlations are estimated, we next update the correlation matrix and Sigma_e. But when doing so, we make use of the Sigma_e just updated based on the old correlation matrix.
if ncx corrx = estim_params.corrx; for i=1:ncx k1 = corrx(i,1); k2 = corrx(i,2); M.Correlation_matrix(k1,k2) = xparam1(i+offset); M.Correlation_matrix(k2,k1) = M.Correlation_matrix(k1,k2); Sigma_e(k1,k2) = xparam1(i+offset)*sqrt(Sigma_e(k1,k1)*Sigma_e(k2,k2)); Sigma_e(k2,k1) = Sigma_e(k1,k2); end end
If the changes in the correlation are small, the difference might be negligible. Thus, it is hard to tell how serious this is. Nevertheless, if you share my assessment, I think we should issue a fixed version 4.3.3 as soon as possible.
The solution is simply to check whether ncx is not 0 and only update then.
I pushed a fix for this and several other bugs encountered when fixing this.
Best,
Johannes
-- Johannes Pfeifer Haußerstr. 29 72076 Tübingen Tel.: +49-(0)7071-6396184 Mobil.: +49-(0)170-6936820 Germany
-----Ursprüngliche Nachricht----- Von: Sébastien Villemot [mailto:sebastien@dynare.org] Gesendet: Dienstag, 19. März 2013 21:51 An: Johannes Pfeifer Betreff: Re: Bug in estimation
I am sorry, I will be travelling tomorrow, so I won’t have the time to look at this before Thursday.
I suggest that you discuss this on the dev@dynare.org list. What seems important to me is to clearly identify in which case the estimation in broken, so that we can give the relevant information to our users. We will also probably release 4.3.3 soon if this is confirmed.
Thanks,
Le mardi 19 mars 2013 à 21:44 +0100, Johannes Pfeifer a écrit :
Dear Sébastien,
I think I found a serious bug in estimation which I think could potentially lead to delivering wrong results. It looks as if both the 4.3 and Master branches are affected. Dynare 4.2.5 is clean as this bug was introduced when we fixed
“When running estimation or identification on models with non-diagonal structural error covariance matrices while not simultaneously estimating the correlation between shocks (i.e. calibrating the correlation) Dynare handles the off-diagonal elements incorrectly or crashes”
How do we proceed in such cases? Issue 4.3.3 as soon as possible?
Best,
Johannes
--
Johannes Pfeifer
Haußerstr. 29
72076 Tübingen
Tel.: +49-(0)7071-6396184
Mobil.: +49-(0)170-6936820
Germany
-- Sébastien Villemot Researcher in Economics Dynare developer http://www.dynare.org/sebastien