kpss_test#
- impulso.kpss_test(data, variables=None, *, regression='c', nlags='auto', alpha=0.05)[source]#
Kwiatkowski-Phillips-Schmidt-Shin (KPSS) stationarity test.
Runs one series at a time. The null hypothesis is that the series is stationary, so rejecting argues for a unit root — the reverse of adf_test.
The reject/no-reject decision compares the statistic against the critical value for alpha, taken from Table 1 of Kwiatkowski et al. (1992). The p-value is reported too, but is interpolated from that same table and clipped to [0.01, 0.10]; when the clip binds, pvalue_bounded is True and the figure should be read as a bound. Because the p-value is clipped, alpha is restricted to the four levels the table covers — comparing a clipped p-value against, say, 0.01 could never reject.
- Parameters:
data (VARData | DataFrame | Series) – VARData (endogenous block only), DataFrame, or Series.
variables (Sequence[str] | None) – Subset of column names to test. Defaults to all.
regression (Literal['c', 'ct']) – “c” to test stationarity around a constant, “ct” to test trend stationarity.
nlags (int | Literal['auto']) – Newey-West bandwidth for the long-run variance, or “auto” for the data-dependent rule.
alpha (float) – Significance level. Restricted to 0.10, 0.05, 0.025, or 0.01, the levels for which critical values are tabulated.
- Returns:
StationarityTestResult with one row per variable.
- Raises:
ValueError – If regression is invalid, or alpha is not a tabulated level.
- Return type: