Ljung–Box test
This article needs additional citations for verification. (June 2011) |
The Ljung–Box 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,[1][2] and from which that statistic takes its name. The Box–Pierce test statistic is a simplified version of the Ljung–Box statistic for which subsequent simulation studies have shown poor performance.[3]
The Ljung–Box test is widely applied in
Formal definition
The Ljung–Box test may be defined as:
- : The data are independently distributed (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).
- : The data are not independently distributed; they exhibit serial correlation.
The test statistic is:[2]
where n is the sample size, is the sample autocorrelation at lag k, and h is the number of lags being tested. Under the statistic Q asymptotically follows a . For
where is the (1 − α)-quantile[4] of the chi-squared distribution with h degrees of freedom.
The Ljung–Box test is commonly used in
Box–Pierce test
The Box–Pierce test uses the test statistic, in the notation outlined above, given by[1]
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 distribution than is the distribution for the Box–Pierce statistic for all sample sizes including small ones.[citation needed]
Implementations in statistics packages
- R: the
Box.test
function in the stats package[6] - Python: the
acorr_ljungbox
function in thestatsmodels
package[7] - Julia: the Ljung–Box tests and the Box–Pierce tests in the
HypothesisTests
package[8] - SPSS: the Box-Ljung statistic is included by default in output produced by the IBM SPSS Statistics Forecasting module.
See also
References
- ^ JSTOR 2284333.
- ^ .
- .
- ISBN 978-0-387-95351-9.
- ISBN 978-0-631-21584-4.
- ^ "R: Box–Pierce and Ljung–Box Tests". stat.ethz.ch. Retrieved 2016-06-05.
- ^ "Python: Ljung–Box Tests". statsmodels.org. Retrieved 2018-07-23.
- ^ "Time series tests". juliastats.org. Retrieved 2020-02-04.
Further reading
- Brockwell, Peter; Davis, Richard (2002). Introduction to Time Series and Forecasting (2nd ed.). Springer. pp. 35–38. ISBN 978-0-387-94719-8.
- Enders, Walter (2010). Applied Econometric Time Series (Third ed.). New York: Wiley. pp. 69–70. ISBN 978-0470-50539-7.
- ISBN 978-0-691-01018-2.
External links
This article incorporates public domain material from the National Institute of Standards and Technology