1. Learn
  2. /
  3. Courses
  4. /
  5. Forecasting Product Demand in R

Exercise

Calculating MAPE and MAE

You previously calculated the forecast for the metropolitan region total sales and stored it in the object forecast_MET_t. You also have your validation data set stored in the object MET_t_valid that covers the same first 22 weeks of 2017. Let's see how good your forecast is!

Instructions

100 XP
  • Convert the mean of your forecast (forecast_MET_t$mean) and validation data set (MET_t_valid) to numeric values and save them as for_MET_t and v_MET_t respectively.
  • Calculate the MAE of your forecast. Remember, this is the average of the absolute difference between the forecast and the true validation values.
  • Calculate the MAPE of your forecast. This takes the same difference as the MAE, but divides it by the true validation values.
  • Print both the MAE and MAPE.