Anda di halaman 1dari 8

Statistics 4861: Assignment 4/5

Scott Denotter ID: 250535369

The task in this assignment is to fit an appropriate seasonal ARIMA model to a time series of some economic indicator and then forecast the model two years in the future. The economic indicator which I chose was household consumption expenditure( Table 3800085 on CANSIM) from 1981 to the present(quarterly data). The following is the time series plot for this data

This TS clearly has an upward trend and is thus not stationary, in addition it exhibits clearly seasonal behaviour and increasing variance. We continue the analysis by examining the differenced series.

The following chart figure shows the differenced time series and reinforces the fact that the data seasonal with non-constant variance

The next two graphs show the log differences and the square root differences respectively

Both data transformations help to stabilize the variance, however the log transformation appears to be slightly more effective since the sqrt transform still exhibits some increasing variation.

Next we look at the ACF and the PACF of our log differenced time series in order to try and determine the coefficients for our ARIMA model. Here we have lag = 4 since the data is quarterly.

From the ACF, PACF we expect a seasonal AR(2) term from the PACF lags at 4,8 and 12. In addition the spikes in the PACF also suggest an AR(2) or AR(3) factor in the standard ARIMA. Thus our initial estimate for our model is ARIMA(2,0,0)x(2,1,0). From the first model our R command gives

The model is somewhat accurate with a small value at lag 2 for the Ljung-Box statistic. In addition this model produced an AIC of -831.28. Testing with the model ARIMA(3,0,0)x(2,1,0) shows that it is a slightly better fit for our data.

Output for ARIMA fit with (3,0,0)x(2,1,0):

Now that we have a suitable model it remains to calculate a two year prediction interval using our model.

For the prediction interval I used the forecast function form the forecast R package which allows the easy prediction Arima models. The following is the two year 50% prediction interval.

All R code is included at end.

R Code:

# Assignment 4/5 SS 4861 # Set WD require(timeSeries) require(forecast)

z <- ts(scan("Consumption.dat",sep=","), start=c(1981,1), freq=4) plot(z, main="Canadian Household Consumption by Quarter")

w <- diff((z)) plot(w, main="Canada Differenced Consumption") w <- diff(log(z)) plot(w, main="Canada Log Difference Consumption") w <- diff(sqrt(z)) plot(w, main="Canada Square Root Difference Consumption")

w <- log(z) w <- diff((z), lag=4, differences=1) acf(w, main="log, d=1, s=4") acf(w, main="log, d=1, s=4", type="partial") tsdisplay(diff(diff(w,4)), lag.max = 15) out1 <- arima(log(z), order=c(3,0,0), seasonal=list(order=c(2,1,0),period=4)) out1 tsdiag(out1) pred <- Arima(log(z), order=c(3,0,0), seasonal=c(2,1,0), lambda=0) plot(forecast(pred,h = 8, level = c(50,99)), ylab="Consumption", xlab="Year",xlim = c(2010,2016))

Anda mungkin juga menyukai