I have a strange problem when doing this method and I’ve traced the problem to

dsge_likelihood=>dynare_resolve=>resol=>stochastic_solvers=>dyn_first_order_solver=>dyn_first_order_solver

Then, I run Matlab in debug mode and I set a break point just at row 220 where the following code line is

[err, ss, tt, w, sdim, dr.eigval, info1] = mjdgges(E, D, DynareOptions.qz_criterium, DynareOptions.qz_zero_threshold);

And then when I click “step in” in Matlab but it just passes it without stepping in but I still get values for [err, ss, tt, w, sdim, dr.eigval, info1]. And when I try to open

mjdgges it says that it doesn’t exist (all this I do in debug mode when the courser is stopped just at the line after (221)). I also noticed that when I run the code over and over again with different paramater vectors in dsge_likelihood (I change xparam1) it gives the same value for [err, ss, tt, w, sdim, dr.eigval, info1].

So, what I do next is that I once again stop at [err, ss, tt, w, sdim, dr.eigval, info1] = mjdgges(E, D, DynareOptions.qz_criterium, DynareOptions.qz_zero_threshold); (row 220 in dyn_first_order_solver) and before I click “step in” I manually add the folder where mjdgges is located by clicking

addpath C:\dynare\4.4.1\matlab\qz. Then I am able to “step in” and what happens then is that I get complex values for w in the output vector [err, ss, tt, w, sdim, dr.eigval, info1]. And when I run Matlab normally after that it always gives negative values for w which in turn always gives me the likelihood value 1.0000e+8 regardless of what parameter i put in.

So can anybody make sense of this? What can I do?