# Data Science for Operational Excellence (Part-5)

**R-exercises**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.

**leave a comment**for the author, please follow the link and comment on their blog:

**R-exercises**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.