Two tests facing each other: the Augmented Dickey–Fuller test takes a unit root as the null (hard to reject in small samples), while KPSS takes stationarity as the null. When both agree — reject unit root, keep stationarity — the evidence is strong; when both fail to reject, your sample is probably too small or the series is fractionally integrated.
ADF lags can be chosen by AIC over Schwert's maximum; the deterministic terms matter — a trending series needs constant + trend or the test answers a different question. Critical values are MacKinnon's (2010) asymptotic table for the ADF t statistic and Kwiatkowski–Phillips–Schmidt–Shin (1992) for KPSS, read directly from the statsmodels reference implementation rather than a textbook reprint.
Frequently asked questions
What do I do with a unit root?
Difference the series (that is the d in ARIMA) and test again. Most economic and financial series are I(1): one difference makes them stationary.
Why does KPSS lag matter so much?
The long-run variance in the denominator is estimated with Bartlett weights out to the lag; too few lags over-rejects stationarity under serial correlation. The default uses Schwert's rule.
中文说明
两个面对面的检验:增广 Dickey–Fuller 以单位根为原假设(小样本难以拒绝),KPSS 以平稳为原假设。两者一致——拒绝单位根且不拒绝平稳——证据才强;两者都不拒绝时,多半样本太小或序列分数单整。
ADF 滞后阶数可按 AIC 在 Schwert 上限内自动选择;确定性项很关键——趋势序列需要常数 + 趋势设定,否则检验回答的是另一个问题。临界值取 MacKinnon(2010)ADF t 统计量渐近表与 Kwiatkowski–Phillips–Schmidt–Shin(1992)KPSS 表,直接来自 statsmodels 参考实现而非教科书转印。
常见问题
检验出单位根怎么办?
对序列差分(即 ARIMA 里的 d)再检验。多数经济与金融序列是 I(1):差分一次即平稳。
KPSS 的滞后为什么影响这么大?
分母中的长期方差用 Bartlett 权重加权到该滞后阶估计;序列相关下滞后太少会过度拒绝平稳。默认用 Schwert 准则。