Visualizing forecasts of regression
Wonderfully done! You now have a forecast for the high end product in the metropolitan region. Let's visualize this forecast!.
This exercise is part of the course
Forecasting Product Demand in R
Exercise instructions
- Make this prediction object
pred_MET_hi
into anxts
object calledpred_MET_hi_xts
using the date index provided. - Plot this new object you just created to view your forecast.
- Calculate the MAPE from this forecast.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Convert to an xts object
dates_valid <- seq(as.Date("2017-01-01"), length = 22, by = "weeks")
pred_MET_hi_xts <- xts(___, order.by = ___)
# Plot the forecast
plot(___)
# Calculate and print the MAPE
MET_hi_v <- bev_xts_valid[,"MET.hi"]
MAPE <- 100*mean(abs((pred_MET_hi_xts - MET_hi_v)/MET_hi_v))
print(___)