Bug in "check;" or "resolve.m" (64-bit)?

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.

Bug in "check;" or "resolve.m" (64-bit)?

Postby jpfeifer » Thu Apr 15, 2010 3:52 pm

Hello,

I have a large scale New Keynesian model where I computed the steady state by hand. While trying to debug the model and its parametrization I encountered three problems (Dynare 4.1.1, Matlab2009b 64bit,Win XP Professional):
  1. When using
    Code: Select all
    check;

    as the last command in my model-file after

    Code: Select all
    model;
    ...
    end;

    shocks;
    ...
    end;
    steady;


    it tells me

    There are 41 eigenvalue(s) larger than 1 in modulus
    for 42 forward-looking variable(s)

    The rank conditions ISN'T verified!


    When putting
    Code: Select all
    stoch_simul(irf=20,nomoments,nocorr,order=1,nofunctions,noprint) y_H;

    after the check command, I get

    There are 40 eigenvalue(s) larger than 1 in modulus
    for 42 forward-looking variable(s)

    The rank conditions ISN'T verified!


    and when putting the second order approximation

    Code: Select all
    stoch_simul(irf=20,nomoments,nocorr,order=2,nofunctions,noprint) y_H;


    I get;

    There are 42 eigenvalue(s) larger than 1 in modulus
    for 42 forward-looking variable(s)

    The rank condition is verified.


    How can it be that the output of the check command depends on the following commands invoked? Is there maybe a bug in the .mex64-files invoked by "check;" or "resolve.m"?
  2. For a somewhat different parametrization
    Code: Select all
    check;

    tells me that

    There are 43 eigenvalue(s) larger than 1 in modulus
    for 42 forward-looking variable(s)

    The rank conditions ISN'T verified!

    However,
    Code: Select all
    stoch_simul(irf=20,nomoments,nocorr,order=1,nofunctions,noprint) y_H;

    nevertheless computes the model solution and gives impulse responses. However, they look completely different than the ones on Matlab 2009a 32 bit machine. Moreover, the check command on the latter Matlab version says
    There are 42 eigenvalue(s) larger than 1 in modulus
    for 42 forward-looking variable(s)

    The rank conditions is verified!

    which would be consistent with the Blanchard-Kahn conditions being satisfied.
  3. While the latter parametrization produces prima facie sensible output on the 64bit machine with
    Code: Select all
    stoch_simul(irf=20,nomoments,nocorr,order=1,nofunctions,noprint) y_H;

    the standard second order approximation
    Code: Select all
    stoch_simul(irf=20,nomoments,nocorr,order=2,nofunctions,noprint) y_H;

    fails as all impulse responses in oo_.irfs are NaN. Moreover,
    Code: Select all
    stoch_simul(irf=20,nomoments,nocorr,order=1,aim_solver,nofunctions,noprint) y_H;

    fails with
    Error in AIM: aimcode=3 : Aim: too many big roots.

    While there is most probably still a problem with the model parametrization, troubleshooting is complicated by the contradicting outputs. Which ones should I trust?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Bug in "check;" or "resolve.m" (64-bit)?

Postby SébastienVillemot » Mon Apr 19, 2010 10:41 am

Hi,

Indeed the output of "check" should not be affected by the commands following it, so this is probably a bug in Dynare or a pathological case. But it is normal that this output changes when you change the parametrization.

Please post your MOD file so that we can see where the problem is.

Best
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: Bug in "check;" or "resolve.m" (64-bit)?

Postby SébastienVillemot » Wed Apr 28, 2010 1:04 pm

Hi,

There are at least two issues:
  • The first issue is auxiliary variables (see http://www.dynare.org/DynareWiki/AuxiliaryVariables) which are created for variables with leads or lags greater than 2. The point is that aux vars (and their associated auxiliary equations) are created only when there is a stoch_simul. So, in the output of the preprocessor, you can see that there are 107 equations whithout stoch_simul and 111 with stoch_simul. This explains the first discrepancy that you pointed.
  • The second discrepancy seems related to the numerical instability of the steady state. My understanding is that your steady state file doesn't always return exactly the same value (when you swith from order=1 to order=2 for example). You can experiment with that by using the save_params_and_steady_state and load_params_and_steady_state (see the reference manual), which will help you to use exactly the same steady state across specifications. If you use exactly the same steady state for order=1 and order=2 (using the previous commands), then you get the same output concerning eigenvalues.

There may be other problems related to the numerical instability of your model, but it didn't investigate them.

Best
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: Bug in "check;" or "resolve.m" (64-bit)?

Postby jpfeifer » Wed Apr 28, 2010 7:00 pm

Hi Sébastien,

thank you for your help. The first part of your answer mostly clarifies the issue. Unfortunately, the second issue still puzzles me.

1. The steady state is numerically stable. Although I use fsolve in the steady state-file, I always get the same steady state values for all variables. In contrast to csminwel, fsolve works deterministically, so there is no random element, if I keep parameters constant. I explicitely checked for the stability of the steady state estimates by saving oo_.steady_state from order=1 and order=2 and comparing it in Matlab with the isequal command. They are identical. I did the same with Matlab 2009a 64bit and 2009b 64 bit and the steady states are also identical. The same applies to the eigenvalues saved in oo_.dr1.eigval. Hence, the steady state should not be the issue.

2. The problem with the different IRs is not due to 32-bit vs. 64-bit systems. Rather, there is a difference in the IRs between Matlab 2009a and 2009b, but I do not know why this is the case.

3. I could trace back the third issue in my initial post (second order IRs do not work while first order IRs do) to the NaNi in the eigenvalues as described in a related post http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=1814 .
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 8 guests