Why I am getting error for performing AIC test for model orders varying in 0:3 range?

1 view (last 30 days)
For ARIMA(p,d,q) if AIC test is applied for p,q = 0:3 keeping d = 0 and 1, it shows error. I want to confirm for possibilities when p and/or q = 0 also. What can be done to achieve so? This is my code.
LOGL = zeros(4,4);
PQ = zeros(4,4);
for p = 0:3
for q = 0:3
mod = arima(p,1,q);
[fit,~,logL] = estimate(mod,z,'print',false);
LOGL(p,q) = logL;
PQ(p,q) = p+q;
end
end
LOGL = reshape(LOGL,16,1);
PQ = reshape(PQ,16,1);
[aic,bic] = aicbic(LOGL,PQ+1,100);
mAIC=reshape(aic,4,4)
mBIC=reshape(bic,4,4)
the error is due to log function. Is there any way to achieve what I want?

Accepted Answer

Brendan Hamm
Brendan Hamm on 7 Oct 2016
MATLAB indexing starts at 1, so when wither p or q is equal to 0 your indexing,
LOGL(p,q) = logL;
PQ(p,q) = p+q;
will fail. Change this to:
LOGL(p+1,q+1) = logL;
PQ(p+1,q+1) = p+q;
  2 Comments
Hamed Majidiyan
Hamed Majidiyan on 7 Mar 2022
Hi Brendan,
I ran the code and I got the following results, even though I don't know how to intrepret the outcomes, so any help would be highly appreciated
mAIC =
1.0e+04 *
-1.4059 -1.6748 -1.9129 -2.0337
-3.2659 -3.0362 -3.0430 -3.0458
-1.4044 -3.0381 -3.0379 -3.0377
-1.4042 -3.0379 -2.7176 -2.7174
mBIC =
1.0e+04 *
-1.4057 -1.6743 -1.9121 -2.0326
-3.2654 -3.0354 -3.0419 -3.0445
-1.4036 -3.0370 -3.0366 -3.0361
-1.4032 -3.0366 -2.7160 -2.7155

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!