statsmodels.tsa.arima.model.ARIMAResults.test_serial_correlation¶
-
ARIMAResults.test_serial_correlation(method, df_adjust=
False
, lags=None
)¶ Ljung-Box test for no serial correlation of standardized residuals
Null hypothesis is no serial correlation.
- Parameters:¶
- method{‘ljungbox’, ‘boxpierce’,
None
} The statistical test for serial correlation. If None, an attempt is made to select an appropriate test.
- lags
None
,int
or array_like If lags is an integer then this is taken to be the largest lag that is included, the test result is reported for all smaller lag length. If lags is a list or array, then all lags are included up to the largest lag in the list, however only the tests for the lags in the list are reported. If lags is None, then the default maxlag is min(10, nobs // 5) for non-seasonal models and min(2*m, nobs // 5) for seasonal time series where m is the seasonal period.
- df_adjustbool,
optional
If True, the degrees of freedom consumed by the model is subtracted from the degrees-of-freedom used in the test so that the adjusted dof for the statistics are lags - model_df. In an ARMA model, this value is usually p+q where p is the AR order and q is the MA order. When using df_adjust, it is not possible to use tests based on fewer than model_df lags.
- Returns
- ——-
- output
ndarray
An array with (test_statistic, pvalue) for each endogenous variable and each lag. The array is then sized (k_endog, 2, lags). If the method is called as ljungbox = res.test_serial_correlation(), then ljungbox[i] holds the results of the Ljung-Box test (as would be returned by statsmodels.stats.diagnostic.acorr_ljungbox) for the i th endogenous variable.
- method{‘ljungbox’, ‘boxpierce’,
See also
statsmodels.stats.diagnostic.acorr_ljungbox
Ljung-Box test for serial correlation.
Notes
Let d = max(loglikelihood_burn, nobs_diffuse); this test is calculated ignoring the first d residuals.
Output is nan for any endogenous variable which has missing values.