Clear Filters
Clear Filters

EGCITEST: Error using lagmatrix (line 25) lagmatrix: wrong # of input arguments. Please, can someone help? thx

2 views (last 30 days)
Hello,
I am trying to use built-in fx to check cointegration but when I use adftest and egcitest (I have the econometric package installed) I get the following msg:
EDU>> doc egictest
EDU>> load Data_Canada
Y = Data(:,3:end);
names = series(3:end);
plot(dates,Y)
legend(names,'location','NW')
grid on
EDU>> [h,pValue,stat,cValue,reg] = egcitest(Y,'test',...
{'t1','t2'});
Error using lagmatrix (line 25)
lagmatrix: wrong # of input arguments
Error in adftest>runReg (line 686)
yLags = lagmatrix(y,0:(testLags+1));
Error in adftest (line 414)
testReg = runReg(i,y,testT,testLags,testModel,needRegOut);
Error in egcitest/runRReg (line 1043)
[~,~,testStat] = adftest(res,'lags',testLags,'test',testType);
Error in egcitest (line 397)
testStat = runRReg;
Please, anyone can help?
thx a lot

Answers (2)

steve
steve on 22 Jan 2014
I believe there is a conflict between the matlab standard function "lagmatrix" and the "lagmatrix that comes with the spatial econometrics package. I had the same problem - it does away if you delete the spatial econometrics package from the path file. Although this is not an ideal solution...

Ali Komai
Ali Komai on 2 Apr 2019
I had a strange variation of this error and thought I post it. Steve is correct that the error is caused by a conflicting file of the spatial econometrics toolbox and taking the later from the matlab-path solves the problem but (here comes the funny part) the error reoccurs when egcitest is used in a parfor-loop!
Although I do not understand how this is possible. Even if the file of the spatial econometrics toolbox is NOT on the matlab path, it will be chosen in a parfor-loop over the file with the same name in the econometrics toolbox. I solved the issue now by renaming the file from the spatial econometrics toolbox.

Categories

Find more on Argument Definitions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!