Aan de slagGa gratis aan de slag

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!.

Deze oefening maakt deel uit van de cursus

Forecasting Product Demand in R

Cursus bekijken

Oefeninstructies

  • Make this prediction object pred_MET_hi into an xts object called pred_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.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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(___)
Code bewerken en uitvoeren