Change in function dyntable in Dynare 4.5

Stephan, i got a problem with dyntable in versions 4.5.0 and 4.5.1. dyntable worked fine in version 4.4.3 .
here is the error message, can you help?
Struct contents reference from a non-struct array object.

Error in dyntable (line 31)
if options_.noprint

Error in rbc_cooley_scenarios (line 165)
dyntable('Relative standard deviations in %',strvcat('VARIABLE','REL. S.D.'),M_.endo_names(1:6,:),statistic1,10,8,4);

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

Error in main_comparison_RBC (line 45)
       dynare  rbc_cooley_scenarios.mod noclearall

Dear Werner,

We have changed the interface of the dyntable routine between 4.4 and 4.5. Are you calling directly this function in your mod file? If not can you post our mod file?

In 4.5.x the header of the function is:

function dyntable(options_,title,headers,labels,values,label_width,val_width,val_precis,optional_header)
% function dyntable(title,headers,labels,values,label_width,val_width,val_precis)
% Inputs:
%   options_    [structure]         Dynare options structure
%   title       [string]            Table title
%   headers     [n by nchar]        character array of labels for header row
%   labels      [n by nchar]        character array of labels for label column
%   values      [matrix]            matrix of values to display
%   label_width [scalar]            Width of the label
%   val_width   [scalar]            Width of value column
%   val_precis  [integer]           precision of displayed values

while in 4.4.x, the header is:

function dyntable(title,headers,labels,values,label_width,val_width, val_precis)

So if you call directly this routine in your mod file, you need at least to add options_ as a first argument.

Best,
Stéphane.

i added options_ , than i got a different error message

Preprocessing completed.

Index exceeds matrix dimensions.

Error in rbc_cooley (line 15)
dates(‘initialize’);

evalin(‘base’,fname) ;

rbc_cooley.mod (2.3 KB)

I can run your file in 4.5.1. This seems like a path conflict with a previous version.

thanks Johannes,
the cooley mod run after i exited and restarted.

However, 4.5.1 produced another error that wasn’t there in 4.4.3 (see file attached)

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

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

Index exceeds matrix dimensions.

Error in nk_soe_oil_rbc (line 15)
dates(‘initialize’);

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

Error in W3_2b (line 29)
dynare nk_soe_oil_rbc.mod

W3_2b.m (2.2 KB)

You did not provide all files to run the code. But my guess is that Dynare 4.5’s dates class collides with your variable dates. Please rename that variable to something not already used.

Yes that was it. Thanks a million, you saved my day.
cheers
Werner

I recently installed Matlab 2017b and I would like to point out an issue that exists with this new version of Matlab. Somewhere inside the matlab code running in the background of dynare, there is a function called isfile. In this version of Matlab isfile is a build-in function. Hence, when the code is running it consistently gives the following warning:

Warning: Function isfile has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.

In path (line 109)
In addpath (line 94)
In initialize_dates_toolbox (line 20)
In initialize_dseries_toolbox (line 20)
In dynare_config (line 246)
In dynare (line 63)

This warning gets repeated multiple times and based on my experience (having previously used Matlab 2013a, where this issue was not present) significantly slows down the computation time of the code that is running in dynare.

@sp1589 Which version are you using? This issue should have been fixed in Dynare 4.5.3.

I am using the latest version (4.5.3)

@sp1589 Can you please provide the full log-file of that Dynare run?

@jpfeifer Sure. The log file is attached.

file.log.zip (1.8 KB)

@sp1589 The relevant line 20 of initialize_dates_toolbox.m is addpath([dates_src_root '/utilities/is'])
which adds matlab\modules\dates\src. There is no isfile.m in that directory.

What does
which isfile
return?

@jpfeifer Apologies for the “scare”. The issue was apparently stemming from some kind of an interference with Dynare 4.4.3 since I had forgotten to delete it before I started using 4.5.3.

Dear Jpfeifer.
I’d like to ask you to help me to reproduce the dyntable in this example that is in Dynare examples (Fernandez Villa Verde), I know that the dyntable command was updated, but I can’t make it run. I’m using version 4.5.6 Matlab Release 2018a

% Basic RBC Model 
%
% Jesus Fernandez-Villaverde
% Philadelphia, March 3, 2005

%----------------------------------------------------------------
% 0. Housekeeping (close all graphic windows)
%----------------------------------------------------------------

close all;

%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------

var y c k i l y_l z;
varexo e;

parameters beta psi delta alpha rho;

%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------

alpha   = 0.33;
beta    = 0.99;
delta   = 0.023;
psi     = 1.75;
rho     = 0.95;  
sigma   = (0.007/(1-alpha));

%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------

model; 
  (1/c) = beta*(1/c(+1))*(1+alpha*(k^(alpha-1))*(exp(z(+1))*l(+1))^(1-alpha)-delta);
  psi*c/(1-l) = (1-alpha)*(k(-1)^alpha)*(exp(z)^(1-alpha))*(l^(-alpha));
  c+i = y;
  y = (k(-1)^alpha)*(exp(z)*l)^(1-alpha);
  i = k-(1-delta)*k(-1);
  y_l = y/l;
  z = rho*z(-1)+e;
end;

%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------

initval;
  k = 9;
  c = 0.76;
  l = 0.3;
  z = 0; 
  e = 0;
end;

shocks;
var e = sigma^2;
end;

steady;

stoch_simul(hp_filter = 1600, order = 1);

%----------------------------------------------------------------
% 5. Some Results
%----------------------------------------------------------------

statistic1 = 100*sqrt(diag(oo_.var(1:6,1:6)))./oo_.mean(1:6);
dyntable('Relative standard deviations in %',strvcat('VARIABLE','REL. S.D.'),M_.endo_names(1:6,:),statistic1,10,8,4);

The last line should be

dyntable(options_,'Relative standard deviations in %',strvcat('VARIABLE','REL. S.D.'),M_.endo_names(1:6,:),statistic1,10,8,4);

Dear Jpfeifer,
It worked.
Thank you very much!

Hi, when running file Born_Pfeifer_2018_welfare.mod I am getting the following error:

Brace indexing is not
supported for variables of
this type.
Error in dyntable (line 43)
label_width = max(cellofchararraymaxlength(vertcat(headers{1}, labels))+2, label_width);
Error in Born_Pfeifer_2018_welfare.driver (line 524)
dyntable(options_,table_title,headers,labels,100*values_technology,size(labels,2)+2,4,3)
Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

Can anybody help me with this?
Thank you!

Which Dynare version are you using?