pyhctsa.operations.stationarity.kpss_test

pyhctsa.operations.stationarity.kpss_test(y, lags=0)

Performs the KPSS (Kwiatkowski-Phillips-Schmidt-Shin) stationarity test.

This implementation uses the statsmodels kpss function to test whether a time series is trend stationary. The null hypothesis is that the time series is trend stationary, while the alternative hypothesis is that it is a non-stationary unit-root process.

The test was introduced in [1]

The function can be used in two ways: 1. With a single lag value - returns basic test statistic and p-value 2. With multiple lag values - returns statistics about how the test results

change across different lags

References

Parameters:
y : ArrayLike

The input time series to analyze for stationarity

lags : Union[int, list], optional

Either:

  • A single lag value (int) to compute the test statistic and p-value

  • A list of lag values to analyze how the test results vary across lags

Default is 0.

Returns:

The KPSS test statistic and p-value of the test.

Return type:

Dict[str, float]