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!.
本练习是课程的一部分
Forecasting Product Demand in R
练习说明
- Make this prediction object
pred_MET_hiinto anxtsobject calledpred_MET_hi_xtsusing the date index provided. - Plot this new object you just created to view your forecast.
- Calculate the MAPE from this forecast.
交互式实操练习
通过完成这段示例代码来试试这个练习。
# 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(___)