Data Science for Operational Excellence (Part-5)

May 3, 2017

(This article was first published on R-exercises, and kindly contributed to R-bloggers)

Operations need to have demand forecasts in order to establish optimal resource allocation policies. But, when we make predictions the only thing that we assure is the occurrence of prediction errors. Fortunately, there is no need to be 100% accurate to succeed, we just need to perform better than our competitors. In this exercise we will learn a practical approach to predict using the forecast package.

Answers to the exercises are available here.

Exercise 1
Plot the fmsales data from expsmooth package.

Exercise 2
The data obtained are in weeks. In order to learn how to manipulate ts function, create a new time serie, which is based on the previously one, starting at January, 2011.

Exercise 3
Use decompose function to plot: observed, trend, seasonal and random.

Exercise 4
Use the moving average approach to create a vector of predictions. Consider that in this company you cannot change your purchasing planning for the next 3 months (time fence). So, there is no need of rolling statistics and you only need to make plans 4 times per year.

Exercise 5
Use the function accuracy to compare the actual values and de predicting ones.

Learn more about Forecasting in the online course Time Series Analysis and Forecasting in R. In this course you will learn how to:

  • A complete introduction on Forecasting
  • Work thru an exponentional smoothing instruction
  • And much more

Exercise 6
Use the a simple exponential approach to create a vector of predictions. Consider the same time fence and planning event previously defined.

Exercise 7
Calculate the accuracy again and compare the performance using RSME. Which one is the best?

Exercise 8
Use the a double exponential approach, that consider trends, to make predictions for the next 3 months.

Exercise 9
Use the a triple exponential approach, that consider trend, and seasonal components, to make predictions for the next 3 months.

Exercise 10
Use the summary function to find the RMSE and other information of this last model.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)