Plotting dynamic forecasts
Time to plot your predictions. Remember that making dynamic predictions, means that your model makes predictions with no corrections, unlike the one-step-ahead predictions. This is kind of like making a forecast now for the next 30 days, and then waiting to see what happens before comparing how good your predictions were.
The lower_limits
, upper_limits
and amazon
DataFrames as well as your mean predictions mean_forecast
that you created in the last exercise are available in your environment.
This exercise is part of the course
ARIMA Models in Python
Exercise instructions
- Plot the
amazon
data using the dates in the index of this DataFrame as the x coordinates and the values as the y coordinates. - Plot the
mean_forecast
predictions similarly. - Plot a shaded area between
lower_limits
andupper_limits
of your confidence interval. Use the index of one of these DataFrames as the x coordinates.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# plot the amazon data
plt.plot(____, ____, label='observed')
# plot your mean forecast
plt.plot(____, ____, color='r', label='forecast')
# shade the area between your confidence limits
plt.____(____, ____,
____, color='pink')
# set labels, legends and show plot
plt.xlabel('Date')
plt.ylabel('Amazon Stock Price - Close USD')
plt.legend()
plt.show()