Build time series forecast at regional level
Sometimes you don't have the time to build forecasts for every product, so we take a top-down approach to hierarchical forecasting. Let's work on the metropolitan region in reverse this time!
Your workspace has the following objects pre-loaded: MET_total
for the total regional sales, dates_valid
, and MET_t_v
for the valiation data set.
This exercise is part of the course
Forecasting Product Demand in R
Exercise instructions
- Build a time series model for all the sales in the metropolitan region (
MET_total
). - Forecast out 22 values into 2017 from this model.
- Make this forecast into an
xts
object. - Calculate the MAPE.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Build a regional time series model using auto.arima
MET_t_model_arima <- ___(___)
# Calculate a 2017 forecast for 22 periods from the above model
for_MET_t <- ___(___, h = ___)
# Make an xts object from your forecast
for_MET_t_xts <- ___(___$mean, order.by = ___)
# Calculate the MAPE
MAPE <- mape(___, ___)
print(MAPE)