Ljung-Box q statistic

Use to test whether a series of observations over time are random and independent. If observations are not independent, one observation may be correlated with another observation k time units later, a relationship called autocorrelation. Autocorrelation can impair the accuracy of a time-based predictive model, such as time series plot, and lead to misinterpretation of the data.

For example, an electronics company tracks monthly sales of batteries for five years. They want to use the data to develop a  time series model to help forecast future sales. However, monthly sales may be affected by seasonal trends. For example, every year a rise in sales occurs when people buy batteries for Christmas toys. Thus a monthly sales observation in one year could be correlated with a monthly sales observations 12 months later (a lag of 12).

Before choosing their time series model, they can evaluate autocorrelation for the monthly differences in sales. The Ljung-Box Q (LBQ) statistic tests the null hypothesis that autocorrelations up to lag k equal zero (i.e., the data values are random and independent up to a certain number of lags--in this case 12). If the LBQ is greater than a specified critical value, autocorrelations for one or more lags may be  significantly different from zero, suggesting the values are not random and independent over time.

LBQ is also used to evaluate assumptions after fitting a time series model, such as ARIMA, to ensure that the residuals are independent.

The Ljung-Box is a Portmanteau test and is a modified version of the Box-Pierce chi-square statistic.