Crypto stationarity checks use ADF and KPSS to examine different hypotheses about a chosen time series. ADF starts from a unit-root null; KPSS starts from level or trend stationarity. Use them together with matching deterministic terms, declared lag rules and a fixed decision threshold. Agreement supports a modeling choice, while disagreement or two failures to reject call for further diagnosis. Neither result establishes a tradable mean-reversion edge.
An hourly closing price, an hourly return and a funding-rate series are different statistical objects. A stationarity result belongs to the exact input, observation frequency and historical window tested. It cannot be transferred to another variable just because both came from the same crypto market.
Decide which kind of stability matters
For weak stationarity, the mean and finite variance remain constant, and covariance depends on the distance between observations rather than their calendar dates. The NIST stationarity guidance describes the practical requirement as stable mean, variance and autocorrelation structure.
A unit root is one particular source of nonstationarity. In a simple random walk, shocks accumulate rather than decaying toward a fixed reference level. Rejecting that model does not establish that variance, every distributional feature or an economic relationship remains stable.
Conversely, volatility clustering alone need not rule out a stationary process: conditional volatility can vary while the unconditional distribution remains stable. ADF and KPSS are not general certificates covering every form of instability.
Record whether the target is price, log price, return or a separately defined spread. A rolling z-score can make a drifting input look centered because its reference mean keeps moving. Standardization does not settle the stationarity question.
ADF and KPSS start from opposite nulls
The statsmodels ADF documentation specifies a unit-root null and a no-unit-root alternative. The KPSS documentation instead specifies stationarity around a constant or deterministic trend as its null.
| Test | Starting hypothesis | Meaning of rejection |
|---|---|---|
| Augmented Dickey–Fuller, ADF | The series has a unit root | Evidence against that unit-root specification |
| Kwiatkowski–Phillips–Schmidt–Shin, KPSS | The series is level or trend stationary | Evidence against that stationarity specification |
At a predeclared 5% significance level, a sufficiently small p-value rejects the corresponding null. Therefore, the favorable direction for a stationarity interpretation is a small ADF p-value alongside a sufficiently large KPSS p-value. Saying that a series “passed both tests” hides this reversal.
Failure to reject is a statement about insufficient evidence against the specified null, not proof that it is true. A p-value of 0.03 also does not mean a 97% probability that the series is stationary.
Match the level or trend specification
In statsmodels, regression='c' includes a constant in ADF and tests level stationarity in KPSS. The regression='ct' setting includes a constant and linear trend in ADF and tests trend stationarity in KPSS. State the intended deterministic terms before examining the resulting p-values.
Trend stationarity means fluctuations can be stationary after removing a deterministic trend. It does not make the unadjusted series stationary around a fixed mean. Using ADF with a trend and KPSS with only a constant can manufacture apparent disagreement because the tests allow different reference paths.
Consider the hypothetical model y[t] = 100 + 0.2 × t + u[t], where independent disturbances take −1 or +1 with equal probability. The expected level increases by 0.2 per observation, while the disturbance distribution stays fixed. One deliberately selected six-observation realization is:
| Observation t | Deterministic trend | Disturbance u[t] | Observed y[t] | First difference |
|---|---|---|---|---|
| 0 | 100.0 | −1 | 99.0 | Unavailable |
| 1 | 100.2 | +1 | 101.2 | +2.2 |
| 2 | 100.4 | −1 | 99.4 | −1.8 |
| 3 | 100.6 | +1 | 101.6 | +2.2 |
| 4 | 100.8 | −1 | 99.8 | −1.8 |
| 5 | 101.0 | +1 | 102.0 | +2.2 |
Subtracting the specified trend recovers the disturbances exactly. Differencing gives five changes, each equal to 0.2 + u[t] − u[t−1]. Those transformations answer different questions. The six rows demonstrate arithmetic, not a sufficient sample for meaningful ADF or KPSS inference; their alternating disturbances are a chosen realization, not an estimated dependence pattern.
The stationarity and differencing discussion in Forecasting: Principles and Practice distinguishes changing levels from changes between observations and warns that unnecessary differencing can introduce artificial dynamics. A logarithm likewise does not automatically eliminate a unit root. If log returns are the chosen input, conclusions concern changes in log price rather than price returning to a fixed level.
Lag counts have different jobs
ADF adds lagged differences to account for serial correlation in its regression errors. In the documented implementation, maxlag bounds the search and autolag='AIC' or 'BIC' chooses among candidate counts using that information criterion. Save the selected count and the actual regression observation count, not only the requested maximum.
KPSS uses a truncation lag in estimating long-run variance. Its nlags='auto' rule is data dependent; an explicit integer or the legacy rule is a different specification. Equal numeric lag settings across the tests do not make their corrections equivalent.
Too little allowance for dependence can distort inference; adding many terms can also leave less information for distinguishing persistent processes. Use a justified baseline and a small, predeclared sensitivity set. A conclusion that changes across reasonable settings should be reported as sensitive.
The return-autocorrelation guide covers dependence diagnostics separately. Here, their role is to examine whether the stationarity test's error treatment is plausible, rather than to turn a lag coefficient into a prediction rule.
Read all four result combinations
Use the same input window and a coherent level or trend specification for this decision table. “Stationarity” below refers to that declared specification.
| ADF at the chosen level | KPSS at the chosen level | Working interpretation | Useful next step |
|---|---|---|---|
| Reject unit root | Do not reject stationarity | Evidence is compatible with stationarity | Examine remaining diagnostics and later windows |
| Do not reject unit root | Reject stationarity | Evidence favors investigating nonstationarity | Investigate transformation, trend or a break |
| Do not reject unit root | Do not reject stationarity | The sample does not distinguish the hypotheses clearly | Examine persistence, sample span and test sensitivity |
| Reject unit root | Reject stationarity | Both simple specifications face problems | Investigate breaks, deterministic terms and model mismatch |
Neither test wins a disagreement by having the smaller p-value: the nulls and reference distributions differ. Avoid averaging their p-values or turning the pair into a numerical “stationarity score.”
For an illustrative interpretation exercise, suppose a separate 480-observation report has ADF p = 0.03 and KPSS p displayed as 0.10, with a warning that it is larger, under matching constant-only settings. These are invented report values, not calculated market results or outputs from the six-row example. At 5%, ADF rejects and KPSS does not reject, placing the report in the first row. It supports further use of a level-stationary model as a working assumption, subject to other checks.
Preserve the KPSS warning: statsmodels interpolates within tabulated p-values from 0.01 to 0.10 and returns a boundary outside that range. A warning at the upper endpoint means the underlying p-value is greater than 0.10; the printed 0.10 is not an exact estimate. The corresponding warning at the lower endpoint means less than 0.01. Record the statistic and critical values alongside the display value.
Turn an inconclusive result into a research task
First inspect the input calendar. A missing hour followed by the next available row is not necessarily one hourly step. Reject duplicate timestamps, identify unfinished observations and keep the gap policy visible using the backtest data-quality worksheet. Constant or degenerate inputs also require an explicit invalid-result state.
Then inspect plausible changes in the generating process. A venue migration, instrument-definition change or persistent level shift can make a single full-window model unsuitable. Splitting the history only where the result becomes attractive adds selection. Preserve the reason for a boundary and report the shorter samples it creates.
Where a single structural break is substantively plausible, a dedicated method may be appropriate. The documented Zivot–Andrews implementation tests for a unit root while allowing one structural break. That assumption should fit the question; it does not cover an arbitrary sequence of changing regimes.
Input construction deserves the same care. If testing a realized-volatility series, changing the return sampling interval changes the measured variable before either test runs. If a spread is estimated by regressing one price on others, investigate a cointegration procedure and its own inference rather than treating fitted residuals as an independently supplied series with ordinary ADF significance.
Save a decision record before using the result
A useful record contains the instrument and source, variable definition, interval, start and end dates, observation count, gap policy, deterministic terms, significance level, software version, lag rules, selected lags, statistics, critical values and p-value warnings. Add every sensitivity run and the resulting modeling decision.
Keep an “inconclusive” outcome available. More high-frequency rows do not automatically provide more independent information about slow mean reversion or a longer market history. A short, highly persistent sample can leave a stationary process difficult to distinguish from a unit root.
If the diagnostic helps choose among strategy candidates, retain unsuccessful choices too. The deflated Sharpe ratio guide addresses selection in reported performance; it does not transform ADF or KPSS into evidence of trading profitability. Evaluate the complete frozen procedure on later data through walk-forward testing.
Before the next run, write one sentence naming the exact series, allowed trend, lag policy and decision rule. Keep the two null hypotheses beside the outputs. That small record makes an ambiguous result actionable without turning statistical compatibility into a promise of price recovery.
