Page 1 of 1

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

PostPosted: Wed Sep 03, 2014 9:19 am
by xiang8482890
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!

Re: ??? Attempted to access info(2); index out of bounds bec

PostPosted: Wed Sep 03, 2014 9:39 am
by 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
Code: Select all
    cost_flag = 0;

and not what your error message says.

Re: ??? Attempted to access info(2); index out of bounds bec

PostPosted: Wed Sep 03, 2014 3:12 pm
by xiang8482890
jpfeifer wrote: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
Code: Select all
    cost_flag = 0;

and not what your error message says.


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!

Re: ??? Attempted to access info(2); index out of bounds bec

PostPosted: Wed Sep 03, 2014 3:35 pm
by jpfeifer
Before the line where the crash appears in DsgeLikelihood.m, please add
Code: Select all
   
if length(info)==1
        disp(info);
 end

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

Re: ??? Attempted to access info(2); index out of bounds bec

PostPosted: Thu Sep 04, 2014 2:07 am
by xiang8482890
jpfeifer wrote:Before the line where the crash appears in DsgeLikelihood.m, please add
Code: Select all
   
if length(info)==1
        disp(info);
 end

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


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)

Re: ??? Attempted to access info(2); index out of bounds bec

PostPosted: Thu Sep 04, 2014 4:58 am
by jpfeifer
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.