Skip to content

Ljung–Box Test

A portmanteau hypothesis test that combines sample autocorrelations through a chosen lag to assess whether a time series or fitted-model residuals retain serial correlation across that lag set.

Version
v1 · 2026-09-28 · History
Domain-specific #
10456
Domain group
Formal Sciences
Origin domain
Experimental Design & Statistics
Subdomains
Time Series Diagnostics, Time Series Analysis → Experimental Design & Statistics
Aliases
Ljung-Box test, Ljung–Box portmanteau test, Modified Box–Pierce test

Core Idea

The Ljung–Box test asks a joint question about serial correlation. For a sequence of n observations and a chosen maximum lag h, it combines the squared sample autocorrelations at lags 1 through h using the weight n(n+2)/(n-k). Large values of the resulting Q statistic are inconsistent with a null in which the included population autocorrelations are zero, subject to the asymptotic approximation and other assumptions.

The test is often used on residuals after fitting a time-series model. There the question is not whether the original series is white noise, but whether the fitted model has left autocorrelation in its errors. Parameter estimation affects reference degrees of freedom; for an ARIMA(p,0,q) diagnostic, h-p-q is a common adjustment. Rejection signals remaining dependence somewhere in the tested lag set, not which lag causes it or what model should replace the current one.

Structural Signature

Sig role-phrases:

  • Ordered observations or residuals — Supply the sequence whose serial dependence is questioned. It is required input. Counterfactual: Unordered observations do not define lag autocorrelation.
  • Sample size n — Sets scaling and finite-sample correction. It is required parameter. Counterfactual: Using inconsistent effective sample sizes changes the statistic.
  • Maximum lag h — Defines the joint autocorrelation horizon under review. It is required design choice. Counterfactual: Different h values test different alternatives and degrees of freedom.
  • Sample autocorrelations — Measure serial relation at each included lag. It is required statistics. Counterfactual: Raw residual magnitude cannot substitute for lag correlation.
  • Portmanteau statistic Q — Aggregates lag evidence into one nonnegative test statistic. It is defining transformation. Counterfactual: Separate per-lag tests are not the Ljung–Box procedure.
  • Reference distribution and degrees of freedom — Convert Q to a p-value or rejection rule under the null approximation. It is required inference rule. Counterfactual: Ignoring parameter fitting can make the residual diagnostic miscalibrated.

What It Is Not

  • The test is not a separate hypothesis test at every lag; it aggregates evidence across the selected set.
  • Failure to reject does not prove independence, normality, correct variance, or a correct model outside the tested lags.
  • A significant result does not identify a causal mechanism or establish that every included autocorrelation is nonzero.
  • The Ljung–Box statistic is not identical to the simpler Box–Pierce statistic, even though both are portmanteau tests.
  • Closest near-miss. The Box–Pierce test uses n times the sum of squared autocorrelations; Ljung–Box uses n(n+2)/(n-k) weighting to improve the null approximation.

Scope of Application

  • ARIMA residual diagnostics. Analysts test whether fitted-model residuals retain autocorrelation after accounting for estimated parameters.
  • Time-series screening. A raw series can be checked for joint departure from zero autocorrelation across a stated horizon.
  • Model comparison. Residual portmanteau evidence can reveal that one candidate leaves more serial structure than another.
  • Simulation validation. Known null and alternative processes can test finite-sample calibration for a proposed lag rule.

Clarity

A report should state the sequence tested, sample size, maximum lag, statistic, degrees of freedom, p-value, and whether parameters were estimated. 'The data are random' is too broad: the null addresses selected autocorrelations, not every form of dependence. Lag selection should precede inspection when possible, because trying many horizons and reporting one p-value changes the evidential procedure.

Manages Complexity

Many lag-specific correlations become one diagnostic, reducing multiplicity and making residual adequacy easier to summarize. The price is localization: Q does not say which lags or dynamics dominate. Plotting residual autocorrelations, examining model structure, and checking conditional variance or distributional assumptions restore information hidden by the portmanteau statistic.

Abstract Reasoning

  1. Specify whether the input is a raw series or residuals from a named fitted model.
  2. Choose a maximum lag that fits the sampling frequency and diagnostic question.
  3. Compute sample autocorrelations consistently over the effective observations.
  4. Form the Ljung–Box Q statistic rather than silently substituting the Box–Pierce formula.
  5. Select reference degrees of freedom that account for fitted parameters where required.
  6. Interpret rejection as residual serial-correlation evidence and follow with localized diagnostics and model revision.

Knowledge Transfer

The procedure transfers across econometric, engineering, environmental, and other time series when ordering, lag, and null assumptions are meaningful. It does not transfer to unordered cross-sectional data. A generic omnibus test in another domain shares the portmanteau pattern but is not the Ljung–Box test unless the weighted autocorrelation statistic and its calibration are retained.

Examples

Canonical

After fitting an ARIMA(p,0,q) model, an analyst computes residual autocorrelations through lag h, forms Q, and compares it with a chi-squared reference using an h-p-q adjustment where appropriate.

Mapped back: adjustment → estimated ARMA parameters; lags → 1 through h; sequence → model residuals; statistic → Ljung–Box Q.

Applied / In Practice

A significant Q says at least some included serial correlation remains; it does not identify a causal mechanism or prove every lag is nonzero.

Mapped back: evidence → joint rejection; invalid conclusion → all lags or a causal model; valid conclusion → residual autocorrelation remains.

Structural Tensions

T1 — Short Lag Horizon versus Broad Lag Horizon. Small h targets local dependence with fewer degrees of freedom, while large h can detect broader structure but dilute or distort power.

Diagnostic: Why is the selected horizon relevant to the fitted model and sampling frequency?

T2 — Simple Asymptotic Calibration versus Fitted-Model And Finite-Sample Effects. The chi-squared rule is convenient, but estimation and small samples alter its accuracy.

Diagnostic: Have parameter estimation and sample size been reflected in calibration?

Structural–Framed Character

Ljung–Box Test is strongly structural with analyst-selected scope. Its statistic and null calibration are mathematical, while the series, lag horizon, model-fitting adjustment, and significance policy frame the inference. Those choices can materially change the answer and must be visible.

Structural Core vs. Domain Accent

The skeleton is an omnibus statistic that aggregates several correlated diagnostics. Time-series analysis supplies ordered observations, lags, autocorrelation, residual models, and chi-squared calibration. Removing those yields a general joint test rather than Ljung–Box.

This entry is a kind of Portmanteau test.

  • Approved root. No reviewed parent currently entails this finite-sample-weighted portmanteau autocorrelation statistic.

  • Related — hypothesis test, autocorrelation, and residual diagnostic. These are necessary analytic neighbors without an asserted parent edge.

Relationships to Other Abstractions

Local relationship map for Ljung–Box TestParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Ljung–Box TestDOMAINDomain-specific abstraction: Portmanteau test — is a kind ofPortmanteau testDOMAIN

Current abstraction Ljung–Box Test Domain-specific

Parents (1) — more general patterns this builds on

  • Ljung–Box Test is a kind of Portmanteau test Domain-specific

    The Ljung–Box Test is the Portmanteau Test that aggregates sample autocorrelations through a chosen lag into one residual-serial-correlation statistic.

Hierarchy paths (4) — routes to 4 parentless roots

Neighborhood in Abstraction Space

Ljung–Box Test sits in a moderately populated region (53rd percentile for distinctiveness): it has near-neighbors but no dense thicket of look-alikes.

Family — Statistical Hypothesis Tests & Diagnostics (9 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-10-08

Not to Be Confused With

  • Box–Pierce test. Tell: Uses n times the sum of squared autocorrelations and lacks the Ljung–Box lag-specific finite-sample weight.
  • Durbin–Watson test. Tell: Targets a more specific regression-residual serial-correlation setting and statistic.
  • Breusch–Godfrey test. Tell: Uses an auxiliary regression and can test specified higher-order serial correlation in regression residuals.
  • Individual ACF confidence bands. Tell: Assess lags separately and do not implement the portmanteau joint statistic.

References

  • Frozen Wikipedia discovery revision: https://en.wikipedia.org/wiki/Ljung%E2%80%93Box_test (revision 1322912568).
  • Preserved source candidate: https://academic.oup.com/biomet/article-abstract/66/1/153/223702
  • Preserved source candidate: https://archive.org/details/introductiontoti00broc
  • Preserved source candidate: https://archive.org/details/introductiontoti00broc/page/n49
  • Preserved source candidate: https://books.google.com/books?id=shWtvsFbxlkC&pg=PA162
  • Preserved source candidate: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/box.test.html
  • Preserved source candidate: https://www.statsmodels.org/dev/generated/statsmodels.stats.diagnostic.acorr_ljungbox.html
  • Preserved source candidate: https://juliastats.org/HypothesisTests.jl/latest/time_series/
  • Preserved source candidate: https://books.google.com/books?id=Tc4RPwAACAAJ&pg=PA69

The frozen Wikipedia revision is discovery provenance. The retained source set was reviewed for identity, formal or operational relation, and scope. The encyclopedia's structural synthesis is bounded to those claims; a thin authority surface is recorded as a nonblocking source-strengthening repair rather than concealed.