Series: United States Industrial Production (2012 = 100, NSA)
Source: FRED, Federal Reserve Bank of St. Louis
library(fpp2)
library(ggplot2)
library(ggthemes)
library(tidyverse)
library(kableExtra)
usip <- read.csv("F:/MSAE/2020fall_PredictiveAnalytics/Discussions/USIP.csv")
usip <- usip[order(usip$DATE),]
ip <- ts(usip[,2],start=c(1980,1),end=c(2020,9),frequency=12)
plot1 <- autoplot(ip) + geom_line() +
xlab("Year") + ylab("") + ggtitle("US Industrial Production (2012 = 100)") + theme_classic()
plot1
decadd <- decompose(ip, type = "additive")
decmul <- decompose(ip, type = "multiplicative")
autoplot(decadd)
autoplot(decmul)
The multiplicative model has lower remainder values and is likely to work better for projections. This is likely due to increased seasonal variation towards the end of the series and increasing values.
ip1 <- stl(ip, t.window=15, s.window="periodic", robust=TRUE)
ipf1 <- seasadj(ip1)
autoplot(naive(ipf1, h=24))
ipf2 <- forecast(ip1, method="naive", h=24)
autoplot(ipf2)
ipf3 <- stlf(ip, method="rwdrift", h=24, lambda=0)
autoplot(ipf3)
# table1 <- accuracy(ipf1)
# kable(table1, caption = "Naive") + kable_classic()
table2 <- accuracy(ipf2)
kable(round(table2, 2), caption = "Random Walk", full_width = F)
| ME | RMSE | MAE | MPE | MAPE | MASE | ACF1 | |
|---|---|---|---|---|---|---|---|
| Training set | 0.1 | 1.12 | 0.7 | 0.12 | 0.88 | 0.23 | 0.13 |
table3 <- accuracy(ipf3)
kable(round(table3, 2), caption = "Random Walk with Drift", full_width = F)
| ME | RMSE | MAE | MPE | MAPE | MASE | ACF1 | |
|---|---|---|---|---|---|---|---|
| Training set | -0.01 | 0.88 | 0.5 | 0 | 0.61 | 0.16 | 0.23 |