Possible bug in dsge_likelihood function

Dear Moderators

During estimation of a medium scale dsge model, I get the error:

[code]Reference to a cleared variable DH.

Error in dsge_likelihood (line 714)

Error in dynare_estimation_1 (line 616)
[junk1, junk2, hh] = feval(objective_function,xparam1, …

Error in dynare_estimation (line 89)

Error in main (line 720)

Error in dynare (line 180)
evalin(‘base’,fname) ;

Error in main_mainfile (line 173)
dynare main noclearall[/code]

I am using mode_compute=4. Is this a bug, or is there a problem with my program? Is there a quick fix to it?

I am using dynare 4.4.3 and Matlab R2016a. Thanks for taking a look!

This is defintely a bug. Please try the unstable version to see if has been fixed already. If the problem persists, please provide me with the files

Looking at the dsge_likelihood function (in version 4.4.3), it seems strange to me that the measurement error equation is set to:

H = zeros(pp,1); on line 338. Then, the statement if all(all(abs(H-diag(diag(H)))<1e-14)) (line 708) is always true (when H remains a vector), which is not what it is supposed to do, if I understand the code correctly.

In the unstable version, ‘initial_estimation_checks’ throws an error, saying that the forecast error variance became singular.
Can you tell if this is a problem with my code or with dynare?
main.zip (15.5 KB)

The behavior in 4.4.3 is a bug that is fixed in the unstable version. The message about stochastic singularity that you get, indicates a problem with your model. There must be an exact linear combination of observables implied by your model.