How to fix the problem

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

How to fix the problem

Postby bigbigben » Thu Feb 19, 2009 4:46 am

I am estimating a DSGE model. The initial value is OK,but during the optimization process, an error message pops up:

??? Error using ==> mjdgges
MJDGGES requires two square real matrices of the same dimension.

What does it mean and how to work around it?
bigbigben
 
Posts: 171
Joined: Sun May 28, 2006 1:19 am

Re: How to fix the problem

Postby JamieHall » Mon Mar 02, 2009 5:48 am

Hi bigbigben,

In short, there's probably a conceptual problem in your model itself. But you can circumvent the problem in the estimation by editing dr1.m in Dynare's matlab folder. Before line 360, add these lines:
Code: Select all
if(any(any(imag(d))) || any(any(imag(e))))
         info(1) = 2;
         info(2) = 666;
         return;
      end

This should allow you to estimate the model, at least to the point where you can tell where the deep problem is. (Don't forget to use mode_check! :^)


Here is some more detail on what I think is going on. mjdgges is the function that takes your model from this form:
D * y(t+1 | t) = E * y(t) + A * eps(t)
to this form:
y(t) = B * y(t-1) + C * eps(t)
which can then be estimated, etc.

If one of the structural parameters isn't given a numerical value, or if it's calculated in a way that involves dividing by zero or taking the square root of a negative number, then the matrices D and E will contain "NaN" and/or "Inf" and/or complex values. Hence the complaint that it wants "real" matrices.

This is usually caused by one of two things. If it happens when you try to do impulse responses or start an estimation, then there's probably an uninitialised parameter. (That's easy to miss, because they're case sensitive.) If it happens halfway through an estimation, as I guess is the case with your model, then it might be that one of the parameters has wandered into a region that doesn't make sense. Maybe try looking for parameters that are used as powers in steady-state calculations and such, and put explicit boundaries on their priors.

Hope that helps....


Jamie
JamieHall
 
Posts: 20
Joined: Wed Feb 11, 2009 4:42 am


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 11 guests