Index in position 1 exceeds array bounds

조회 수: 2 (최근 30일)
Jerry M.
Jerry M. 2021년 4월 1일
댓글: darova 2021년 4월 3일
Hello, I am trying to estimate confidence intervals, but I keep getting the following error when I try to run the structural_console.m file (attached is the relevant part of the code):
Index in position 1 exceeds array bounds (must not exceed 5).
Error in VECM_bootstrap (line 22)
resb=resids(bidx(bb,:),:);
Error in Structural_console (line 28)
[Sigmas,PHIs,mis,Xs]=VECM_bootstrap(GAMMA,eps_hat,X,n_boot);
I can't find out what I specified wrong - so I would really appreciate if someone could help me figure this out. Thank you
  댓글 수: 2
Michael Van de Graaff
Michael Van de Graaff 2021년 4월 1일
편집: Michael Van de Graaff 2021년 4월 1일
So first of all I had to change dif to diff in VECM. not sure if that's important.
Also, you aren't passing beta_ml to VECM_bootstrap.
Jerry M.
Jerry M. 2021년 4월 2일
Thank you very much! I just realized I forgot to upload dif.m file; I will add beta_ml and see if it works now

댓글을 달려면 로그인하십시오.

답변 (1개)

Christopher McCausland
Christopher McCausland 2021년 4월 2일
In your code in line 22 you have resb=resids(bidx(bb,:),:); where as with any index resb=resids(A,B). MATLAB is trying to tell you that the array only has five rows but you are trying to call a non-exsistant row greater than or equal to 6. Try using a breakpoint to assess the value of bidx(bb,:) that makes this happen.
In short if I have array; myarray = zeros(5,4)
myarray =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
you try and call myarray(6,1);
Index in position 1 exceeds array bounds (must not exceed 5)
as you are trying to call 'X' which doesn't exsist
myarray =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
X - - - <- Row 6 does not exsist
  댓글 수: 2
Jerry M.
Jerry M. 2021년 4월 3일
Thank you very much!
darova
darova 2021년 4월 3일

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Big Data Processing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by