The purpose of this learning log will be to apply the arima model that I created in LL23 and recommend solutions/advice to the appropriate parties.
library(forecast)
## Warning: package 'forecast' was built under R version 3.3.3
library(quantmod)
## Warning: package 'quantmod' was built under R version 3.3.3
## Warning: package 'xts' was built under R version 3.3.3
## Warning: package 'zoo' was built under R version 3.3.3
## Warning: package 'TTR' was built under R version 3.3.3
library(tseries)
## Warning: package 'tseries' was built under R version 3.3.3
library(timeSeries)
## Warning: package 'timeSeries' was built under R version 3.3.3
## Warning: package 'timeDate' was built under R version 3.3.3
library(forecast)
library(xts)
Recall that the gas data set is a time series of monthly gas production in Australia from 1956 to 1995. The data in its orginal shape looks like the following:
plot.ts(gas)
Starting around 1970, gas production started to increase and by 1980 had become extremely variable month to month. The hope of our model is help Australia forecast and understand how gas production will continue to change in the years following 1995.
If we decompose the time series into its component parts (trend, seasonality, random variation, and observation) we can see that gas production is trending upward with clear semiannual seasonality. We used this insight when constructing our seasonal arima model.
gastimeseries <-ts(gas, frequency=12, start=c(1956,1))
TScomp <- decompose(gastimeseries)
plot(TScomp)
The model I recreated took the following ARIMA form:\(ARIMA(0,1,0)x(2,0,2)[6].\) This model had first order nonseasonal differences, second order seasonal autoregressive terms, and second order seasonal moving average terms with a lag component of six months.
gasT <- log(gas)
ModARIMA2 <-arima(gasT, order = c(0,1,0), season=list(order = c(2,0,2), period=6))
plot(forecast(ModARIMA2, h = 12), xlab="Time", ylab="Log Monthly Gas Production", main = "Australian Monthly Gas Production")
The plot above shows the forecasted monthly gas production with the blue line with 80 percent and 95 percent confidence intervals in dark gray and light gray respectively. My forecast shows a similar pattern developing in the next 12 months as gas production declines in the 5 months and then resumes previous high year end values at the end of 2016.