statsmodels.tsa.ar_model.AutoRegResults.test_serial_correlation

AutoRegResults.test_serial_correlation(lags=None, model_df=None)[source]

Ljung-Box test for residual serial correlation

Parameters
lagsint

The maximum number of lags to use in the test. Jointly tests that all autocorrelations up to and including lag j are zero for j = 1, 2, …, lags. If None, uses lag=12*(nobs/100)^{1/4}. After 0.12 the number of lags will change to min(10, nobs // 5).

model_dfint

The model degree of freedom to use when adjusting computing the test statistic to account for parameter estimation. If None, uses the number of AR lags included in the model.

Returns
outputDataFrame

DataFrame containing three columns: the test statistic, the p-value of the test, and the degree of freedom used in the test.

See also

statsmodels.stats.diagnostic.acorr_ljungbox

Ljung-Box test for serial correlation.

Notes

Null hypothesis is no serial correlation.

The the test degree-of-freedom is 0 or negative once accounting for model_df, then the test statistic’s p-value is missing.