KPSS Test Calculator
Enter one ordered numeric series, choose a level- or trend-stationarity null and declare the Newey–West truncation lag. The calculator returns the KPSS statistic, long-run variance components, published critical table and bounded p-value reference without issuing a stationary, non-stationary or trading conclusion.
Enter the series and stationarity null
The series must use one observation frequency and chronological order. The declared long-run-variance lag is never optimized behind the interface.
Choose before interpreting the statistic; the null changes with this field.
Whole lags only. Version 1.0.0 uses the entered lag exactly and performs no hidden selection.
Enter 20 to 500 finite values without percent signs, oldest to newest, using one observation frequency.
KPSS reference output
Entered Stationarity and Cointegration 1.0.0.
On smaller screens, scroll horizontally to inspect the complete audit table.
| Reference level | Critical value | Test statistic | Statistic minus critical |
|---|
How the fixed-lag KPSS calculation works
KPSS statistic = η ÷ ŝ²NW
For level stationarity, Version 1.0.0 subtracts the sample mean. For trend stationarity, it fits an intercept and linear time trend and retains the fitted residuals. Their cumulative partial sums form the numerator described in the original KPSS paper.
The denominator is a Bartlett-kernel Newey–West long-run variance estimate. It begins with the residual squared sum, adds weighted residual autocovariance terms through the entered truncation lag and divides by n. The chosen lag therefore changes the statistic and must remain part of the audit trail.
The displayed p-value is linearly interpolated from the four published reference points. Outside that table, the page reports greater than 0.10 or less than 0.01 instead of pretending to know a more precise tail probability.
Worked example from the audited fixture
The audited fixture contains 48 increasing observations with local variation, selects the trend-stationarity null and declares three Newey–West lags.
- The detrended residual partial-sum numerator eta is 0.00399897 and the estimated long-run variance is 0.04712277.
- The KPSS statistic is 0.08486283. It lies below the table’s 10% reference of 0.119, so the only supported p-value display is greater than 0.10; no conclusion badge is added.
Reproduce it: select “Load audited example” above. The governed engine retains full precision and rounds only the visible interface.
How to interpret the result
- KPSS starts from a stationarity null. ADF starts from a unit-root null. Always read which proposition is under the null before comparing outputs.
- The level option removes only a constant mean. The trend option removes a fitted intercept and linear trend before the residual partial sums are calculated.
- Larger KPSS statistics sit farther into the upper tail of the selected reference table, but the calculator keeps the statistic and critical values separate from a user decision.
- The truncation lag affects the long-run variance estimate. Report it with every result rather than presenting the KPSS statistic as specification-free.
- Agreement or disagreement with an ADF result is diagnostic context, not proof. Structural breaks, short samples and poor deterministic choices can affect both procedures.
Assumptions and limits
- Enter 20 to 500 finite observations in meaningful chronological order; the page does not sort or impute them.
- The model cannot verify timestamps, equal spacing, source quality, seasonal adjustment, transformation choice or missing intervals.
- Version 1.0.0 uses only a user-declared integer truncation lag. It does not invoke the statsmodels auto or legacy lag selectors.
- The p-value is bounded by the original table range of 0.01 through 0.10 and must not be presented with false precision outside that range.
- Level and trend stationarity are different null models. Choosing after inspecting several outputs introduces unreported specification search.
- No stationary/non-stationary, unit-root, mean-reversion, strategy-validation, forecast, grade, signal, position instruction or recommendation verdict is generated.
Which time-series diagnostic answers which question?
ADF, KPSS and Engle–Granger do not produce one interchangeable stationarity score. Their null hypotheses, deterministic terms, lag roles and reference distributions differ. The comparison below keeps those choices visible before any user interprets a p-value or critical boundary.
| Diagnostic | Null hypothesis | Alternative | Reference family | Lag role |
|---|---|---|---|---|
| Augmented Dickey–Fuller | Unit root | No unit root under constant or trend choice | Lower-tail MacKinnon approximation | Fixed augmentation lag |
| KPSS | Level or trend stationarity | Unit-root component under chosen null | Published 0.01–0.10 table | Fixed Newey–West lag |
| Engle–Granger | No cointegration for Y on X | Cointegration under two-series assumptions | N=2 MacKinnon approximation | Fixed residual ADF lag |
| Ljung–Box | No residual autocorrelation through h | At least one nonzero residual autocorrelation | Chi-square approximation | Maximum lag and fitted orders |
Frequently asked questions
- The null is that the entered series is stationary around a constant level or deterministic linear trend, according to the option selected before calculation.
- KPSS starts with stationarity under the null, while ADF starts with a unit root under the null; their p-values therefore point in opposite hypothesis directions.
- Level mode subtracts the sample mean; trend mode removes an ordinary-least-squares intercept and linear time trend before partial sums are calculated.
- It sets the number of Bartlett-weighted residual autocovariances included in the long-run variance denominator and can materially change the statistic.
- Squared cumulative residual partial sums are divided by n squared, then that scaled numerator is divided by the fixed-lag long-run variance estimate.
- The original reference table is bounded, so Version 1.0.0 refuses to invent a more precise tail probability outside its published range.
- Yes. Different nulls, deterministic specifications, lag choices, sample power, structural breaks and data transformations can produce different reference patterns.
- No. It generates no stationary or non-stationary verdict, mean-reversion claim, strategy grade, forecast, signal or recommendation.
Sources and methodology
- statsmodels — KPSS — Official implementation documentation for residual construction, long-run variance and table interpolation.
- Kwiatkowski, Phillips, Schmidt and Shin (1992) — Original Journal of Econometrics paper defining the stationarity-null statistic and reference table.
Version 1.0.0 was locked after its regression statistics, reference values and example outputs were independently recomputed with statsmodels 0.14.6 and SciPy 1.13.1. The browser calculator performs local arithmetic and does not upload entered observations. Reference probabilities remain conditional on the disclosed model and data assumptions.
Compare complementary time-series diagnostics
Verify the ordered evidence before testing it
Reconcile the exact symbol, price basis, statement window, observation timestamps, timezone, sampling frequency, missing rows, spread, commission, financing, currency conversion, rollover adjustments and preprocessing before entering a series. Correct regression arithmetic cannot repair selected, misaligned or cost-inconsistent evidence.
Risk and affiliate disclosure: Leveraged forex and CFD trading can result in substantial losses. These are affiliate links, so ForexMT4Indicators.com may receive compensation if you register or trade through them, at no additional cost to you. Availability and terms vary by jurisdiction and broker entity.

