'how to decide p of ACF and q of PACF in AR, MA, ARMA and ARIMA?

I am confused about how to calculate p of ACF and q of PACF in AR, MA, ARMA and ARIMA. For example, in R, we use acf or pacf to get the best p and q.

However, based on the information I have read, p is the order of AR and q is the order of MA. Let's say p=2, then AR(2) is supposed to be y_t=a*y_t-1+b*y_t-2+c. We can calculate acf function (in R) when lag=1,2,3.... to find which lag brings the biggest acf function value. The same thing happens to MA for deciding q. But, does this mean that p and q have already been set up?

I guess here is the steps. But I am not sure if I am right. So, let's say in R's functions acf and pacf, is this the real process: 1. For p=1, set lag=1,2,3,...max to see which lag has the biggest autocorrelation value. 2. For p=2,3,4..., do the same thing to find the lags. 3. Compare those values with each other. Let's say the biggest autocorrelation value comes when p=2 and lag=4, when we say the order of AR, ie. p, is 2?

Cloud anyone please give me an example showing exactly how to estimate p and q?



Solution 1:[1]

This isn't a good stackoverflow question. You want to be on the Math site for this. To answer your question, though, there isn't one single generally accepted method for finding the optimal p and q.

Generally, what most people tend to do, is eyeball it using pacf visualizations (in which case, as you observe, you can't distinguish whether to put time into p or q) and set p == q.

An alternative way to do it, would be to try estimating your time series with different values of p and q, in a grid search, and pick the combination that maximizes some estimator like log likelihood or out-of-sample error, or whatever makes sense on your dataset.

If I might suggest, however, you probably want to start by looking at the rather extensive body of research on arima models and see how others have done this - that really should be your first step for questions like this.

Solution 2:[2]

PACF plot for most optimal in the AR(p) model, ACF plot for most optimal in the MA(q) model

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bob
Solution 2 Ramakrishna T