Skip to content
Surf Wiki
Save to docs
general/time-series-statistical-tests

From Surf Wiki (app.surf) — the open knowledge base

Ljung–Box test

Statistical test


Statistical test

The Ljung–Box test (named for Greta M. Ljung and George E. P. Box) is a type of statistical test of whether any of a group of autocorrelations of a time series are different from zero. Instead of testing randomness at each distinct lag, it tests the "overall" randomness based on a number of lags, and is therefore a portmanteau test.

This test is sometimes known as the Ljung–Box Q test, and it is closely connected to the Box–Pierce test (which is named after George E. P. Box and David A. Pierce). In fact, the Ljung–Box test statistic was described explicitly in the paper that led to the use of the Box–Pierce statistic,

The Ljung–Box test is widely applied in econometrics and other applications of time series analysis. A similar assessment can be also carried out with the Breusch–Godfrey test and the Durbin–Watson test.

Formal definition

The Ljung–Box test may be defined as: : H_0: The data is not correlated (i.e. the correlations in the population from which the sample is taken are 0, so that any observed correlations in the data result from randomness of the sampling process). : H_a: The data exhibit serial correlation.

The test statistic is: : Q = n(n+2)\sum_{k=1}^h\frac{\hat{\rho}^2_k}{n-k} where n is the sample size, \hat{\rho}k is the sample autocorrelation at lag k, and h is the number of lags being tested. Under H_0 the statistic Q asymptotically follows a \chi^2{(h)}. For significance level α, the critical region for rejection of the hypothesis of randomness is:

: Q \chi_{1-\alpha,h}^2

where \chi_{1-\alpha,h}^2 is the (1 − α)-quantile of the chi-squared distribution with h degrees of freedom.

The Ljung–Box test is commonly used in autoregressive integrated moving average (ARIMA) modeling. Note that it is applied to the residuals of a fitted ARIMA model, not the original series, and in such applications the hypothesis actually being tested is that the residuals from the ARIMA model have no autocorrelation. When testing the residuals of an estimated ARIMA model, the degrees of freedom need to be adjusted to reflect the parameter estimation. For example, for an ARIMA(p,0,q) model, the degrees of freedom should be set to h - p - q.

Box–Pierce test

The Box–Pierce test uses the test statistic, in the notation outlined above, given by : Q_\text{BP} = n \sum_{k=1}^h \hat{\rho}^2_k, and it uses the same critical region as defined above.

Simulation studies have shown that the distribution for the Ljung–Box statistic is closer to a \chi^2_{(h)} distribution than is the distribution for the Box–Pierce statistic for all sample sizes including small ones.

Implementations in statistics packages

  • R: the Box.test function in the stats package
  • Python: the acorr_ljungbox function in the statsmodels package
  • Julia: the Ljung–Box tests and the Box–Pierce tests in the HypothesisTests package
  • SPSS: the Box-Ljung statistic is included by default in output produced by the IBM SPSS Statistics Forecasting module.

References

.

References

  1. (1979). "Some power studies of a portmanteau test of time series model specification.". Biometrika.
  2. (2002-03-08). "Introduction to Time Series and Forecasting". Taylor & Francis.
  3. Davidson, James. (2000). "Econometric Theory". Blackwell.
  4. "R: Box–Pierce and Ljung–Box Tests".
  5. "Python: Ljung–Box Tests".
  6. "Time series tests".
  7. (1970). "Distribution of Residual Autocorrelations in Autoregressive-Integrated Moving Average Time Series Models". [[Journal of the American Statistical Association]].
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about Ljung–Box test — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report