Course contentsShow
← Data Science
Lesson 783 of 2,14520. Time Series ModelsFree lesson

Ljung-Box Test for Residual Independence

Apply the Ljung-Box test to verify that model residuals resemble white noise.

Ljung-Box Test for Residual Independence

You'll learn how to verify that your ARIMA model's residuals behave like random noise using a statistical test.

What It Is

After fitting an ARIMA model, you need to check whether the residuals (the differences between actual and fitted values) are independent—meaning there's no leftover pattern the model missed. The Ljung-Box test is a formal hypothesis test that checks whether residuals show significant autocorrelation at multiple lags at once.

Think of it like checking that you've squeezed all the juice from an orange. If your model captured all the patterns in your time series, the residuals should look like white noise—completely random with no predictable structure.

How It Works

The test examines the first h autocorrelations of your residuals together:

  • Null hypothesis (H₀): Residuals are independently distributed (no autocorrelation exists)
  • Alternative hypothesis (H₁): Residuals show autocorrelation

The test produces a p-value. If the p-value is greater than your significance level (typically 0.05), you fail to reject the null hypothesis—good news! Your residuals behave like white noise, suggesting your model captured the time dependencies adequately.

If the p-value is low (< 0.05), your residuals still contain patterns, meaning your ARIMA model may need refinement.

When to Use It

Apply the Ljung-Box test after fitting your ARIMA model as part of residual diagnostics. It's more powerful than examining individual ACF lags because it tests multiple lags simultaneously, giving you a comprehensive verdict on residual independence.

Key Takeaway: The Ljung-Box test confirms whether your ARIMA residuals are white noise; a high p-value (> 0.05) indicates good model fit with no remaining autocorrelation patterns.