Purpose: Learn who to import data in R. Employ the forecast package in R to obtain simple forecasts. In particular, apply the methods of mean, naïve, and seasonally naïve forecasts and, furthermore, assess their out-of-sample accuracy using MAE, RMSE, and MAPE. Deadline: Tuesday, September 19, 2017

It is the beginning of January 2018. ECO5375 Inc. had the following sales in $US from Jan 2016 to December 2017

Year Month Sales Year Month Sales Year Month Sales
2016 Jan 1,000 2017 Jan 2,000 2018 Jan ???
2016 Feb 2,000 2017 Feb 3,000 2018 Feb ???
2016 Mar 3,000 2017 Mar 4,000 2018 Mar ???
2016 Apr 4,000 2017 Apr 5,000 2018 Apr ???
2016 May 5,000 2017 May 6,000 2018 May ???
2016 Jun 6,000 2017 Jun 7,000 2018 Jun ???
2016 Jul 7,000 2017 Jul 8,000 2018 Jul ???
2016 Aug 8,000 2017 Aug 9,000 2018 Aug ???
2016 Sep 9,000 2017 Sep 10,000 2018 Sep ???
2016 Oct 10,000 2017 Oct 11,000 2018 Oct ???
2016 Nov 11,000 2017 Nov 12,000 2018 Nov ???
2016 Dec 12,000 2017 Dec 13,000 2018 Dec ???

The data is available as a .csv-file here

Your line manager at ECO5375, Inc. Mr. Kris Hock wants you to forecast 2018 sales month by month using three different forecast methods.

# clear the workspace
rm(list = ls())

# loading required libraries
library(forecast)
library(Hmisc) # for minor ticks on graph axis
# set the directory
setwd('your directory')
getwd()
sales <- as.integer(c(seq(1000,12000,1000),
                      (seq(1000,12000,1000)+1000),
                      (seq(1000,12000,1000)+2000)))
ts.sales <- ts(sales,start = c(2016,1), freq = 12)
print(window(ts.sales,end=c(2017,12)))
##        Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov
## 2016  1000  2000  3000  4000  5000  6000  7000  8000  9000 10000 11000
## 2017  2000  3000  4000  5000  6000  7000  8000  9000 10000 11000 12000
##        Dec
## 2016 12000
## 2017 13000
rm(sales)
plot(ts.sales, type = "n", las = 1, 
     ylab = "U.S. Dollar", xlab ="",
     , main = "ECO 5375 Inc. Sales Data | Jan 2016 - Dec 2017")
lines(window(ts.sales,end=c(2017,12)),type="p",lwd=2,col="blue")
abline(v=(2018-1/24), col = "red")
text(2018.5,y=13000, "Forecast Period",  col = "red")
text(2016.5,y=13000, "Historical Sample",  col = "red")
grid()
minor.tick(nx=6)