ARIMA and Seasonal ARIMA Models
This tutorial delves a bit deeper into statistical models. Study it to better understand the ARIMA and seasonal ARIMA models. Consider closely the discussion of how to apply the ACF and PACF to estimate the order parameters for a given model. In practical circumstances, this is an important question as it is often the case that such parameters would initially be unknown.
Seasonal ARIMA models
Seasonality in a time series is a regular pattern of changes that repeats over S time periods, where S defines the number of time periods until the pattern repeats again.
For example, there is seasonality in monthly data for which high values tend always to occur in some particular months, and low values tend always to occur in other particular months. In this case, S = 12 (months per year) is the span of the periodic seasonal behavior. For quarterly data, S = 4 time periods per year.
In a seasonal ARIMA model, seasonal AR and MA terms predict using data values and errors at times with lags that are multiples of S (the span of the seasonality).
 With monthly data (and S = 12), a seasonal firstorder autoregressive model would use to predict . For instance, if we were selling cooling fans, we might predict this August's sales using last August's sales. (This relationship of predicting using last year's data would hold for any month of the year.)
 A seasonal secondorder autoregressive model would use and to predict . Here we would predict this August's values from the past two Augusts.
 A seasonal first order MA(1) model (with S = 12) would use as a predictor. A seasonal second order MA(2) model would use and
Differencing
Almost by definition, it may be necessary to examine differenced data when we have seasonality. Seasonality usually causes the series to be nonstationary because the average values at some particular times within the seasonal span (months, for example) may be different than the average values at other times. For instance, our sales of cooling fans will always be higher in the summer months.
Seasonal differencing

Seasonal differencing is defined as a difference between a value and a value with lag that is a multiple of S.
The differences (from the previous year) may be about the same for each month of the year, giving us a stationary series.
Seasonal differencing removes seasonal trends and can also get rid of a seasonal random walk type of nonstationarity.
Nonseasonal differencing

If a trend is present in the data, we may also need nonseasonal differencing. Often (not always), a first difference (nonseasonal) will "detrend" the data. That is, we use in the presence of trend.
Differencing for Trend and Seasonality

When both trend and seasonality are present, we may need to apply both a nonseasonal first difference and a seasonal difference.
That is, we may need to examine the ACF and PACF of .
Removing a trend doesn't mean that we have removed the dependency. We may have removed the mean, , part of which may include a periodic component. In some ways, we are breaking the dependency down into recent things that have happened and longrange things that have happened.
Nonseasonal behavior will still matter...
With seasonal data, it is likely that shortrun nonseasonal components will still contribute to the model. In the monthly sales of cooling fans mentioned above, for instance, sales in the previous month or two, along with the sales from the same month a year ago, may help predict this month's sales.
We'll have to look at the ACF and PACF behavior over the first few lags (less than S) to assess what nonseasonal terms might work in the model.
Seasonal ARIMA Model
The seasonal ARIMA model incorporates both nonseasonal and seasonal factors in a multiplicative model. One shorthand notation for the model is
with p = nonseasonal AR order, d = nonseasonal differencing, q = nonseasonal MA order, P = seasonal AR order, D = seasonal differencing, Q = seasonal MA order, and S = time span of repeating seasonal pattern.
Without differencing operations, the model could be written more formally as
On the left side of equation (1), the seasonal and nonseasonal AR components multiply each other, and on the right side of equation (1), the seasonal and nonseasonal MA components multiply each other.
Example 41: ARIMA
The model includes a nonseasonal MA(1) term, a seasonal MA(1) term, no differencing, no AR terms, and the seasonal period is S = 12.
The nonseasonal MA(1) polynomial is .
The seasonal MA(1) polynomial is .
When we multiply the two polynomials on the right side, we get
Thus the model has MA terms at lags 1, 12, and 13. This leads many to think that the identifying ACF for the model will have nonzero autocorrelations only at lags 1, 12, and 13. There's a slight surprise here. There will also be a nonzero autocorrelation at lag 11. We supply a proof in the Appendix.
We simulated n = 1000 values from an ARIMA . The nonseasonal MA (1) coefficient was . The seasonal MA(1) coefficient was . The sample ACF for the simulated series was as follows:
The spikes at lags 1, 11, and 12 in the ACF. This is characteristic of the ACF for the ARIMA . Because this model has nonseasonal and seasonal MA terms, the PACF tapers nonseasonally, following lag 1, and tapers seasonally, that is near S=12, and again near lag 2*S=24.
Example 42: ARIMA
The model includes a nonseasonal AR(1) term, a seasonal AR(1) term, no differencing, no MA terms, and the seasonal period is S = 12.
The nonseasonal AR(1) polynomial is .
The seasonal AR(1) polynomial is .
If we let (for simplicity), multiply the two AR components and push all but z_{t} to the right side we get .
This is an AR model with predictors at lags 1, 12, and 13.
R can be used to determine and plot the PACF for this model, with =.6 and =.5. That PACF (partial autocorrelation function) is:
It's not quite what you might expect for an AR model, but it almost is. There are distinct spikes at lags 1, 12, and 13, with a bit of action coming before lag 12. Then, it cuts off after lag 13.
R commands were
thepacf=ARMAacf (ar = c(.6,0,0,0,0,0,0,0,0,0,0,.5,.30),lag.max=30,pacf=T)
Identifying a Seasonal Model
 Step 1: Do a time series plot of the data.
Examine it for features such as trend and seasonality. You'll know that you've gathered seasonal data (months, quarters, etc.,) so look at the pattern across those time units (months, etc.) to see if there is indeed a seasonal pattern.
 Step 2: Do any necessary differencing.
 If there is seasonality and no trend, then take a difference of lag S. For instance, take a 12th difference for monthly data with seasonality. Seasonality will appear in the ACF by tapering slowly at multiples of S. (View the TS plot and ACF/PACF plots for an example of data that requires a seasonal difference. Note that the TS plot shows a clear seasonal pattern that repeats over 12 time points. Seasonal differences are supported in the ACF/PACF of the original data because the first seasonal lag in the ACF is close to 1 and decays slowly over multiples of S=12. Once seasonal differences are taken, the ACF/PACF plots of twelfth differences support a seasonal AR(1) pattern).
 If there is a linear trend and no obvious seasonality, then take a first difference. If there is a curved trend, consider a transformation of the data before differencing.
 If there is both trend and seasonality, apply a
seasonal difference to the data and then reevaluate the trend. If a
trend remains, then take first differences. For instance, if the series
is called x, the commands in R would be:
diff12=diff(x, 12)plot(diff12)acf2(diff12)diff1and12 = diff(diff12, 1)  If there is neither an obvious trend nor seasonality, don't take any differences.
 Step 3: Examine the ACF and PACF of the differenced data (if differencing is necessary).
We're using this information to determine possible models. This can be tricky going involving some (educated) guessing. Some basic guidance:

Nonseasonal terms: Examine the early lags (1, 2, 3, …) to judge nonseasonal terms. Spikes in the ACF (at low lags) with a tapering PACF indicate nonseasonal MA terms. Spikes in the PACF (at low lags) with a tapering ACF indicate possible nonseasonal AR terms.

Seasonal terms: Examine the patterns across lags that are multiples of S. For example, for monthly data, look at lags 12, 24, 36, and so on (probably won't need to look at much more than the first two or three seasonal multiples). Judge the ACF and PACF at the seasonal lags in the same way you do for the earlier lags.

 Step 4: Estimate the model(s) that might be reasonable on the basis of step 3.
Don't forget to include any differencing that you did before looking at the ACF and PACF. In the software, specify the original series as the data and then indicate the desired differencing when specifying parameters in the arima command that you're using.
 Step 5: Examine the residuals (with ACF, BoxPierce, and any other means) to see if the model seems good.
Compare AIC or BIC values to choose among several models.
If things don't look good here, it's back to Step 3 (or maybe even Step 2).
Example 43
The data series are a monthly series of a measure of the flow of the Colorado River, at a particular site, for n = 600 consecutive months.
Step 1
A time series plot is
With so many data points, it's difficult to judge whether there is seasonality. If it was your job to work on data like this, you probably would know that river flow is seasonal – perhaps likely to be higher in the late spring and early summer, due to snow runoff.
Without this knowledge, we might determine means by month of the year. Below is a plot of means for the 12 months of the year. It's clear that there are monthly differences (seasonality).
Looking back at the time series plot, it's hard to judge whether there's any longrun trend. If there is, it's slight.
Steps 2 and 3
We might try the idea that there is seasonality but no trend. To do this, we can create a variable that gives the 12^{th} differences (seasonal differences), calculated as . Then, we look at the ACF and the PACF for the 12^{th} difference series (not the original data). Here they are:
 Nonseasonal behavior: The PACF shows a clear spike at lag 1 and not much else until about lag 11. This is accompanied by a tapering pattern in the early lags of the ACF. A nonseasonal AR(1) may be a useful part of the model.
 Seasonal behavior: We look at what's going on around lags 12, 24, and so on. In the ACF, there's a cluster of (negative) spikes around lag 12 and then not much else. The PACF tapers in multiples of S; that is, the PACF has significant lags at 12, 24, 36, and so on. This is similar to what we saw for a seasonal MA(1) component in Example 1 of this lesson.
Remembering that we're looking at 12^{th} differences, the model we might try for the original series is ARIMA .
Step 4
Final Estimates of Parameters
Type  Coef  SE Coef  T  P 

AR 1  0.5149  0.0353  14.60  0.000 
SMA 12  0.8828  0.0237  37.25  0.000 
Constant  0.0011  0.0007  1.63  0.103 
sigma^2 estimated as 0.4681: log likelihood = 620.38, aic = 1248.76
$degrees_of_freedom
[1] 585
Step 5 (diagnostics)
The normality and BoxPierce test results are shown in Lesson 4.2. Besides normality, things look good. The BoxPierce statistics are all nonsignificant, and the estimated ARIMA coefficients are statistically significant.
The ACF of the residuals looks good too:
What doesn't look perfect is a plot of residuals versus fits. There's nonconstant variance.
We've got three choices for what to do about the nonconstant variance: (1) ignore it, (2) go back to step 1 and try a variance stabilizing transformation like log or square root, or (3) use an ARCH model that includes a component for changing variances. We'll get to ARCH models later in the course.
Lesson 4.2 for this week will give R guidance and an additional example or two.
Appendix (Optional reading)
Only those interested in theory need to look at the following.
In Example 41, we promised a proof that ≠ 0 for ARIMA .
A correlation is defined as Covariance/ product of standard deviations.
For the model in Example 1,
The w's are independent errors. The expected value of any product involving w's with different subscripts will be 0. A covariance between w's with the same subscripts will be the variance of w.
If you inspect all possible products in expression 2, there will be one product with matching subscripts. They have lag t – 12. Thus this expected value (covariance) will be different from 0.
This shows that the lag 11 autocorrelation will be different from 0. If you look at the more general problem, you can find that only lags 1, 11, 12, and 13 have nonzero autocorrelations for the ARIMA.
A seasonal ARIMA model incorporates both nonseasonal and seasonal factors in a multiplicative fashion.