I chose to use the EIA data on wind power generation over the years. Energy data is very interesting to me as it relates to my job but also shows the real data of what is happening in the industry. The wind generation data is in thousands of megawatt hours. For reference, the average household uses 10.7 MWh annually, according to the EIA.
# Set working directory
setwd("/Users/spoll/OneDrive/Documents/Boston College/Predictive Analytics_Forecasting/Week 3")
# Load the datasets
raw_energydata <- read.csv("Net_generation_United_States_all_sectors_monthly.csv"
, check.names = FALSE
, stringsAsFactors = FALSE
, na.strings = ""
)
nrow(raw_energydata)
## [1] 253
The first ETS model is just using the error component. This yielded an alpha of 0.9241 which is significantly large.
# Error
myts = ts(raw_energydata$`wind thousand megawatthours`, frequency = 12)
mye = ets(myts, model = 'ANN')
mye
## ETS(A,N,N)
##
## Call:
## ets(y = myts, model = "ANN")
##
## Smoothing parameters:
## alpha = 0.9241
##
## Initial states:
## l = 563.8218
##
## sigma: 2212.513
##
## AIC AICc BIC
## 5301.093 5301.189 5311.693
plot(mye)
myf = forecast(mye)
accuracy(mye)
## ME RMSE MAE MPE MAPE MASE
## Training set 161.6435 2203.751 1404.924 0.3882126 13.04018 0.7627627
## ACF1
## Training set -0.002230419
The second ETS model is the Holt’s model as it includes the trend. The alpha here is a bit less at 0.9172, still close to a Naive model.
# Holt's (Trend + Error)
mye2 = ets(myts, model = 'AAN')
mye2
## ETS(A,A,N)
##
## Call:
## ets(y = myts, model = "AAN")
##
## Smoothing parameters:
## alpha = 0.9172
## beta = 1e-04
##
## Initial states:
## l = 354.1931
## b = 150.4059
##
## sigma: 2215.37
##
## AIC AICc BIC
## 5303.722 5303.965 5321.389
myf2 = forecast(mye2)
accuracy(mye2)
## ME RMSE MAE MPE MAPE MASE
## Training set 0.7930849 2197.787 1415.901 -5.328022 14.63903 0.7687225
## ACF1
## Training set 0.004161194
The third ETS model is the Holt-Winter’s model as it includes the seasonality, trend, and error. Here, it yielded an alpha of 0.1223, which shows that it puts more weight on the previously forecasted value compared to the previous observation.
# Holt-Winter's (Seasonal + Trend + Error)
mye3 = ets(myts, model = 'AAA')
mye3
## ETS(A,A,A)
##
## Call:
## ets(y = myts, model = "AAA")
##
## Smoothing parameters:
## alpha = 0.1223
## beta = 0.006
## gamma = 0.3417
##
## Initial states:
## l = -36.7547
## b = 59.878
## s = 520.8818 463.1206 -24.358 -1989.287 -2560.863 -2321.155
## -266.7703 1038.67 2260.848 2055.473 88.8914 734.5488
##
## sigma: 1710.915
##
## AIC AICc BIC
## 5184.480 5187.084 5244.547
myf3 = forecast(mye3)
accuracy(mye3)
## ME RMSE MAE MPE MAPE MASE ACF1
## Training set 156.033 1655.931 1180.131 -1.167278 29.41903 0.6407178 0.218839
Comparing the plots side-by-side, you can see that the third model is a lot tighter of a fit for the data points.
par(mfrow = c(1,3))
plot(myts ~ myf$fitted) + title(main = "ETS Model 1")
## integer(0)
plot(myts ~ myf2$fitted) + title(main = "ETS Model 2 (Holt's)")
## integer(0)
plot(myts ~ myf3$fitted) + title(main = "ETS Model 3 (Holt-Winter's)")
## integer(0)