ComeçarComece de graça

Build time series forecast for new product

Before we can even calculate a bottom-up forecast for the metropolitan region we need to have forecasts of multiple products! First, let's build a time series forecast of the specialty product in the metropolitan region. The product demand is saved as MET_sp in your workspace as well as dates_valid as well as your validation data MET_sp_v.

You've written the MAPE function enough at this point. A mape() function has now been written for you to use with two inputs: the first is the forecast and the second is the validation set.

Este exercício faz parte do curso

Forecasting Product Demand in R

Ver curso

Instruções do exercício

  • Use the auto.arima() function to build a time series model for the specialty product MET_sp.
  • Forecast this model for 22 time periods into 2017.
  • Make this forecast into an xts object. You can still use the dates_valid object for the order.by = option.
  • Calculate the MAPE for this forecast with your new mape() function.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Build a time series model 
MET_sp_model_arima <- ___(___)

# Forecast the time series model you just built for 22 periods
for_MET_sp <- ___(___, h = ___)

# Create an xts object on the forecast object you just created
for_MET_sp_xts <- ___(___$mean, order.by = ___)

# Calculate the MAPE on your forecast with the validation data
MAPE <- mape(___, ___)
print(MAPE)
Editar e executar o código