Você está na página 1de 22

Using R By Assoc. Prof.

R Boojhawon

TSA By Assoc. Prof. R Boojhawon, UoM

TSA By Assoc. Prof. R Boojhawon, UoM

Building ARIMA Models: Basic Steps


Plotting the data to inspect unusual features like outliers, stationary, seasonal and if variance is stable. Transforming the data e.g use of log, sqrt, or Box-Cox power transformation x 1
t yt if 0 ln xt if 0

Identifying the orders (p,d,q) through use of ACF/PACF of differenced plots. But be careful unnecessary differencing may introduce correlation Numerical estimation of model parameters (& CIs) by using Yule-Walker equations or method of MLE or method of LSE. Residual Diagnostics: Graphs of Residual ACF/PACF, QQ, histograms, Ljung-Box-Pierce Q statistics to indicate white noise else we need to resimulate using other parameters. Do predictions
TSA By Assoc. Prof. R Boojhawon, UoM 3

Goal
To emphasize plotting methods that are appropriate and useful for finding patterns that will lead to suitable models for our time series data.

TSA By Assoc. Prof. R Boojhawon, UoM

A Model-Building Strategy
We will develop a multistep model-building strategy

espoused so well by Box and Jenkins (1976). There are three main steps in the process, each of which may be used several times:
model specification (or identification) model fitting, and model diagnostics

We shall attempt to adhere to the principle of

parsimony

TSA By Assoc. Prof. R Boojhawon, UoM

The quarterly earnings per share for 19601980 of the U.S. company Johnson & Johnson, are saved in the file named JJ. Plot the time series and also the logarithm of the series. Argue that we should transform by logs to model this series. The series is clearly not stationary. Take first differences and plot that series. Does stationarity now seem reasonable? Calculate and graph the sample ACF of the first differences. Interpret the results. Display the plot of seasonal differences and the first differences. Interpret the plot. Recall that for quarterly data, a season is of length 4. Graph and interpret the sample ACF of seasonal differences with the first differences.
Fit the model ARIMA(0,1,1)(0,1,1)4, and assess the significance of the estimated

Case Problem 1

coefficients. Perform all of the diagnostic tests on the residuals. Calculate and plot forecasts for the next two years of the series. Be sure to include forecast limits.
TSA By Assoc. Prof. R Boojhawon, UoM 6

Step 1: Time Series Plot of Data/log of Data

TSA By Assoc. Prof. R Boojhawon, UoM

Step 2: The series is clearly not stationary. Take first differences of the log data and plot that series. Does stationarity now seem reasonable?

We do not expect stationary series to have less variability in the middle of the series as this one does but we might entertain a stationary model and see where it leads us.
TSA By Assoc. Prof. R Boojhawon, UoM 8

Step 3: Calculate and graph the sample ACF of the first differences of ln(data). Interpret the results.

Strongest autocorrelations are at the seasonal lags of 4, 8, 12, and 16. Clearly, we need to address the seasonality in this series. Also graph suggests MA effect as well.
TSA By Assoc. Prof. R Boojhawon, UoM 9

PACF of the ln(data) suggesting AR effects as well

TSA By Assoc. Prof. R Boojhawon, UoM

10

Step 4: Display the plot of seasonal differences and the first differences. Interpret the plot. Recall that for quarterly data, a season is of length 4.

The various quarters seem to be quite randomly distributed among high, middle, and low values (e.g we see 4 up, mid,down), so that most of the seasonality is accounted for in the seasonal difference.
TSA By Assoc. Prof. R Boojhawon, UoM

11

Step 5: Graph and interpret the sample ACF of seasonal differences with the first differences.

They only significant autocorrelations are at lags 1 and 7. Lag 4 (the quarterly lag) is nearly significant. (2 out of 20 = 0.1 can be considered as non-significant here)
TSA By Assoc. Prof. R Boojhawon, UoM 12

Step 6: Fit the model ARIMA(0,1,1)(0,1,1)4, and assess the significance of the estimated coefficients.

Both the seasonal and nonseasonal ma parameters are significant in this model since due to small p-values.
TSA By Assoc. Prof. R Boojhawon, UoM 13

Step 7: Perform all of the diagnostic tests on the residuals.

No inadequacies with the model. There is little autocorrelation in the residuals/Independence due to p-values from LjungBox being large (large p-values) and hence cannot reject Ho: error is IID
TSA By Assoc. Prof. R Boojhawon, UoM 14

Predicted and Residual values saved

TSA By Assoc. Prof. R Boojhawon, UoM

15

Histogram

TSA By Assoc. Prof. R Boojhawon, UoM

16

Normal QQ plot

TSA By Assoc. Prof. R Boojhawon, UoM

17

Normally Test

TSA By Assoc. Prof. R Boojhawon, UoM

18

Step 8: Calculate and plot forecasts for the next two years of the series. Be sure to include forecast limits.

Forecasts follow the general pattern of seasonality and trend Forecast limits give a good indication of the confidence in these forecasts.
TSA By Assoc. Prof. R Boojhawon, UoM 19

Returning back to the forecast of data in original terms

TSA By Assoc. Prof. R Boojhawon, UoM

20

Predicted and Residual values saved

TSA By Assoc. Prof. R Boojhawon, UoM

21

Conclusion
We may extend our models using higher parameters

but it is good practice to use the simplest one (least parameters: Principle of Parsimony) which satisfies the model assumptions.

TSA By Assoc. Prof. R Boojhawon, UoM

22

Você também pode gostar