Time-Series Diagnostics

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.

Opposite null made explicitNewey–West lag declaredP-value bounds visible

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.

Entered

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 boundary: The null is stationarity around the selected constant level or deterministic linear trend. This is the opposite null direction from ADF, so the two p-value references cannot be read as interchangeable scores.

KPSS reference output

Entered Stationarity and Cointegration 1.0.0.

Derived
Choose the null and enter a seriesThe result will expose the residual basis, partial-sum numerator, long-run variance, table p-value range and four critical references.

How the fixed-lag KPSS calculation works

η = Σt=1..nSt² ÷ n²
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.

  1. The detrended residual partial-sum numerator eta is 0.00399897 and the estimated long-run variance is 0.04712277.
  2. 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.

Comparison of nulls, alternatives, reference families and lag roles
DiagnosticNull hypothesisAlternativeReference familyLag role
Augmented Dickey–FullerUnit rootNo unit root under constant or trend choiceLower-tail MacKinnon approximationFixed augmentation lag
KPSSLevel or trend stationarityUnit-root component under chosen nullPublished 0.01–0.10 tableFixed Newey–West lag
Engle–GrangerNo cointegration for Y on XCointegration under two-series assumptionsN=2 MacKinnon approximationFixed residual ADF lag
Ljung–BoxNo residual autocorrelation through hAt least one nonzero residual autocorrelationChi-square approximationMaximum 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

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.

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.

XM

Review applicable statements, symbol specifications and execution terms.

Check XM terms

FBS

Confirm account-history and trading-cost conventions for your region.

Check FBS terms

FXOpen

Verify statement, charge and execution records before deriving inputs.

Check FXOpen terms

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.

Disclaimer: The results from this tool are estimates for educational and informational purposes only and may differ from your broker's figures. This is not financial or investment advice. Trading forex and CFDs carries a high level of risk and can result in the loss of all your capital. Always verify calculations with your broker and trade within your risk tolerance.