KPSS test for stationary processes #1269

dfrusdn opened this Issue Dec 26, 2013 · 5 comments


None yet

3 participants

dfrusdn commented Dec 26, 2013

The KPSS test is used to test if a time series with a trend is stationary. I would recommend it as a feature.

It can be used on time-series where the HP filter can be applied

Here it is from matlab


Btw. unit root tests for non-stationarity e.g. ADF are already available in Python, e.g. in statsmodels.

dfrusdn commented Dec 26, 2013

I know but it is specifically used for time series with a trend. Also Breusch Godfrey test and Durbin Watson test for stationary roots.


not necessarily. It's
also valid to use it with detrended data. It's commonly used in combination with ICA on EEG or MEG data after filtering.
I think the main point that KPSS is rather confirmatory in testing the hypothesis of stationarity. From roughly scanning literature and websites. it seems ADF is often the preferred test. Also it's the one already implemented in statsmodels.Of course there is pros and cons and all depends on your data and so on.

I think what's more important in this context is whether such a statistical function should go into sklearn. Probably statsmodels or scipy would be more appropriate.


There are a large number of unit root tests and many of them don't have great performance. AFAIR, adf is the best one. IIRC, the interesting parts about KPSS or another one (?) is that it has the null and alternative hypothesis reversed compared to adf.

I think we would like to have more unit root tests, also against breaks in trend and panel unit root tests. However, since we have adf, I don't think it has very high priority.

PR welcome

dfrusdn commented Dec 27, 2013

I think another unit root test can be use to cross validate. Other than that I do not think it is a high priority

@dfrusdn dfrusdn closed this Dec 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment