? Attempted to access info(2); index out of bounds because

Dear all,

I was trying out one paper “Toward a Taylor Rule for Fiscal Policy”, I downloaded the data and code to repeat the exercise using the same version of dynare as reminded by the authors.

However, when I was doing the estimation part, things went smoothly at first, but then errors appeared as:

??? Attempted to access info(2); index out of bounds because numel(info)=1.

Error in ==> DsgeLikelihood at 135
fval = bayestopt_.penalty+info(2);

Error in ==> csminit at 126
f = feval(fcn,dxtest,varargin{:});

Error in ==> csminwel1 at 101
[f1 x1 fc retcode1] = csminit(fcn,x,f,g,badg,H,varargin{:});

Error in ==> dynare_estimation_1 at 204
[fval,xparam1,grad,hessian_csminwel,itct,fcount,retcodehat] = …

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> model_baseline at 485
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin(‘base’,fname) ;

please check the attchment for the data and code. What’s the problem? Thanks!
obsdata_first_diff2.m (2.18 KB)
model_baseline.mod (7.5 KB)
generate_tables_figures_est.m (17.3 KB)
data_september2012.m (44 KB)

The mode-file is missing. Also, you did not specify which Dynare version you were actually using. In Dynare 4.2.4, the version used by the authors, line 135 of DsgeLikelihood is

cost_flag = 0;
and not what your error message says.

[quote=“jpfeifer”]The mode-file is missing. Also, you did not specify which Dynare version you were actually using. In Dynare 4.2.4, the version used by the authors, line 135 of DsgeLikelihood is

cost_flag = 0;
and not what your error message says.[/quote]

Sorry that I missed two files, now I package all the files in rar document. I did use Dynare 4.2.4 and I checked that line 135 of DsgeLikelihood is cost_flag = 0, but the errors just occured that way. What can I do to possibly fix it?

Thanks so much for your patience!
estimation.rar (1.49 MB)

Before the line where the crash appears in DsgeLikelihood.m, please add

if length(info)==1
        disp(info);
 end

and report the result. It should give you an error code.

[quote=“jpfeifer”]Before the line where the crash appears in DsgeLikelihood.m, please add

if length(info)==1
        disp(info);
 end

and report the result. It should give you an error code.[/quote]

before I added the three-line code, the errors were:

??? Attempted to access info(2); index out of bounds because numel(info)=1.

Error in ==> DsgeLikelihood at 135
fval = bayestopt_.penalty+info(2);

Error in ==> csminit at 126
f = feval(fcn,dxtest,varargin{:});

Error in ==> csminwel1 at 101
[f1 x1 fc retcode1] = csminit(fcn,x,f,g,badg,H,varargin{:});

Error in ==> dynare_estimation_1 at 204
[fval,xparam1,grad,hessian_csminwel,itct,fcount,retcodehat] = …

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> model_baseline at 485
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin(‘base’,fname) ;

When I added the three-line code starting right after line 134, the errors turn to be:

??? Attempted to access info(2); index out of bounds because numel(info)=1.

Error in ==> DsgeLikelihood at 138
fval = bayestopt_.penalty+info(2);

Error in ==> csminit at 126
f = feval(fcn,dxtest,varargin{:});

Error in ==> csminwel1 at 101
[f1 x1 fc retcode1] = csminit(fcn,x,f,g,badg,H,varargin{:});

Error in ==> dynare_estimation_1 at 204
[fval,xparam1,grad,hessian_csminwel,itct,fcount,retcodehat] = …

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> model_baseline at 485
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin(‘base’,fname) ;

There is nothing new except that the number 135 is now 138.

T-T (crying)

It should still crash with the same, but before the crash it should provide a number, an error code. You only posted the crash, but not the error code.