The Ljung-Box test calculator gives the Q statistic, the Box-Pierce statistic, the degrees of freedom and the p-value of a test for autocorrelation, from the number of observations and the autocorrelations at lags 1 to 5 of a series or of the residuals of a model.
How the calculation works
- Enter the number of observations and the autocorrelations at lags 1 to 5.
- Enter the number of parameters fitted in the model, 0 for a raw series.
- Read Q, the p-value and whether white noise is rejected.
Example
With 120 observations and autocorrelations of 0.25, 0.12, -0.05, 0.08 and 0.03, the Ljung-Box Q is 10.711 with 5 degrees of freedom, against a critical value of 11.070. The p-value is 0.0574 and the rejection flag is 0. The Box-Pierce statistic is 10.404. A single autocorrelation outside 0.179 would be noteworthy.
Why it matters
The calculator helps analysts, students and forecasters who check the residuals of a time series model, such as ARIMA or exponential smoothing, and want to know whether any pattern remains that the model has not captured, using the autocorrelations read from a plot or from software.
Good to know
The autocorrelations must be the sample values at consecutive lags starting at lag 1, computed on the series or the residuals. Subtract the number of fitted ARMA parameters from the lags to get the degrees of freedom, and do not apply this to the residuals of a regression with lagged dependent variables. A low p-value says that some autocorrelation remains, but it does not say at which lag. A high p-value does not prove independence, especially with few observations.
Related tools
The Durbin-Watson calculator tests first-order autocorrelation of regression residuals, the chi-square test calculator treats the distribution used here, the correlation significance calculator tests one correlation and the partial correlation calculator controls for other variables.