Ljung-Box test for autocorrelation (white-noise / portmanteau test)
Source:R/ops-timefreq.R
ljungBoxTest.RdApplies the Ljung-Box portmanteau test (Ljung & Box, 1978) to a
one-dimensional signal: the statistic
\(Q = N(N+2)\sum_{k=1}^{h} \hat\rho_k^2 / (N-k)\) aggregates the first
lag squared autocorrelations (from autocorrelation), and
under the null hypothesis that the series is white noise \(Q\) follows a
chi-squared distribution with lag degrees of freedom. It is the
standard formal test for the presence of autocorrelation (and, applied to
model residuals, for model adequacy). Same definition as
statsmodels.stats.diagnostic.acorr_ljungbox and stats::Box.test(type
= "Ljung-Box").
Value
A list with statistic (the Ljung-Box \(Q\)), p_value
(the chi-squared upper-tail probability), and df (= lag).
References
Ljung, G.M., Box, G.E.P. (1978). On a measure of lack of fit in time series models. Biometrika, 65(2), 297-303.