Auto-regression with a smoother time series
Now, let's re-run the same procedure using a smoother signal. You'll use the same percent change algorithm as before, but this time use a much larger window (40 instead of 20). As the window grows, the difference between neighboring timepoints gets smaller, resulting in a smoother signal. What do you think this will do to the auto-regressive model?
prices_perc_shifted
and model
(updated to use a window of 40) are available in your workspace.
This exercise is part of the course
Machine Learning for Time Series Data in Python
Exercise instructions
Using the function (visualize_coefficients()
) you created in the last exercise, generate a plot with coefficients of model
and column names of prices_perc_shifted
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Visualize the output data up to "2011-01"
fig, axs = plt.subplots(2, 1, figsize=(10, 5))
y.loc[:'2011-01'].plot(ax=axs[0])
# Run the function to visualize model's coefficients
visualize_coefficients(____, ____, ax=axs[1])
plt.show()