Get startedGet started for free

Visualizing Forecast

Your forecast seemed to be off by over 18% on average. Let's visually compare your forecast with the validation data set to see if we can see why. Your workspace has your forecast object forecast_MET_t and validation data set MET_t_valid loaded for you. Don't forget your validation is 22 weeks long!

This exercise is part of the course

Forecasting Product Demand in R

View Course

Exercise instructions

  • Convert the mean of your forecast (forecast$mean) into an xts object using the for_dates object for the time index remembering that your validation data set is 22 weeks long.
  • Plot your validation data set.
  • Overlay your forecast (for_MET_t_xts) on top of the validation.
  • Don't change the plotting options in either to make it easier to see.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Convert your forecast to an xts object
for_dates <- seq(as.Date("2017-01-01"), length = ___, by = "weeks")
for_MET_t_xts <- xts(forecast_MET_t$___, order.by = ___)

# Plot the validation data set
plot(MET_t_valid, main = 'Forecast Comparison', ylim = c(4000, 8500))

# Overlay the forecast of 2017
lines(___, col = "blue")
Edit and Run Code