# How do I model a time series in MATLAB using ARMA?

25 views (last 30 days)
Saikath Bhattacharya on 30 Mar 2011
Edited: John Kelly on 19 Nov 2013
I am working on a time series analysis and want a time series data to be modeled using ARMA. How should I proceed in MATLAB?

Rajiv Singh on 12 Apr 2011
For modeling time series see time series modeling functions in System Identification Toolbox such as AR, ARX, ARMAX and NLARX.
Econometrics Toolbox (garchma, vgxvarx etc) and Signal Processing Toolbox (arburg, arcov etc) also offer functions for time series analysis and modeling.
Saikath Bhattacharya on 13 Apr 2011
thnx Rajiv sir,
Sir while working with ARMAx\X in system identification toolbox i got the best suited model of order (5,5).. is it ok...
another doubt is that i want to compare this model with neural network... so how to compare the error plot both in neural network and arma model

Kaustubha Govind on 30 Mar 2011
Is this what you're looking for: timeseries

Rajiv Singh on 13 Apr 2011
Edited: John Kelly on 19 Nov 2013
You should evaluate the quality of prediction results and perform some correlation analysis of the model residuals to verify how good a a model is.
for some information.
Use PE command to compute the prediction errors. This will show you the final prediction error of your estimated model. Interim errors (while estimation is running) is not something you can plot, but you can view a norm of this error for each iteration by turning the display on, as in armax(data, [na nc], 'display', 'on')
If you want to compare a neural network with ARMA model, compute the prediction errors for each and see whose norm is smaller. For neural network model, I believe you can call the SIM command to get the network response and then subtract it from the measured response to compute the error (provided you are using a prediction network).

Gurudatha Pai on 19 Jun 2011
Apart from looking at the prediction errors (like correlation analysis) it is always a good idea to analyze the plant (measured) output with the model output for some validation input. Here, I am assuming that you have included a validation input in your experiment which is different from the data used to obtain the model.
Like most learning systems, it is important not to over-fit your data to the model. In one of the comments, you asked if armax(5,5) is a good model, well, it is for you to decide; looking at the non-parametric methods (spectral estimation based) might give some ideas.

Cristobal Samudio Carter on 18 Oct 2011
Hello All... It is very interesting all your comments in this field of analysis. Perhaps someone could give me some advice around a similar issue.
I am working with an ARMA(6,4) model, and I have succesfully find all the coeficients, incluiding the noise variance (also I have performed correlation analysis). My question is: If I want to generate a matlab code with the mathematical ecuation deduced from the ARMA model, in order to create sets of time series, which steps I have to follow??
I am sure I have considered all the aspects which are described in few books but I have not find the correct form yet, in order to resolve my problem.
Hopping to hear from you.
Cristóbal S. C.
##### 2 CommentsShowHide 1 older comment
Gurudatha Pai on 26 Oct 2011
Do you mean to ask "how would one create new data-sets given an ARMA model"? If that is your question, you can simply do that by filtering white Gaussian Noise with the ARMA parameters are your filter coefficients.
It might be a better idea to ask a new question with more specifics.