Read HA #8

HW 8.1, 8.2,8.6, 8.8

#8.8 Consider austa, the total international visitors to Australia (in millions) for the period 1980-2015.

library(fpp2) 
data(austa)
length(austa)

a. Use auto.arima() to find an appropriate ARIMA model. What model was selected. Check that the residuals look like white noise. Plot forecasts for the next 10 periods.

autoplot(austa)

Since there is not a seasonal time series, we can set seasonal = FALSE.

ARIMA(0,1,1) is given by auto funciton. It is a random walk and a moving average sequence combination. The model is y(t) = 0.1735 + 0.3006 y(t-1)

fita<-auto.arima(austa,seasonal = FALSE)
fita
tsdisplay(residuals(fita), lag.max = 45, main = "(ARIMA(0,1,1) model residuals" )
fita %>% forecast(h=10) %>% autoplot(include=80)

b. Plot forecasts from an ARIMA(0,1,1) model with no drift and compare these to part a. Remove the MA term and plot again.

After removed the drift, the Forecasts shifted down 0.1735.

#remvoe the drift 
austa_b<-austa-0.1735
fitb<-auto.arima(austa_b,seasonal = FALSE)
fitb %>% forecast(h=10) %>% autoplot(include=80)

c. Plot forecasts from an ARIMA(2,1,3) model with drift. Remove the constant and see what happens.

ARIMA(2,1,3) is a autoregression, a random walk, a 3-moving average sequences combination. The model is

y(t) = c + 0.0004 * y(t-1) + 0.9996 * y(t-2) + 0.4633 e(t-1) - 0.9893 * e(t-2) - 0.4625 * e(t-3)

fitc<-arima(austa,order = c(2,1,3),method="ML")
fitc
fitc %>% forecast(h=10) %>% autoplot(include=80)

After remove the constanct( mean ), arima(2,1,3) keeps the same shape and shift down.

#mean is constant
austa3<-austa-mean(austa)
fitc_2<-arima(austa3,order = c(2,1,3),method="ML")
fitc_2
fitc_2 %>% forecast(h=10) %>% autoplot(include=80)
  1. Plot forecasts from an ARIMA(0,0,1) model with a constant. Remove the MA term and plot again.
fitd<-arima(austa,order = c(0,0,1),method="ML")
fitd
fitd %>% forecast(h=10) %>% autoplot(include=80)

Plot after remove the MA term.

fitd_2<-arima(austa,order = c(0,0,0),method="ML")
fitd_2
fitd_2 %>% forecast(h=10) %>% autoplot(include=80)
  1. Plot forecasts from an ARIMA(0,2,1) model with no constant.
fite<-arima(austa3,order = c(0,2,1),method="ML")
fite
fite %>% forecast(h=10) %>% autoplot(include=80)