ComenzarEmpieza gratis

ACF plot

If a GARCH model is doing a good job, the standardized residuals should not exhibit autocorrelations. In this exercise, you will practice using an ACF plot to detect autocorrelations in the data.

The coefficient of correlation between two values in a time series is called the autocorrelation function (ACF), and an ACF plot is a visual representation of correlations between different lags. There are pre-defined functions in Python statsmodels packages that enable you to generate ACF plots easily.

A GARCH model has been fitted with the S&P 500 return data, and its standardized residuals have been calculated and saved in std_resid. The matplotlib.pyplot has been imported as plt.

Este ejercicio forma parte del curso

GARCH Models in Python

Ver curso

Instrucciones del ejercicio

  • Import the module needed for ACF plots from the statsmodels package.
  • Plot the GARCH model standardized residuals saved in std_resid.
  • Generate an ACF plot of the standardized residuals, and set the confidence level to 0.05.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Import the Python module
from statsmodels.graphics.tsaplots import ____

# Plot the standardized residuals
plt.plot(____)
plt.title('Standardized Residuals')
plt.show()

# Generate ACF plot of the standardized residuals
____(std_resid, ____ = ____)
plt.show()
Editar y ejecutar código