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.
Plot the fmsales data from expsmooth package.
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.
decompose function to plot: observed, trend, seasonal and random.
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.
Use the function
accuracy to compare the actual values and de predicting ones.
Use the a simple exponential approach to create a vector of predictions. Consider the same time fence and planning event previously defined.
Calculate the accuracy again and compare the performance using RSME. Which one is the best?
Use the a double exponential approach, that consider trends, to make predictions for the next 3 months.
Use the a triple exponential approach, that consider trend, and seasonal components, to make predictions for the next 3 months.
summary function to find the RMSE and other information of this last model.