  Home 21090308 Forums Numerical Method Statistics ARMA fitting Reply To: ARMA fitting

#5639

Hello,

I think I got a solution to my previous question. I follow the following reference.
https://www.quantstart.com/articles/Autoregressive-Moving-Average-ARMA-p-q-Models-for-Time-Series-Analysis-Part-3

Choosing the Best ARMA(p,q) Model

In order to determine which order p,q of the ARMA model is appropriate for a series, we need to use the AIC (or BIC) across a subset of values for p,q, and then apply the Ljung-Box test to determine if a good fit has been achieved, for particular values of p,q.

To show this method we are going to firstly simulate a particular ARMA(p,q) process. We will then loop over all pairwise values of p∈{0,1,2,3,4} and q∈{0,1,2,3,4} and calculate the AIC. We will select the model with the lowest AIC and then run a Ljung-Box test on the residuals to determine if we have achieved a good fit.

We will now create an object final to store the best model fit and lowest AIC value. We loop over the various p,q combinations and use the current object to store the fit of an ARMA(i,j) model, for the looping variables i and j.

If the current AIC is less than any previously calculated AIC we set the final AIC to this current value and select that order.