error massage index exceeds

Hi,
I am running my codes and getting the following error massage:
Index exceeds matrix dimensions. Error in main (line 73) W=[y1lag(lagno(i)+2:T,:) dylag(lagno(i)+2:T,:)];
why am I getting it and how to deal with it please? I have attached the matlab m file. I am really need a help asap since I am running out of time for submission.
Regards Sarah

5 Comments

Cannot check unless short.xlxs file is given..
Dear KSSV;
here I attached it, However, I changed to CSV as I am not allowed to sent you XLSX file here.
thanks
here are ols file :
function [beta,error,tvalue]=OLS(y,x) [~,k]=size(x); beta=(x'*x)\(x'*y); A=inv(x'*x); error=y-x*beta; sigma2=(error'*error)/(length(y)-k);
for i=1:k tvalue(i)=beta(i)/sqrt(sigma2*A(i,i)); end
and ic file as it does not allow me to attache them:
function [aic,sbc]=IC(y,error,pmax,p) T=length(y); T=T-pmax;
llhood=-T/2*(1+log(2*pi)+log(error'*error/T)); sbc=(-2*llhood/T)+((p+1)*log(T)/T); aic=(-2*llhood/T)+2*((p+1)/T);
dylag=lagmatrix(dy(:,i),(1:lagno(i))); % line 72
your dylag is an empty matrix. Because 1:lagno(i) is zero. lagno is zero, so there is no possibility of picking columns from lagmatrix.

Sign in to comment.

Answers (0)

Asked:

on 7 Dec 2016

Commented:

on 7 Dec 2016

Community Treasure Hunt

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

Start Hunting!