MATLAB Answers


How to determine the order of ARMA and AR coefficient ?

Asked by Husni
on 19 Nov 2012

Perhaps this is very simple question. I have been trying to find it. How can we determine the order of ARMA and AR coefficient in Matlab? What I mean here is not merely trial and error.

Any suggestion is appreciated

Sincerely yours



2 Answers

Answer by Rajiv Singh
on 20 Nov 2012
 Accepted answer

One way would be to state-space estimation which lets you inspect the Hankel singular values for model order:

% pick optimal order in the 1:10 range: model = n4sid(data, 1:10);

For more information, see:


on 21 Nov 2012

Thank you for your response

How if the model i chose is ARMA with Yule-Walker?


Once you the order, you can proceed with your favorite estimation routine carrying over the knowledge of the order to configure the structure. Also, you can convert an estimated state space model (using n4sid above) into the more conventional polynomial form of ARMA model using the IDPOLY command:

 m = n4sid(data, 1:10);
 m2 = idpoly(m)

Answer by Gurudatha Pai
on 12 Dec 2012

Model order selection is often a tricky business. Inspecting the Hankel singular values is one many methods. There are many such methods, arguably one as good or worse as the other.

Specifically in the case AR/ARMA models, you may look into the model residues. Specifically, if you have used a "sufficient" model orders, the residuals should look white. Note that the residuals may look white for many model order selections. There are statistical hypothesis testing procedures (e.g. Chi-2 test, etc.) for both sample auto-correlation of residuals and cross-correlation of residuals and input; Ljung's book has a lot of details on all of this.

Hope that helps.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!