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: 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==