Get startedGet started for free

Plotting one-step-ahead predictions

Now that you have your predictions on the Amazon stock, you should plot these predictions to see how you've done.

You made predictions over the latest 30 days of data available, always forecasting just one day ahead. By evaluating these predictions you can judge how the model performs in making predictions for just the next day, where you don't know the answer.

The lower_limits, upper_limits and amazon DataFrames as well as your mean prediction 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

View Course

Exercise instructions

  • Plot the amazon data, using the amazon.index as the x coordinates.
  • Plot the mean_forecast prediction similarly, using mean_forecast.index as the x-coordinates.
  • Plot a shaded area between lower_limits and upper_limits of your confidence interval. Use the index of lower_limits 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 predictions
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()
Edit and Run Code