Ljung–Box test
   HOME

TheInfoList



OR:

The Ljung–Box test (named for Greta M. Ljung and
George E. P. Box George Edward Pelham Box (18 October 1919 – 28 March 2013) was a British statistician, who worked in the areas of quality control, time-series analysis, design of experiments, and Bayesian inference. He has been called "one of the gre ...
) is a type of
statistical test A statistical hypothesis test is a method of statistical inference used to decide whether the data at hand sufficiently support a particular hypothesis. Hypothesis testing allows us to make probabilistic statements about population parameters. ...
of whether any of a group of
autocorrelation Autocorrelation, sometimes known as serial correlation in the discrete time case, is the correlation of a signal with a delayed copy of itself as a function of delay. Informally, it is the similarity between observations of a random variable ...
s of a
time series In mathematics, a time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data. Ex ...
are different from zero. Instead of testing
randomness In common usage, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. Individual rand ...
at each distinct lag, it tests the "overall" randomness based on a number of lags, and is therefore a
portmanteau test A portmanteau test is a type of statistical hypothesis test in which the null hypothesis is well specified, but the alternative hypothesis is more loosely specified. Tests constructed in this context can have the property of being at least moderate ...
. 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 George Edward Pelham Box (18 October 1919 – 28 March 2013) was a British statistician, who worked in the areas of quality control, time-series analysis, design of experiments, and Bayesian inference. He has been called "one of the gre ...
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, 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. The Ljung–Box test is widely applied in
econometrics Econometrics is the application of statistical methods to economic data in order to give empirical content to economic relationships. M. Hashem Pesaran (1987). "Econometrics," '' The New Palgrave: A Dictionary of Economics'', v. 2, p. 8 p. ...
and other applications of
time series analysis In mathematics Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in m ...
. A similar assessment can be also carried out with the
Breusch–Godfrey test In statistics, the Breusch–Godfrey test is used to assess the validity of some of the modelling assumptions inherent in applying regression-like models to observed data series. In particular, it tests for the presence of serial correlation that ...
and the Durbin–Watson test.


Formal definition

The Ljung–Box test may be defined as: : H0: 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). : Ha: The data are not independently distributed; they exhibit serial correlation. The test statistic is: : Q = n(n+2)\sum_^h\frac where ''n'' is the sample size, \hat_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_. For
significance level In statistical hypothesis testing, a result has statistical significance when it is very unlikely to have occurred given the null hypothesis (simply by chance alone). More precisely, a study's defined significance level, denoted by \alpha, is the p ...
α, the critical region for rejection of the hypothesis of randomness is: : Q > \chi_^2 where \chi_^2 is the (1 − ''α'')-
quantile In statistics and probability, quantiles are cut points dividing the range of a probability distribution into continuous intervals with equal probabilities, or dividing the observations in a sample in the same way. There is one fewer quantile th ...
of the
chi-squared distribution In probability theory and statistics, the chi-squared distribution (also chi-square or \chi^2-distribution) with k degrees of freedom is the distribution of a sum of the squares of k independent standard normal random variables. The chi-squar ...
with ''h'' degrees of freedom. The Ljung–Box test is commonly used in
autoregressive integrated moving average In statistics and econometrics, and in particular in time series analysis, an autoregressive integrated moving average (ARIMA) model is a generalization of an autoregressive moving average (ARMA) model. Both of these models are fitted to time ser ...
(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 = n \sum_^h \hat^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_ 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 Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g ...
: the Ljung–Box tests and the Box–Pierce tests in the ''HypothesisTests'' package


See also

*
Q-statistic The Q-statistic is a test statistic output by either the Box-Pierce test or, in a modified version which provides better small sample properties, by the Ljung-Box test. It follows the chi-squared distribution. See also Portmanteau test. The q ...
* Wald–Wolfowitz runs test *
Breusch–Godfrey test In statistics, the Breusch–Godfrey test is used to assess the validity of some of the modelling assumptions inherent in applying regression-like models to observed data series. In particular, it tests for the presence of serial correlation that ...
* Durbin–Watson test


References


Further reading

* * *


External links

{{DEFAULTSORT:Ljung-Box test Time series statistical tests Time domain analysis de:Box-Ljung-Test