Discussion #3

Hello All,

For this assignment, I am using monthly US sales of petroleum and related products from Janauary 1971 to December 1991. Hyndman had a an interesting powerpoint on ETS models that can be found here: https://robjhyndman.com/talks/RevolutionR/6-ETS.pdf.

library(fma)
library(forecast)

dat <- read.csv("C:/Users/Jharrop/Desktop/ADEC7460 Forecasting/Discussions/Discussion 3/sales_petroleum-an.csv")
datats <- ts(dat$Sales, frequency = 12, start = c(1971,1))
plot(datats)

From what I understand, the forecast function will automataically select an ets model directly on data that you pass into the function - essentially you don’t have to give it a fitted model. For the first model, I thought I would give this a shot.

fcst <- forecast(datats); summary(fcst)
## 
## Forecast method: ETS(M,A,M)
## 
## Model Information:
## ETS(M,A,M) 
## 
## Call:
##  ets(y = object, lambda = lambda, allow.multiplicative.trend = allow.multiplicative.trend) 
## 
##   Smoothing parameters:
##     alpha = 0.61 
##     beta  = 1e-04 
##     gamma = 0.2254 
## 
##   Initial states:
##     l = 4.3179 
##     b = 0.0757 
##     s=0.8564 1.082 1.1227 1.027 0.7935 0.7824
##            1.118 1.05 1.1019 1.0724 1.0504 0.9434
## 
##   sigma:  0.0838
## 
##      AIC     AICc      BIC 
## 1370.660 1373.275 1430.660 
## 
## Error measures:
##                       ME     RMSE       MAE        MPE     MAPE      MASE
## Training set -0.02993756 1.088353 0.7619599 -0.8280641 6.615231 0.4974197
##                    ACF1
## Training set 0.04744964
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
## Jan 1992       17.60092 15.70962 19.49222 14.708430 20.49341
## Feb 1992       21.06206 18.41122 23.71291 17.007944 25.11618
## Mar 1992       20.83001 17.87584 23.78418 16.311992 25.34802
## Apr 1992       21.33312 18.00306 24.66318 16.240233 26.42601
## May 1992       21.71277 18.04084 25.38471 16.097033 27.32851
## Jun 1992       20.89400 17.10920 24.67881 15.105643 26.68236
## Jul 1992       14.14462 11.42360 16.86564  9.983175 18.30606
## Aug 1992       18.83836 15.01544 22.66128 12.991704 24.68501
## Sep 1992       19.80889 15.59103 24.02674 13.358235 26.25954
## Oct 1992       21.48080 16.70278 26.25882 14.173446 28.78815
## Nov 1992       19.15059 14.71708 23.58411 12.370112 25.93108
## Dec 1992       15.56330 11.82493 19.30168  9.845947 21.28066
## Jan 1993       18.44740 13.72514 23.16967 11.225327 25.66948
## Feb 1993       22.07112 16.24810 27.89415 13.165572 30.97667
## Mar 1993       21.82414 15.90069 27.74759 12.765005 30.88327
## Apr 1993       22.34739 16.11765 28.57714 12.819817 31.87497
## May 1993       22.74118 16.23943 29.24294 12.797613 32.68476
## Jun 1993       21.87990 15.47271 28.28709 12.080942 31.67886
## Jul 1993       14.80953 10.37288 19.24618  8.024262 21.59480
## Aug 1993       19.72060 13.68309 25.75812 10.487016 28.95419
## Sep 1993       20.73313 14.25273 27.21353 10.822212 30.64404
## Oct 1993       22.47932 15.31246 29.64618 11.518559 33.44008
## Nov 1993       20.03751 13.52663 26.54838 10.079983 29.99503
## Dec 1993       16.28142 10.89367 21.66917  8.041569 24.52128
plot(fcst)

I will split the data into a training and test set for the next two models.

train <- dat[1:228,]
test <- dat[229:251,]

train <- ts(train$Sales, frequency = 12, start = c(1971,1))
test <- ts(test$Sales, frequency = 12, start = c(1990,1))

# Build Models
fit1 <- holt(train,h=24)
fit2 <- holt(train,exponential=TRUE, h=24)

fcst1 <- forecast(fit1)
fcst2 <- forecast(fit2)

Plot and report accuracy results:

plot(datats, type="o", ylab="US Petroleum Sales", 
  flwd=1, plot.conf=FALSE)
lines(window(datats,start=1990),type="o")
lines(fit1$mean,col=2)
lines(fit2$mean,col=3)
legend("topleft", lty=1, pch=1, col=1:6,
    c("Data","Holt's","Exponential"))

# Accuracy 
accuracy(fcst1, test)
##                        ME     RMSE      MAE       MPE     MAPE      MASE
## Training set  0.004048736 1.682716 1.261764 -2.268363 12.80255 0.8787082
## Test set     -0.873890072 3.358495 2.633344 -8.326555 16.30504 1.8338936
##                   ACF1 Theil's U
## Training set 0.2904408        NA
## Test set     0.2405127 0.7620708
accuracy(fcst2, test)
##                       ME     RMSE      MAE        MPE     MAPE      MASE
## Training set  0.04759985 1.686554 1.272839  -1.581029 12.89625 0.8864213
## Test set     -1.22411682 3.483303 2.706880 -10.242551 16.92945 1.8851051
##                   ACF1 Theil's U
## Training set 0.2897254        NA
## Test set     0.2556664 0.8020222