All my MOD files crash at "check ;"


#1

Hi all,

Long-time user posting for the first time. About two weeks ago, all my MOD files started crashing at the same place, right after the “check” command. The error message I get is some variation of the following:

Error using print_info (line 37)
The generalized Schur (QZ) decomposition failed. For more information, see the documentation
for Lapack function dgges: info=4294967296, n=7. You can also run model_diagnostics to get
more information on what may cause this problem.

Error in check (line 76)
print_info(info, 0, options);

Error in fs2000 (line 214)
oo_.dr.eigval = check(M_,options_,oo_);

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

As you can tell, I’m using the fs2000.mod example from the website. The only modification I do to the code is adding “check;” to it (if I don’t do this, the program crashes anyway, giving the exact same message).

This is puzzling to say the least, since I know that the codes run as advertised. I’ve tried uninstalling and re-installing both Matlab (2013b in macOS 10.13.6) and Dynare (from 4.3 to 4.5, currently parked at 4.5.4) to no avail – both at home and at work. Same error, same command.

What’s driving me nuts is that my codes do run in my coauthors’ computers, which suggests that the problem is on my end. However, I have no idea where to look for.

Any insights or ideas will be extremely appreciated. Thanks!


#2

There seems to be some problem with your mjddges.mex-file. Could you please try what happens if you temporarily rename the mex-subfolder of Dynare.
As a diagnostic information:

  1. How did you install Dynare on your mac?
  2. Did you make sure that your Matlab path only contains the Dynare matlab-subfolder and does so on top to avoid naming conflicts?

#3

Thanks for the fast reply!

I’ve changed the name of the mex directory (mex123) and executed fs2000. Here’s the output:

dynare fs2000
Warning: Name is nonexistent or not a directory: /Applications/Dynare/4.5.4/matlab/…/mex/matlab
In path at 110
In addpath at 87
In dynare_config at 140
In dynare at 63

Configuring Dynare …
[m] Generalized QZ.
[m] Sylvester equation solution.
[m] Kronecker products.
[m] Sparse kronecker products.
[m] Local state space iteration (second order).
[no] Bytecode evaluation.
[no] k-order perturbation solver.
[no] k-order solution simulation.
[no] Quasi Monte-Carlo sequence (Sobol).
[no] Markov Switching SBVAR.

Using 64-bit preprocessor
Starting Dynare (version 4.5.4).
Starting preprocessing of the model file …
Substitution of endo leads >= 2: added 1 auxiliary variables and equations.
Found 15 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
  • order 2
    Processing outputs …
    done
    Preprocessing completed.

STEADY-STATE RESULTS:

m 1.011
P 2.25815
c 0.447711
e 1
W 4.5959
R 1.02121
k 5.80121
d 0.849425
n 0.187216
l 0.860425
gy_obs 1.003
gp_obs 1.00797
y 0.580765
dA 1.003

EIGENVALUES:
Modulus Real Imaginary

           0                0                0
   4.036e-18        4.036e-18        5.315e-41
         0.7              0.7                0
      0.9467           0.9467       -3.892e-24
       1.067            1.067                0
   7.428e+07          -0.1598       -7.428e+07
   7.428e+07          -0.3156        7.428e+07

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

The rank condition is verified.

You did not declare endogenous variables after the estimation/calib_smoother command.
Prior distribution for parameter rho has unbounded density!
Error in computing likelihood for initial parameter values

ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: If this is not a problem with the setting of options (check the error message below),
ESTIMATION_CHECKS: you should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):

Error using print_info (line 112)
Likelihood is a complex number

Error in print_info (line 112)
error(‘Likelihood is a complex number’);

Error in initial_estimation_checks (line 175)
print_info(info, DynareOptions.noprint, DynareOptions)

Error in dynare_estimation_1 (line 165)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in fs2000 (line 237)
oo_recursive_=dynare_estimation(var_list_);

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

As for the diagnostics info:

  1. I downloaded the installer directly from dynare.org and just follow the installation steps.
  2. When setting the path, I stay away from the “Add with subfolders” option and just add the \matlab directory. This is right at the top of the path.

Hope this helps!


#4

So the source of the problem is with the mex-files. @HoutanBastani Do you have an idea what might be causing this?


#5

@kingmonty so this worked two weeks ago and now no longer works? The first question is do you remember what you were doing two weeks ago? Did you touch any of your system level files?

And, to be sure, what’s the output of path in Matlab?


#6
  1. I was working on some estimation routines inside a mid-size model, codes worked perfectly but I moved on to other stuff and left the files alone. As soon as I wanted to make some revisions the crashes started to happen.
  2. No, I didn’t touch any system files. This goes both for Matlab and Dynare. Since I didn’t use the software at all, nothing should have changed. [Question: but even if that had been the case, wouldn’t removing and re-installing both Matlab and Dynare fix the issue?]
  3. Here’s the Matlab output from path:

path

  MATLABPATH

/Applications/Dynare/4.5.4/matlab
/Applications/MATLAB_R2013b.app/toolbox/local
/Applications/MATLAB_R2013b.app/toolbox/matlab/codetools
/Applications/MATLAB_R2013b.app/toolbox/matlab/datafun
/Applications/MATLAB_R2013b.app/toolbox/matlab/datamanager
/Applications/MATLAB_R2013b.app/toolbox/matlab/datatypes
/Applications/MATLAB_R2013b.app/toolbox/matlab/elfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/elmat
/Applications/MATLAB_R2013b.app/toolbox/matlab/funfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/general
/Applications/MATLAB_R2013b.app/toolbox/matlab/guide
/Applications/MATLAB_R2013b.app/toolbox/matlab/helptools
/Applications/MATLAB_R2013b.app/toolbox/matlab/iofun
/Applications/MATLAB_R2013b.app/toolbox/matlab/lang
/Applications/MATLAB_R2013b.app/toolbox/matlab/matfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/ops
/Applications/MATLAB_R2013b.app/toolbox/matlab/polyfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/randfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/sparfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/specfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/strfun
/Applications/MATLAB_R2013b.app/toolbox/matlab/timefun
/Applications/MATLAB_R2013b.app/toolbox/matlab/verctrl
/Applications/MATLAB_R2013b.app/toolbox/matlab/demos
/Applications/MATLAB_R2013b.app/toolbox/matlab/graph2d
/Applications/MATLAB_R2013b.app/toolbox/matlab/graph3d
/Applications/MATLAB_R2013b.app/toolbox/matlab/graphics
/Applications/MATLAB_R2013b.app/toolbox/matlab/plottools
/Applications/MATLAB_R2013b.app/toolbox/matlab/scribe
/Applications/MATLAB_R2013b.app/toolbox/matlab/specgraph
/Applications/MATLAB_R2013b.app/toolbox/matlab/uitools
/Applications/MATLAB_R2013b.app/toolbox/matlab/testframework
/Applications/MATLAB_R2013b.app/toolbox/matlab/optimfun
/Applications/MATLAB_R2013b.app/toolbox/distcomp
/Applications/MATLAB_R2013b.app/toolbox/distcomp/distcomp
/Applications/MATLAB_R2013b.app/toolbox/distcomp/user
/Applications/MATLAB_R2013b.app/toolbox/distcomp/mpi
/Applications/MATLAB_R2013b.app/toolbox/distcomp/parallel
/Applications/MATLAB_R2013b.app/toolbox/distcomp/parallel/util
/Applications/MATLAB_R2013b.app/toolbox/distcomp/lang
/Applications/MATLAB_R2013b.app/toolbox/distcomp/cluster
/Applications/MATLAB_R2013b.app/toolbox/distcomp/gpu
/Applications/MATLAB_R2013b.app/toolbox/distcomp/array
/Applications/MATLAB_R2013b.app/toolbox/shared/controllib/general
/Applications/MATLAB_R2013b.app/toolbox/symbolic/symbolic
/Applications/MATLAB_R2013b.app/toolbox/symbolic/symbolicdemos
/Applications/MATLAB_R2013b.app/toolbox/matlab/apps
/Applications/MATLAB_R2013b.app/toolbox/shared/coder/coder
/Applications/MATLAB_R2013b.app/toolbox/optim/optimdemos
/Applications/MATLAB_R2013b.app/toolbox/shared/testmeaslib/graphics
/Applications/MATLAB_R2013b.app/toolbox/shared/optimlib
/Applications/MATLAB_R2013b.app/toolbox/shared/rptgen
/Applications/MATLAB_R2013b.app/toolbox/shared/multimedia
/Applications/MATLAB_R2013b.app/toolbox/shared/asynciolib
/Applications/MATLAB_R2013b.app/toolbox/shared/m3i
/Applications/MATLAB_R2013b.app/toolbox/shared/dastudio
/Applications/MATLAB_R2013b.app/toolbox/shared/instrument
/Applications/MATLAB_R2013b.app/toolbox/shared/simulink
/Applications/MATLAB_R2013b.app/toolbox/optim/optim
/Applications/MATLAB_R2013b.app/toolbox/optim
/Applications/MATLAB_R2013b.app/toolbox/matlab/configtools
/Applications/MATLAB_R2013b.app/toolbox/shared/comparisons
/Applications/MATLAB_R2013b.app/toolbox/matlab/connector/connector
/Applications/MATLAB_R2013b.app/toolbox/matlab/connector/connector/common
/Applications/MATLAB_R2013b.app/toolbox/shared/hwconnectinstaller/common
/Applications/MATLAB_R2013b.app/toolbox/matlab/imagesci
/Applications/MATLAB_R2013b.app/toolbox/shared/advisor
/Applications/MATLAB_R2013b.app/toolbox/shared/testmeaslib/general
/Applications/MATLAB_R2013b.app/toolbox/shared/controllib/graphics
/Applications/MATLAB_R2013b.app/toolbox/shared/controllib/graphics/utils
/Applications/MATLAB_R2013b.app/toolbox/shared/controllib/graphics/plotoptions
/Applications/MATLAB_R2013b.app/toolbox/distcomp/pctdemos
/Applications/MATLAB_R2013b.app/toolbox/matlab/audiovideo
/Applications/MATLAB_R2013b.app/toolbox/matlab/timeseries
/Applications/MATLAB_R2013b.app/toolbox/matlab/hds
/Applications/MATLAB_R2013b.app/toolbox/matlab/system

Not sure if this matters or not, but right after I run Dynare the path command adds some lines:

path

  MATLABPATH

/Applications/Dynare/4.5.4/matlab/modules/dseries/src/utilities/cumulate
/Applications/Dynare/4.5.4/matlab/modules/dseries/src/utilities/variables
/Applications/Dynare/4.5.4/matlab/modules/dseries/src/utilities/from
/Applications/Dynare/4.5.4/matlab/modules/dseries/src/utilities/file
/Applications/Dynare/4.5.4/matlab/modules/dseries/src/utilities/insert
/Applications/Dynare/4.5.4/matlab/modules/dseries/src/utilities/str
/Applications/Dynare/4.5.4/matlab/modules/dseries/src/utilities/is
/Applications/Dynare/4.5.4/matlab/modules/dseries/src/read
/Applications/Dynare/4.5.4/matlab/modules/dates/src/utilities/convert
/Applications/Dynare/4.5.4/matlab/modules/dates/src/utilities/op
/Applications/Dynare/4.5.4/matlab/modules/dates/src/utilities/is
/Applications/Dynare/4.5.4/matlab/distributions
/Applications/Dynare/4.5.4/matlab/kalman
/Applications/Dynare/4.5.4/matlab/kalman/likelihood
/Applications/Dynare/4.5.4/matlab/AIM
/Applications/Dynare/4.5.4/matlab/partial_information
/Applications/Dynare/4.5.4/matlab/perfect-foresight-models
/Applications/Dynare/4.5.4/matlab/ms-sbvar
/Applications/Dynare/4.5.4/matlab/ms-sbvar/identification
/Applications/Dynare/4.5.4/matlab/…/contrib/ms-sbvar/TZcode/MatlabFiles
/Applications/Dynare/4.5.4/matlab/parallel
/Applications/Dynare/4.5.4/matlab/particles/src
/Applications/Dynare/4.5.4/matlab/gsa
/Applications/Dynare/4.5.4/matlab/ep
/Applications/Dynare/4.5.4/matlab/convergence_diagnostics
/Applications/Dynare/4.5.4/matlab/cli
/Applications/Dynare/4.5.4/matlab/lmmcp
/Applications/Dynare/4.5.4/matlab/optimization
/Applications/Dynare/4.5.4/matlab/modules/dates/src
/Applications/Dynare/4.5.4/matlab/modules/dseries/src
/Applications/Dynare/4.5.4/matlab/utilities/doc
/Applications/Dynare/4.5.4/matlab/utilities/tests/src
/Applications/Dynare/4.5.4/matlab/utilities/dataset
/Applications/Dynare/4.5.4/matlab/utilities/general
/Applications/Dynare/4.5.4/matlab/utilities/graphics
/Applications/Dynare/4.5.4/matlab/modules/reporting/src
/Applications/Dynare/4.5.4/matlab/modules/reporting/macros
/Applications/Dynare/4.5.4/matlab/missing/rows_columns
/Applications/Dynare/4.5.4/matlab/missing/issquare
/Applications/Dynare/4.5.4/matlab/missing/vec
/Applications/Dynare/4.5.4/matlab/missing/stats
/Applications/Dynare/4.5.4/matlab/missing/nanmean
/Applications/Dynare/4.5.4/matlab/missing/struct2array
/Applications/Dynare/4.5.4/matlab/missing/isfile
/Applications/Dynare/4.5.4/matlab/…/mex/matlab/osx
/Applications/Dynare/4.5.4/matlab/…/mex/matlab
/Applications/Dynare/4.5.4/matlab
/Applications/MATLAB_R2013b.app/toolbox/local

… and so on. At any rate, the code still crashes and the error message is the same.


#7

What happens when you run
which mjdgges
after executing the mod-file?


#8

@kingmonty responding to your question in point 2 above, no. System files are those that belong to the operating system, not to Dynare or Matlab. Dynare mex files on macOS depend on some libraries that are distributed with all versions of macOS. If these change place or are removed, then the mex files won’t work.

The system files I am referencing are located in the /usr and /System directories…

Did you by any chance install something on your computer two weeks ago?

The answer to @jpfeifer’s question above should be:

/Applications/Dynare/4.5.4/mex/matlab/osx/mjdgges.mexmaci64

If it is indeed that, I cannot think of anything other than a misplacement of system files. If you have backups of your computer, you can restore the directories mentioned above from a point before when dynare broke and try again. Though, if in these past two weeks you have upgraded your computer that wouldn’t be advisable…


#9

Just to update you, I upgraded my system to 10.13.6 and it works fine for me.


#10

Here’s the output:

which mjdgges
/Applications/Dynare/4.5.4/matlab/…/mex/matlab/osx/mjdgges.mexmaci64

From the conversation, I think there’s something off in my system files. I will reinstall everything from a blank slate and see what happens. I’ll report the results as soon as everything is back in place.

Thanks for your help!


#11

Update:

I erased the hard drive and installed macOS from scratch, then Matlab, then Dynare. I’m still getting the same error. (Just to be safe: I didn’t add any other software or update – except for Apple-provided ones. This is as clean of an install as it can be.)

One thing I noticed is that @HoutanBastani’s answer to which mjdgges is

/Applications/Dynare/4.5.4/mex/matlab/osx/mjdgges.mexmaci64

while I’m getting

/Applications/Dynare/4.5.4/matlab/…/mex/matlab/osx/mjdgges.mexmaci64

I’m not sure if the “/…/” term in between the folders matters.


#12

the .. stands for going up one folder. Hence, the two are identical.


#13

@jpfeifer That’s right! I forgot my directory syntax. My apologies.

Out of desperation I started playing around with the Dynare directory structure and I found several things:

  1. The estimation command runs as advertised if I comment the “check” command and I change the name of the 4.5.4/mex folder (say, mex123).
  2. The stochastic simulation command doesn’t work. For example, a bare-bones Hansen (1985) model (see attached MOD) crashes as follows:

dynare indivisible

Configuring Dynare …
[m] Generalized QZ.
[m] Sylvester equation solution.
[m] Kronecker products.
[m] Sparse kronecker products.
[m] Local state space iteration (second order).
[no] Bytecode evaluation.
[no] k-order perturbation solver.
[no] k-order solution simulation.
[no] Quasi Monte-Carlo sequence (Sobol).
[no] Markov Switching SBVAR.

Using 64-bit preprocessor
Starting Dynare (version 4.5.4).
Starting preprocessing of the model file …
Found 5 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
    Processing outputs …
    done
    Preprocessing completed.

STEADY-STATE RESULTS:

k 11.476
c 0.832039
h 0.302084
y 1.11894
z 1

MODEL SUMMARY

Number of variables: 5
Number of stochastic shocks: 1
Number of state variables: 2
Number of jumpers: 2
Number of static variables: 1

MATRIX OF COVARIANCE OF EXOGENOUS SHOCKS
Variables mu
mu 0.000049

POLICY AND TRANSITION FUNCTIONS
k c h y z
Constant 11.475958 0.832039 0.302084 1.118938 1.000000
k(-1) 0.941817 0.038542 -0.012547 0.005358 0
z(-1) 1.692324 0.371722 0.422280 2.064046 0.950000
mu 1.781394 0.391287 0.444505 2.172680 1.000000

THEORETICAL MOMENTS
VARIABLE MEAN STD. DEV. VARIANCE
k 11.4760 0.5040 0.2541
c 0.8320 0.0264 0.0007
h 0.3021 0.0070 0.0000
y 1.1189 0.0507 0.0026
z 1.0000 0.0224 0.0005

MATRIX OF CORRELATIONS
Variables k c h y z
k 1.0000 0.9841 0.1690 0.7766 0.7526
c 0.9841 1.0000 0.3417 0.8763 0.8577
h 0.1690 0.3417 1.0000 0.7522 0.7762
y 0.7766 0.8763 0.7522 1.0000 0.9993
z 0.7526 0.8577 0.7762 0.9993 1.0000

COEFFICIENTS OF AUTOCORRELATION
Order 1 2 3 4 5
k 0.9985 0.9942 0.9875 0.9786 0.9678
c 0.9941 0.9860 0.9758 0.9639 0.9504
h 0.8954 0.7992 0.7108 0.6296 0.5552
y 0.9539 0.9099 0.8678 0.8277 0.7894
z 0.9500 0.9025 0.8574 0.8145 0.7738
Error using chol
Matrix must be positive definite.
Error in stoch_simul (line 196)
cs = transpose(chol(SS));
Error in indivisible (line 153)
info = stoch_simul(var_list_);
Error in dynare (line 223)
evalin(‘base’,fname) ;

Would this help?

indivisible.mod (1.1 KB)


#14

Not really. You simply proved the previous point, namely that removing the mex-files circumvents the issue. But for many applications, these mex-files are crucial and we still do not know why they do not work