← 7. Time series
Time series diagnostics
Try this analysis →

ACF, PACF, ADF and Ljung–Box Tests

Four tools with similar names actually answer different questions.

AutocorrelationPartial autocorrelationUnit rootsResidual diagnostics

0.8110.7220.6530.6040.4380.3312Slow decayLag (weeks)ACF of the original seriesWeekly inquiry counts, 156 weeks

Suppose you are analyzing the number of inquiries an online customer service center receives each week. If there were many inquiries last week, will there be many this week too? If inquiry volume has risen steadily since a service overhaul, can you use past patterns as they are to predict the future? And once you've built a forecasting model, you also need to check that no time-related patterns the model missed are left over.

Tools often used together here are the autocorrelation function (ACF), the partial autocorrelation function (PACF), the ADF unit root test and the Ljung–Box test. The four look like a list of similarly named time series diagnostics, but the questions they actually answer differ. ACF and PACF look at the relationship between past and current values, the ADF test examines whether a unit root is present, and the Ljung–Box test assesses whether the autocorrelations at several lags are jointly 0.

In this article we'll use a customer service center's weekly inquiry counts over 156 weeks (3 years) as an example to go through how the four methods work, the order of analysis, how to interpret the numbers and common misunderstandings.

SECTION 1

What makes time series data different?

With ordinary cross-sectional data you care about differences between observations, but in a time series the order of the observations and the time intervals matter.

This week's inquiry count may be related to last week's, and scheduled events such as month-end billing or product updates can create recurring fluctuations. If you ignore time, it's easy to miss dependence that actually exists in the data.

300400500600202320242025Count
Weekly inquiry counts, 156 weeks

The example uses 156 weekly inquiry counts compiled with the same definition from the first week of 2023 through the last week of 2025. Before the analysis, check that no weeks are missing, that the weekly counting rule didn't change and whether there were exceptional events such as a major outage. Don't conclude that rising inquiry counts are a trend right away; also consider the possibility of seasonality or a structural change.

SECTION 2

What is autocorrelation?

Autocorrelation is the correlation between the current value of a time series and its own past value a certain number of lags earlier.

For example, the lag-1 autocorrelation is the relationship between this week's and last week's inquiry counts, and the lag-4 autocorrelation is the relationship between this week's count and the count 4 weeks earlier. Conceptually, the population autocorrelation at lag 1 can be written as:

ρ1 = Corr(Yt, Yt−1)

A positive autocorrelation means that when past values were high, current values also tend to be high. A negative one means high values tend to be followed by low values. But autocorrelation doesn't imply causation, and it can be large simply because of a trend or seasonality.

SECTION 3

What does the ACF show?

The autocorrelation function (ACF) shows the autocorrelations at several lags side by side.

It is usually examined with an ACF plot, a bar chart with lags on the horizontal axis and correlation coefficients on the vertical axis. Suppose the original inquiry count series gave the following sample ACF.

Lag (weeks)Sample ACF
10.81
20.72
30.65
40.60
80.43
120.33
0.8110.72230.6045670.438910110.331201Lag (weeks)95% confidence band ±0.16
ACF of the original series

There is a strong positive correlation between inquiry volumes in adjacent weeks, and the correlation decays relatively slowly even as the lag grows. This pattern can appear in a highly persistent stationary series, but it can also be seen in a nonstationary series with a trend or a unit root. A slowly decaying ACF alone can't confirm a unit root.

When looking at an ACF, check not only the height of the bars but also the confidence band and the state of the series used in the analysis (original series, differenced series or residuals).

Lags not listed in the table are drawn by smoothly connecting the tabulated values.

SECTION 4

How is the PACF different from the ACF?

The partial autocorrelation function (PACF) shows the relationship that remains between the current value and a particular past value once the effects of the intermediate lags are taken into account.

For example, the lag-3 PACF assesses the relationship between the current value and the value 3 weeks earlier after controlling for the linear effects of lags 1 and 2.

0.81123456789101112ACF0.8110.1923456789101112PACFLag (weeks)
ACF vs. PACF
MeasureRelationship examinedMain uses
ACFCorrelation without removing the effects of intermediate lagsUnderstanding dependence, seasonal patterns, screening MA candidates
PACFCorrelation adjusted for the linear effects of intermediate lagsIdentifying direct lag relationships, screening AR candidates

For a stationary pure AR(1) process, the PACF is theoretically 0 after lag 1 while the ACF decays gradually. For a pure MA(1) process it's the other way around: the ACF is theoretically 0 after lag 1 and the PACF decays gradually.

ACFPACFAR(1)MA(1)
Theoretical AR and MA patterns

These are idealized textbook patterns, though. In real samples, noise, mixed ARMA structures, seasonality and estimation error can keep a clear cutoff from appearing.

SECTION 5

How do the ACF and PACF help with ARIMA orders?

ARIMA is a time series model that combines autoregression (AR), differencing (I) and moving averages (MA).

The ACF and PACF are especially useful for screening candidates for the AR order p and the MA order q in a series that has been made stationary.

Observed pattern (idealized stationary process)Candidates to consider
ACF decays gradually, PACF weak after lag 1AR(1)
ACF weak after lag 1, PACF decays graduallyMA(1)
Both decay graduallyConsider an ARMA form
Recurring peaks at a fixed seasonal lagConsider a seasonal component

In practice, use these patterns as clues for finding initial candidates, not as rules that settle the model. The final model is best chosen by comparing AIC and BIC, residual diagnostics and forecasting performance from time series cross-validation or a holdout sample, all together.

SECTION 6

Why stationarity matters

Weak stationarity means the mean and variance are constant over time, and the covariance between two time points depends only on the lag between them, not on the absolute time.

Not every time series model requires the same stationarity assumption, but it is particularly important in traditional ARMA analysis.

NonstationaryOriginal seriesClose to stationaryFirst differenceFirst-half and second-half means
Stationarity and nonstationarity

If customer service inquiries rise over a long period as the service grows, the mean level can change over time. Interpreting the autocorrelation of the original series as is in that situation can mostly reflect the trend rather than the actual short-term dependence. So review the plot and the data-generating process, and if needed consider detrending, seasonal adjustment or differencing.

Differencing isn't always necessary, though. For a trend-stationary process or a series with a structural change, differencing automatically can actually throw away information.

SECTION 7

What does the ADF unit root test check?

The augmented Dickey–Fuller (ADF) test examines the null hypothesis that a time series has a unit root.

The test is run on a regression that includes lagged difference terms to account for autocorrelation in the errors. A simplified ADF regression is:

ΔYt = α + γ Yt−1 + Σj=1…k φj ΔYt−j + εt

ADF critical values and p-values are computed differently from those of an ordinary t test. Results can also change depending on whether you include a constant or a time trend and how many lags you use. And ADF is not an all-purpose tool that tests every kind of nonstationarity; structural changes or seasonal unit roots need separate examination.

SECTION 8

Reading ADF results for the original and first-differenced series

Suppose applying the ADF test to the weekly inquiry counts gave the following results.

The figures below were set up to illustrate the diagnostic workflow alongside the separate ACF example.

Series analyzedADF statisticp-valueDecision at the 5% level
Original series (with constant)-1.42.573Fail to reject unit root null
First-differenced series (with constant)-5.86< .001Reject unit root null
Original series−1.42p = .573Unit root not rejected−7−2.880First-differenced series−5.86p < .001Unit root rejected−7−2.880
ADF test results

A p-value of .573 for the original series means there isn't enough evidence to conclude there is no unit root; it is not proof that a unit root definitely exists. For the first-differenced series, on the other hand, the unit root null can be rejected under that test specification.

Accordingly, you can consider an ARIMA differencing order of d = 1 as a candidate. But you still need to review the differenced plot, the ACF and PACF and the model fit, and you shouldn't ignore structural changes or seasonality.

SECTION 9

What should you check again after differencing?

A first difference is the transformation that subtracts the previous value from the current value.

ΔYt = Yt − Yt−1

ΔY0.41123456789101112ACF0.41123456789101112PACF
The differenced series and its ACF and PACF

Even if the original series rises every week, if the size of the increase is stable, the differenced series can show a more constant mean. But differencing costs one observation, and the level information of the original series is no longer directly visible. Overdifferencing can also create unnecessary negative autocorrelation.

In this example, suppose that after differencing the ACF weakens quickly at short lags and a clear spike appears at lag 1 of the PACF. In that case ARIMA(1,1,0) can serve as an initial candidate, but you need to compare its actual fit with ARIMA(0,1,1) and other candidates.

SECTION 10

What does the Ljung–Box test check?

The Ljung–Box test is a portmanteau test that assesses whether the autocorrelations at several chosen lags are jointly 0.

Unlike the ACF, which looks at one lag at a time, it combines the correlations up to a specified maximum lag. The test statistic is:

Q = n(n + 2) Σk=1…h ρ̂k2 / (n − k)

Here n is the number of observations, h the maximum lag included in the test and ρ̂k the sample autocorrelation at lag k. The null hypothesis is usually that the autocorrelations from lag 1 through lag h are all 0.

The Ljung–Box test can also be used to explore dependence in the original series, but it is used most often to check whether autocorrelation remains in the residuals of a forecasting model. When applying it to ARIMA residuals, it's common to adjust the test's degrees of freedom for the number of estimated AR and MA parameters.

SECTION 11

Ljung–Box results on model residuals

Suppose candidate ARIMA models were fitted to the customer service inquiry counts and their residuals were analyzed.

The tests in the table below are assumed to use lags up to 12, with degrees of freedom adjusted for the number of estimated AR and MA parameters.

Model comparedLjung–Box Q(12)p-valueInterpretation
Candidate A29.1.002Autocorrelation may remain in the residuals
Candidate B10.4.494No significant evidence of residual autocorrelation
0102030123456789101112Maximum lag hQ5% thresholdCandidate AQ(12) = 29.1 · p = .002Candidate BQ(12) = 10.4 · p = .494
Cumulative Ljung–Box statistic

For candidate A the null hypothesis is rejected, so you should consider whether the model fails to capture the time dependence adequately. For candidate B the null is not rejected, but that doesn't prove the residuals are perfect white noise. There are limits related to the test's power and the maximum lag chosen.

Also, Ljung–Box mainly examines linear autocorrelation left over from the mean structure. To check for volatility clustering or conditional heteroscedasticity, you can add checks on the pattern of squared residuals or ARCH-related diagnostics.

SECTION 12

In what order do you use the four methods?

The four tools don't repeat the same test; each handles a different stage of time series diagnosis.

In practice, the following order is useful.

1Plot the original seriesTrend, seasonality, outliers2Original ACF & PACFForm of dependence3ADF testCheck for a unit root4Needed transformationsDifferencing, seasonal differencing, detrending5Transformed ACF & PACFCandidate AR and MA orders6Model fittingCompare candidates7Residual ACF & Ljung–BoxRemaining autocorrelation
Diagnostic workflow
  1. Plot the original series: check for trend, seasonality, outliers and structural change
  2. ACF and PACF of the original series: understand the form of time dependence
  3. ADF test: check for a unit root under the specified trend and constant conditions
  4. Needed transformations: apply differencing, seasonal differencing, detrending, etc.
  5. ACF and PACF of the transformed series: choose candidate AR and MA orders
  6. Model fitting: compare the fit and forecasting performance of several candidates
  7. Residual ACF and Ljung–Box: check for unexplained autocorrelation

This order is a starting point, not a fixed procedure for every time series. For example, if seasonality is pronounced, you may need to look at the ACF at seasonal lags and seasonal differencing first; if there is a clear structural change, it's best to start by looking at when that event happened and how to reflect it in the model.

SECTION 13

What to watch out for, and a sample write-up

The most common mistakes are concluding that a series is not stationary because the ADF p-value is large, or taking a large Ljung–Box p-value to mean the model is perfect.

For both tests, failing to reject the null hypothesis should not be read as evidence that the hypothesis is true.

Also, settling the ARIMA orders from the shapes of the ACF and PACF bars alone can lead to overfitting or the wrong amount of differencing. Weekly data can have an annual cycle (about 52 weeks) and holiday or event effects, and if you estimate 52-week seasonality from the 156 weeks of data in this example, keep in mind that the cycle repeats only three times.

Sample write-up

Autocorrelation and stationarity diagnostics were performed on 156 weekly inquiry counts for an online customer service center. The ACF of the original series was 0.81 at lag 1 and 0.72 at lag 2, and positive autocorrelation decayed gradually at later lags. The ADF test failed to reject the unit root null hypothesis for the original series (ADF = -1.42, p = .573), but rejected it for the first-differenced series (ADF = -5.86, p < .001).

On this basis, ARIMA candidates including a first difference were examined. After model fitting, the Ljung–Box test up to lag 12 found no significant evidence of residual autocorrelation for candidate B (Q = 10.4, p = .494). These results alone, however, do not fully establish stationarity or the adequacy of the model, so residual plots and forecasting performance should be examined as well.

In an actual report, state the deterministic terms in the ADF test and how the lag order was chosen, the maximum lag and degrees-of-freedom adjustment for Ljung–Box, the ARIMA model used and the conditions of the residual diagnostics.

✓Wrap-up

The four tools answer different questions

The ACF shows the overall correlation between current and past values, and the PACF shows the relationship after accounting for intermediate lags.


ADF tests for the presence of a unit root, and Ljung–Box tests whether the autocorrelations at several lags are jointly 0.

In time series analysis, rather than settling on a model from just one of the four tools, it's important to connect the characteristics of the original series, the needed transformations, the comparison of candidate models and residual diagnostics into a single workflow. Remembering that ACF and PACF explore structure, ADF checks for unit roots and Ljung–Box looks for leftover autocorrelation makes it easy to keep each analysis's role straight.

KEY TAKEAWAY

The four tools are not a single verdict but a flow from exploring to checking to confirming.