BaşlayınÜcretsiz Başlayın

Ljung-Box test

Another powerful tool to check autocorrelations in the data is the Ljung-Box test. In this exercise, you will practice detecting autocorrelation in the standardized residuals by performing a Ljung-Box test.

The null hypothesis of Ljung-Box test is: the data is independently distributed. If the p-value is larger than the specified significance level, the null hypothesis cannot be rejected. In other words, there is no clear sign of autocorrelations and the model is valid.

You will use the same GARCH model as the previous exercise. Its standardized residuals are saved in std_resid.

Bu egzersiz

GARCH Models in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import the module needed for Ljung-Box tests from the statsmodels package.
  • Perform a Ljung-Box test up to lag 10, and save the result in lb_test.
  • Print and review p-values from the Ljung-Box test result.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import the Python module
from statsmodels.stats.diagnostic import ____

# Perform the Ljung-Box test
lb_test = ____(std_resid , ____ = ____, return_df = True)

# Print the p-values
print('P-values are: ', ____.iloc[0,1])
Kodu Düzenle ve Çalıştır