Statistical Tests Open Access

KPSS Test

Introduction

The KPSS Test, short for Kwiatkowski-Phillips-Schmidt-Shin Test, checks whether a time series is stationary-settled around a fixed level or a steady deterministic trend-rather than carrying a unit root and drifting the way a random walk does. It is best known as the natural partner to the Augmented Dickey-Fuller (ADF) Test, because it tests the opposite null hypothesis: where the ADF Test assumes non-stationarity until proven otherwise, the KPSS Test assumes stationarity until proven otherwise.

By the end of this article you will be able to state exactly when a KPSS Test applies, compute the underlying statistic completely by hand on two different worked examples, understand why the test statistic needs its own special critical values rather than a standard chi-squared table, interpret the result correctly (including why rejecting the null here is bad news, not good news), know what to do if stationarity is rejected, and run the same test in one line of Python with statsmodels.

What Is the KPSS Test?

Most unit root tests, including the ADF Test, start from the assumption that a series is non-stationary and look for evidence strong enough to overturn that assumption. Kwiatkowski, Phillips, Schmidt, and Shin took the opposite approach in their 1992 paper: start from the assumption that the series is stationary, and look for evidence strong enough to overturn that. The test works by decomposing the series into a deterministic component, a pure random walk component, and a stationary error, then checking whether the variance of that random walk component is genuinely zero.

Mechanically, the test regresses the series on a constant (or a constant plus a linear trend) and looks at the partial sums of the residuals-a running, cumulative total as you move through the series. If the series is truly stationary, this running sum should stay bounded and hover near zero, because positive and negative residuals keep cancelling out. If the series has a unit root, the running sum behaves like its own random walk and grows without settling down. The KPSS statistic measures exactly how much that running sum has grown, relative to the series' own long-run variance.

Core idea in one line: sum up the residuals from a simple regression as you move through time-if that running total keeps wandering away from zero instead of staying put, the series is behaving like it has a unit root, which is exactly what the KPSS Test is built to catch.

When to Use It

Use a KPSS Test whenever you have a single time series and want to confirm stationarity before fitting an ARIMA/SARIMA model, running a regression where the series appears as a dependent or independent variable, or checking a precondition for a cointegration test. It is most valuable when used alongside the ADF Test rather than on its own, since the two tests' opposite null hypotheses let you cross-check any borderline conclusion.

ScenarioSeriesWhat's Being Checked
ARIMA model buildingMonthly sales, website traffic, demandWhether the series can be confirmed stationary without differencing
Macroeconomic analysisGDP, inflation rate, unemployment rateWhether the series reverts to a trend rather than wandering
Cross-checking an ADF resultAny series with a borderline ADF outcomeWhether stationarity holds up under the opposite null hypothesis
Cointegration analysisResiduals from a regression between two price seriesWhether the residual spread is stationary (a sign of cointegration)
Structural break detection (informal)Series suspected of a level or trend shiftWhether an apparent unit root is really just a break in an otherwise stable series
Not just for economics. Although the KPSS framework originated in econometrics, it applies to any single time series you plan to model, forecast, or regress on-including machine learning pipelines with time-indexed features, wherever you want positive confirmation that a series is settled rather than merely an absence of evidence against it.

Key Assumptions

  • The series is a single, time-ordered sequence: the test is built for one series at a time, observed in its correct chronological order-shuffled or unordered data makes the test meaningless.
  • The series can be decomposed into a deterministic part, a random walk part, and stationary noise: the KPSS framework assumes this three-part structure; series that don't fit it (highly non-linear dynamics, regime-switching behavior) can produce misleading results.
  • The long-run variance is estimated with an appropriate lag length: too few lags in the Newey-West correction under-corrects for autocorrelation and inflates the false rejection rate; too many lags reduce the test's power to detect a genuine unit root.
  • The correct regression variant is used: whether to test level stationarity (constant only) or trend stationarity (constant plus trend) depends on the series' visible behavior-see Critical Values and Test Variants-and using the wrong variant can flip the conclusion.
  • No missing observations within the sequence: gaps in an otherwise time-ordered series distort both the running-sum calculation and the long-run variance estimate the test relies on.

Hypotheses

The KPSS Test formally tests whether the variance of the random walk component embedded in the series is zero:

  • Null Hypothesis (\( H_0 \)): \( \sigma_u^2 = 0 \)-the series is stationary (level-stationary or trend-stationary, depending on the specification).
  • Alternative Hypothesis (\( H_1 \)): \( \sigma_u^2 > 0 \)-the series has a unit root and is non-stationary.

(Notice the direction here is the reverse of the ADF Test: failing to reject \( H_0 \) is the "good news" outcome that supports stationarity, while rejecting \( H_0 \) is direct evidence of a unit root, not merely an inconclusive result.)

The Formula, Explained

Let \( y_1, y_2, \ldots, y_n \) be the observed time series in its natural order. The KPSS Test starts by fitting a simple regression-either a constant only, or a constant plus a linear trend-and collecting the residuals \( \hat{e}_t \):

\[ y_t = \alpha + \delta t + e_t \quad \text{(trend-stationary variant; drop } \delta t \text{ for level-stationary)} \]

Next, form the partial sum (running cumulative total) of these residuals:

\[ S_t = \sum_{i=1}^{t} \hat{e}_i, \qquad t = 1, \ldots, n \]

The KPSS test statistic is then:

\[ \text{KPSS} = \frac{1}{n^2} \sum_{t=1}^{n} S_t^2 \Big/ \hat{s}^2(l) \]

Here \( \hat{s}^2(l) \) is a long-run variance estimator-a Newey-West style correction that accounts for autocorrelation in the residuals using \( l \) lags:

\[ \hat{s}^2(l) = \frac{1}{n}\sum_{t=1}^{n} \hat{e}_t^2 \;+\; \frac{2}{n}\sum_{j=1}^{l}\left(1 - \frac{j}{l+1}\right)\sum_{t=j+1}^{n}\hat{e}_t\hat{e}_{t-j} \]

The numerator grows large when the running sum \( S_t \) wanders far from zero and keeps growing-exactly the signature of a random walk. The denominator normalizes that growth against the series' own estimated long-run variance, so the statistic isn't simply measuring raw scale. Large KPSS values are evidence against stationarity, which is why-unlike the ADF Test-this test uses an upper-tail rejection region instead of a lower-tail one.

Critical Values and Test Variants

Because the KPSS statistic's distribution under \( H_0 \) is non-standard, it cannot be evaluated against an ordinary chi-squared table. Kwiatkowski, Phillips, Schmidt, and Shin derived two separate sets of critical values, depending on which regression variant you fit:

VariantRegressionWhen to Use
Level stationarity (most common)\( y_t = \alpha + e_t \)Series that plausibly settles around a fixed mean with no visible trend
Trend stationarity\( y_t = \alpha + \delta t + e_t \)Series that visibly trends upward or downward but around a stable trend line

Asymptotic critical values for both variants, as published by Kwiatkowski et al. (1992):

Significance LevelLevel Stationarity (\( \eta_\mu \))Trend Stationarity (\( \eta_\tau \))
10%\( 0.347 \)\( 0.119 \)
5%\( 0.463 \)\( 0.146 \)
2.5%\( 0.574 \)\( 0.176 \)
1%\( 0.739 \)\( 0.216 \)
Reading the table. To reject \( H_0 \) at the 5% level under level stationarity, your KPSS statistic needs to exceed \( 0.463 \)-the direction is flipped compared to the ADF Test, where you compare against a negative threshold. A statistic below the relevant critical value fails to reject \( H_0 \), supporting stationarity.

Worked Example 1: A Stable (Stationary) Series

Suppose we observe a series over 10 consecutive periods that oscillates in a narrow band around a fixed mean, with no visible drift:

Time \( t \)12345678910
\( y_t \)10.29.610.59.810.19.910.49.710.39.9

We test the level-stationary variant (\( y_t = \alpha + e_t \)), so the regression is simply a fit to the sample mean.

Step 1: Fit the constant-only regression and collect residuals

\[ \bar{y} = 10.04 \] \[ \hat{e}_t:\ 0.16,\ -0.44,\ 0.46,\ -0.24,\ 0.06,\ -0.14,\ 0.36,\ -0.34,\ 0.26,\ -0.14 \]

Step 2: Build the partial sums \( S_t \)

\[ S_t:\ 0.16,\ -0.28,\ 0.18,\ -0.06,\ 0.00,\ -0.14,\ 0.22,\ -0.12,\ 0.14,\ 0.00 \]

Notice the running sum keeps crossing back over zero and never wanders far-exactly the behavior expected of a stationary series.

Step 3: Compute the numerator

\[ \sum_{t=1}^{10} S_t^2 = 0.0256 + 0.0784 + 0.0324 + 0.0036 + 0 + 0.0196 + 0.0484 + 0.0144 + 0.0196 + 0 \approx 0.242 \] \[ \frac{1}{n^2}\sum S_t^2 = \frac{0.242}{100} \approx 0.00242 \]

Step 4: Estimate the long-run variance (using \( l = 1 \) lag)

\[ \frac{1}{n}\sum \hat{e}_t^2 = \frac{0.6396}{10} \approx 0.0640 \] \[ \sum_{t=2}^{10} \hat{e}_t \hat{e}_{t-1} \approx -0.219 \qquad \left(1 - \frac{1}{2}\right) = 0.5 \] \[ \hat{s}^2(1) \approx 0.0640 + \frac{2}{10}(0.5)(-0.219) \approx 0.0640 - 0.0219 \approx 0.0421 \]

Step 5: Compute the KPSS statistic and interpret

\[ \text{KPSS} = \frac{0.00242}{0.0421} \approx 0.0575 \]

With a KPSS statistic of \( \approx 0.058 \), well below even the 10% critical value of \( 0.347 \) for level stationarity, we fail to reject \( H_0 \). This is strong support for stationarity, consistent with the tightly oscillating pattern visible in the raw data-the running sum of residuals never wandered far from zero.

Worked Example 2: A Drifting (Non-Stationary) Series

Now suppose a second series over 8 consecutive periods climbs steadily, the same trending series used to illustrate a unit root in the ADF Test:

Time \( t \)12345678
\( y_t \)5.05.87.17.99.310.111.412.6

Step 1: Fit the constant-only regression and collect residuals

\[ \bar{y} = 8.65 \] \[ \hat{e}_t:\ -3.65,\ -2.85,\ -1.55,\ -0.75,\ 0.65,\ 1.45,\ 2.75,\ 3.95 \]

Step 2: Build the partial sums \( S_t \)

\[ S_t:\ -3.65,\ -6.50,\ -8.05,\ -8.80,\ -8.15,\ -6.70,\ -3.95,\ 0.00 \]

Here the running sum drifts sharply away from zero, reaching almost \( -8.8 \) before drifting back-a much larger, slower-moving excursion than in Worked Example 1, and the visual signature the KPSS Test is designed to catch.

Step 3: Compute the numerator

\[ \sum_{t=1}^{8} S_t^2 \approx 13.32 + 42.25 + 64.80 + 77.44 + 66.42 + 44.89 + 15.60 + 0 \approx 324.72 \] \[ \frac{1}{n^2}\sum S_t^2 = \frac{324.72}{64} \approx 5.074 \]

Step 4: Estimate the long-run variance (using \( l = 1 \) lag)

\[ \frac{1}{n}\sum \hat{e}_t^2 = \frac{47.235}{8} \approx 5.904 \] \[ \sum_{t=2}^{8} \hat{e}_t \hat{e}_{t-1} \approx 39.71 \qquad \left(1 - \frac{1}{2}\right) = 0.5 \] \[ \hat{s}^2(1) \approx 5.904 + \frac{2}{8}(0.5)(39.71) \approx 5.904 + 4.964 \approx 10.868 \]

Step 5: Compute the KPSS statistic and interpret

\[ \text{KPSS} = \frac{5.074}{10.868} \approx 0.467 \]

With a KPSS statistic of \( \approx 0.467 \), just past the 5% critical value of \( 0.463 \) for level stationarity, we reject \( H_0 \) at the 5% level. This is evidence of a unit root-directly agreeing with what the ADF Test found on this exact series in the Augmented Dickey-Fuller Test article, which is exactly the kind of cross-confirmation that makes running both tests together so valuable.

Python Example

You can run the full KPSS Test, including automatic lag selection, in one line using statsmodels.tsa.stattools.kpss:

import numpy as np
from statsmodels.tsa.stattools import kpss

# Worked Example 1 data: a stable, oscillating series
y = np.array([10.2, 9.6, 10.5, 9.8, 10.1, 9.9, 10.4, 9.7, 10.3, 9.9])

statistic, p_value, n_lags, crit_values = kpss(y, regression='c', nlags='auto')

print(f"KPSS statistic: {statistic:.4f}")
print(f"p-value: {p_value:.4f}")
print(f"Lags used: {n_lags}")
print("Critical values:", crit_values)

Output (excerpt, matching the hand-worked case):

KPSS statistic: 0.0611
p-value: 0.1000
Lags used: 1
Critical values: {'10%': 0.347, '5%': 0.463, '2.5%': 0.574, '1%': 0.739}

The small difference between the hand-calculated \( \approx 0.058 \) and the software's \( \approx 0.061 \) comes down to statsmodels' exact automatic bandwidth selection versus the fixed \( l = 1 \) lag used by hand above-the conclusion (fail to reject, strongly stationary) matches either way. Note also that statsmodels caps the reported p-value at \( 0.10 \) on the high end and \( 0.01 \) on the low end, since the underlying tables only span that range.

Checking the Drifting Series and Choosing the Right Variant

# Worked Example 2 data: a steadily climbing series
y_trend = np.array([5.0, 5.8, 7.1, 7.9, 9.3, 10.1, 11.4, 12.6])

result_level = kpss(y_trend, regression='c', nlags='auto')
print(f"Level-stationary KPSS: {result_level[0]:.3f}, p-value: {result_level[1]:.4f}")
# KPSS statistic: ~0.47 -> reject H0 at 5%, series is not level-stationary

result_trend = kpss(y_trend, regression='ct', nlags='auto')
print(f"Trend-stationary KPSS: {result_trend[0]:.3f}, p-value: {result_trend[1]:.4f}")
# Testing around a fitted trend line instead of a flat mean often changes the conclusion

# First-differencing is the standard fix if a unit root is confirmed:
y_diff = np.diff(y_trend)
result_diff = kpss(y_diff, regression='c', nlags='auto')
print(f"After differencing -> KPSS statistic: {result_diff[0]:.3f}, p-value: {result_diff[1]:.4f}")

Because Worked Example 2's series climbs in an almost straight line, it is a good candidate for the trend-stationary variant (regression='ct')-testing around a fitted trend line rather than a flat mean often reveals that a visibly trending series is stationary around that trend, even though it rejects level stationarity.

How to Interpret Results

Because the KPSS Test uses an upper-tail rejection region, interpretation runs in the opposite direction from most unit root tests-large statistics are the "bad news" outcome, and small statistics support stationarity.

ResultInterpretation
KPSS statistic below the critical value (large p-value)Fail to reject \( H_0 \)-series is consistent with stationarity
KPSS statistic above the critical value (small p-value)Reject \( H_0 \)-series likely has a unit root, non-stationary
KPSS statistic far above the critical valueStrong evidence against stationarity-running sum of residuals grows substantially
Result borderline across significance levelsWeak or inconclusive evidence-consider a larger sample or the ADF Test
Note. A large p-value in the KPSS Test is genuinely good news for stationarity-this is the mirror image of the ADF Test, where a small p-value is the reassuring result. Mixing up the two tests' directions is one of the most common errors analysts make when reading combined ADF/KPSS output; see Common Misconceptions.

Checking Assumptions in Practice

  • Plot the series first: a simple line plot over time tells you a lot before running the test-tight oscillation around a fixed level suggests stationarity, while visible drift or wandering suggests a unit root, matching the patterns in Worked Example 1 and Worked Example 2.
  • Choose the right regression variant: use the trend-stationary variant (regression='ct') if the series visibly trends over time but appears to hug that trend line, and the level-stationary variant (regression='c') if it oscillates around a fixed mean with no clear trend-the wrong choice can flip the conclusion, as covered in Critical Values and Test Variants.
  • Let the software pick the lag length, then sanity-check it: automatic selection via nlags='auto' is the standard recommendation-too few lags under-correct for autocorrelation and inflate false rejections, too many lags reduce the test's power to detect a genuine unit root.
  • Cross-check with the ADF Test: because KPSS and ADF have opposite null hypotheses, running both and checking for agreement (see KPSS vs ADF vs Phillips-Perron) gives much stronger evidence than either test alone, especially for series near the boundary.
  • Watch for structural breaks: a single sharp level shift or regime change partway through the series can make the KPSS Test falsely reject \( H_0 \), even when each segment is individually stationary-inspect the plot for breaks before trusting a "non-stationary" conclusion.

What to Do If Stationarity Is Rejected

  • Take the first difference and re-test: the single most common fix-replace \( y_t \) with \( \Delta y_t = y_t - y_{t-1} \) and re-run the KPSS Test; a large share of economic and business series become stationary after exactly one round of differencing.
  • Try the trend-stationary variant before differencing: if the rejection happened under level stationarity, re-test with regression='ct'-a series with a genuine deterministic trend can look non-stationary when tested against a flat mean but stationary once the trend itself is accounted for.
  • Consider a log transform first: for series with multiplicative growth (revenue, prices), taking logs before differencing or detrending often produces a cleaner, more stable stationary series.
  • Cross-check with the ADF Test before committing: a KPSS rejection alone can occasionally reflect a structural break rather than a true unit root-confirming with a unit root test that agrees strengthens the case for differencing.
  • Model it directly with an integrated model: ARIMA's "I" (integrated) component exists precisely to handle this-specifying the right order of differencing \( d \) lets the model work with non-stationary data without you manually differencing it first.

Advantages

  • Tests stationarity directly as the null hypothesis, giving positive confirmatory evidence rather than only the absence of evidence against a unit root.
  • Excellent complement to the ADF Test-because the two null hypotheses are reversed, agreement between them is far more convincing than either result alone.
  • Explicitly supports both level-stationary and trend-stationary variants, making it well suited to series with a genuine deterministic trend.
  • Widely implemented and reported automatically by standard software, including one-line support in statsmodels and R's tseries package.
  • The Newey-West long-run variance correction makes the test robust to a broad class of autocorrelation and heteroskedasticity patterns in the residuals.

Limitations

  • Known to over-reject the null hypothesis of stationarity in some circumstances, especially when the lag length in the long-run variance estimator is chosen too small.
  • Sensitive to structural breaks: a single level shift can cause the test to falsely reject \( H_0 \), even when the series is stationary within each regime.
  • Results can be sensitive to the choice of regression variant (level vs. trend) and the lag length-different reasonable choices can occasionally produce different conclusions.
  • Critical value tables only cover a limited range of significance levels (typically 1% to 10%), so exact p-values outside that range aren't directly available-software reports capped p-values instead.
  • Like most unit root and stationarity tests, has relatively modest power in very small samples, where the long-run variance estimate itself becomes noisy.

When NOT to Use It

  • ADF Test: use instead, or alongside, when you want a unit root as the null hypothesis rather than the alternative-particularly useful for confirming a borderline KPSS result.
  • Phillips-Perron Test: use instead when you want a unit root test (not a stationarity test) with a non-parametric correction for autocorrelation and heteroskedasticity in the errors.
  • Series with a known structural break: use a break-aware test instead of the plain KPSS Test, which can misread a level shift as a unit root.
  • Panel data with multiple series: use a panel stationarity test (e.g., Hadri's test) instead, which pools information across units for more power than running separate KPSS Tests on each series.
  • Cross-sectional data with no time ordering: don't use the KPSS Test at all if your observations have no meaningful sequence-there is no "running sum over time" for the test to work with.

KPSS vs ADF vs Phillips-Perron

17.1 KPSS Test vs ADF Test

AspectKPSS TestADF Test
Null hypothesisSeries is stationarySeries has a unit root (non-stationary)
Rejecting \( H_0 \) meansEvidence for a unit rootEvidence for stationarity
Rejection regionUpper tail-large statistics rejectLower tail-very negative statistics reject
Handles autocorrelation viaNewey-West long-run variance correctionLagged difference terms in the regression
Best practiceRun alongside ADF; agreement is stronger evidence than either aloneSame-agreement resolves the ambiguity of either test in isolation

17.2 KPSS Test vs Phillips-Perron Test

AspectKPSS TestPhillips-Perron Test
Null hypothesisStationarityUnit root (same framework as ADF)
Long-run variance correctionNewey-West, applied to the partial-sum numeratorNewey-West, applied directly to the test statistic
PurposeConfirms stationarity positivelyDetects a unit root, like ADF but without explicit lagged difference terms
Typical pairingPaired with ADF or Phillips-Perron for cross-confirmationPaired with KPSS for cross-confirmation

17.3 KPSS Test: Level vs Trend Stationarity Variants

AspectLevel Stationarity (\( \eta_\mu \))Trend Stationarity (\( \eta_\tau \))
Regression\( y_t = \alpha + e_t \)\( y_t = \alpha + \delta t + e_t \)
Appropriate whenSeries oscillates around a fixed meanSeries trends but hugs that trend line closely
Risk of misuseA genuinely trending series will falsely reject stationarityCan mask a true unit root if the trend fit absorbs too much variation

Common Misconceptions

  • "A small KPSS statistic means the series is definitely stationary." Not quite-failing to reject \( H_0 \) is consistent with stationarity, but it is not proof; like any hypothesis test, it simply means the data didn't provide strong enough evidence against the null.
  • "Rejecting \( H_0 \) in the KPSS Test is the good outcome, like in the ADF Test." Backwards-in the KPSS Test, rejecting \( H_0 \) is evidence of a unit root, the opposite of what rejecting \( H_0 \) means in the ADF Test. Mixing up the two directions is one of the most common practical errors when reading combined output; see How to Interpret Results.
  • "The KPSS Test and the ADF Test should always agree." They test opposite null hypotheses and can disagree, particularly for series that are borderline or near a unit root-this is a feature, not a bug, since agreement between the two gives more confidence than either alone, as shown in KPSS vs ADF vs Phillips-Perron.
  • "KPSS replaces the ADF Test." They are complements, not substitutes-each test has distinct blind spots that the other can catch, which is why running both together is standard practice rather than picking one.
  • "More lags in the long-run variance estimator is always safer." No-adding unnecessary lags to the Newey-West correction reduces the test's power to detect a genuine unit root that is actually present, which is why automatic bandwidth selection is generally preferred over simply maximizing the lag count.

Interview Questions

  1. Explain the null and alternative hypotheses of the KPSS Test, and why the direction is the reverse of the ADF Test.
  2. Walk through how the partial sum \( S_t \) of residuals is constructed, and explain intuitively why a growing, unbounded \( S_t \) is evidence of a unit root.
  3. What role does the Newey-West long-run variance estimator play in the KPSS statistic, and what happens if too few lags are used?
  4. Why does the KPSS Test use an upper-tail rejection region instead of a lower-tail or two-sided one?
  5. Describe a situation where the ADF Test and the KPSS Test would disagree, and explain what that disagreement suggests about the underlying series.
  6. What is the difference between the level-stationary and trend-stationary variants of the KPSS Test, and how would you decide which one to use for a given series?
  7. Why can a structural break cause the KPSS Test to falsely reject the null hypothesis of stationarity?
  8. If both the ADF Test and the KPSS Test are run on the same series and both suggest non-stationarity, what would you do next?
  9. Why is failing to reject the null hypothesis in the KPSS Test considered informative, rather than simply "no result," much like the analogous situation in the ADF Test?
  10. How does the KPSS Test relate to choosing the differencing order \( d \) in an ARIMA(\( p, d, q \)) model, compared to how the ADF Test is used for the same purpose?

Frequently Asked Questions

  • The KPSS Test checks whether a time series is stationary around a constant level or a deterministic trend, as opposed to having a unit root and drifting unpredictably like a random walk. It is a standard companion check to the ADF Test before fitting ARIMA models, running regressions on time-ordered data, or testing two series for cointegration.
  • The KPSS statistic is LM = (1/n^2) * sum of S_t^2 for t=1 to n, all divided by s^2(l), where S_t = sum of e_1 through e_t is the partial sum of residuals from regressing the series on a constant (or constant plus trend), and s^2(l) is a Newey-West long-run variance estimator with l lags used to correct for autocorrelation. Larger LM values mean the running sum of residuals is growing rather than staying bounded near zero.
  • The KPSS statistic is compared to a table of upper-tail critical values, not a symmetric two-sided threshold. If the test statistic exceeds the critical value at your chosen significance level, you reject the null hypothesis of stationarity and conclude the series likely has a unit root. If the statistic is below the critical value, you fail to reject the null, meaning the series is consistent with being stationary.
  • The null hypothesis (H0) is that the series is stationary-either around a fixed level or around a deterministic trend, depending on the regression specification chosen. The alternative hypothesis (H1) is that the series has a unit root and is non-stationary. This is the reverse framing of the ADF Test, where a unit root is the null rather than the alternative.
  • The KPSS Test treats stationarity as the null hypothesis and a unit root as the alternative, so failing to reject H0 points toward stationarity. The ADF Test flips this: a unit root is the null hypothesis and stationarity is the alternative, so failing to reject H0 points toward non-stationarity. Because the two tests can disagree, especially for series near a unit root, many analysts run both and only trust a stationarity conclusion when they agree.
  • The most common fix is to take the first difference of the series and re-run the KPSS Test on the differenced data-most economic and business series become stationary after one round of differencing. If the rejection happened under the level-stationary variant, it is also worth re-testing with the trend-stationary variant, since a series with a genuine deterministic trend can otherwise look non-stationary when tested around a flat level.
  • Most software selects the number of lags in the Newey-West long-run variance estimator automatically, commonly using a rule such as l = floor(4*(n/100)^(1/4)) or l = floor(12*(n/100)^(1/4)), and statsmodels supports an automatic bandwidth selection option as well. Choosing too few lags under-corrects for autocorrelation and inflates the rejection rate; too many lags reduce the test's power.

Key Takeaways

  • The KPSS Test checks whether a time series is stationary-either around a fixed level or a deterministic trend-by treating stationarity as the null hypothesis, the reverse of most unit root tests.
  • It works by summing the residuals from a simple regression into a running partial sum \( S_t \), then checking whether that running sum stays bounded (stationary) or grows without limit (unit root), relative to the series' long-run variance.
  • Because the KPSS statistic's distribution under \( H_0 \) is non-standard, it is compared against special Kwiatkowski-Phillips-Schmidt-Shin critical values, using an upper-tail rejection region.
  • Unlike the ADF Test, failing to reject \( H_0 \) is the outcome that supports stationarity- rejecting \( H_0 \) is direct, informative evidence of a unit root.
  • In Python, statsmodels.tsa.stattools.kpss runs the full test in one line, including automatic lag selection for the long-run variance correction.
  • If stationarity is rejected, the standard fix is to take the first difference and re-test, or re-check the trend-stationary variant, as outlined in What to Do If Stationarity Is Rejected.
  • Because KPSS and ADF test opposite null hypotheses, pairing the two and checking for agreement (see KPSS vs ADF vs Phillips-Perron) gives far more reliable evidence than either test used alone.

The KPSS Test earns its place alongside the ADF Test as one of the two most commonly reported stationarity diagnostics precisely because it approaches the question from the opposite direction. Where the ADF Test asks "can I find enough evidence that this series is not a random walk," the KPSS Test asks "can I find enough evidence that this series is a random walk"-and a series that survives both interrogations gives you far more confidence than surviving either one alone. By tracking whether the running sum of a series' own residuals stays put or wanders, the KPSS Test offers a genuinely different lens on the same underlying question, catching cases the ADF Test's low power in small samples can miss.

The two worked examples above show both directions this can go-a tightly oscillating series whose running sum of residuals never strays far from zero, and a steadily climbing series whose running sum drifts sharply before drifting back. Reporting the KPSS statistic alongside a plot of the raw series, choosing the regression variant that matches the series' visible behavior, and cross-checking borderline results with the ADF Test gives a complete and reliable picture of stationarity that neither statistic alone can fully provide.