LoslegenKostenlos loslegen

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

Diese Übung ist Teil des Kurses

Forecasting Product Demand in R

Kurs anzeigen

Anleitung zur Übung

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

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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 bearbeiten und ausführen