Generating one-step-ahead predictions
It is very hard to forecast stock prices. Classic economics actually tells us that this should be impossible because of market clearing.
Your task in this exercise is to attempt the impossible and predict the Amazon stock price anyway.
In this exercise you will generate one-step-ahead predictions for the stock price as well as the uncertainty of these predictions.
A model has already been fitted to the Amazon data for you. The results object from this model is available in your environment as results
.
This exercise is part of the course
ARIMA Models in Python
Exercise instructions
- Use the
results
object to make one-step-ahead predictions over the latest 30 days of data and assign the result toone_step_forecast
. - Assign your mean predictions to
mean_forecast
using one of the attributes of theone_step_forecast
object. - Extract the confidence intervals of your predictions from the
one_step_forecast
object and assign them toconfidence_intervals
. - Print your mean predictions.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Generate predictions
one_step_forecast = results.____(____=___)
# Extract prediction mean
mean_forecast = one_step_forecast.____
# Get confidence intervals of predictions
confidence_intervals = one_step_forecast.____
# Select lower and upper confidence limits
lower_limits = confidence_intervals.loc[:,'lower close']
upper_limits = confidence_intervals.loc[:,'upper close']
# Print best estimate predictions
print(____)