I have a series with N
observation, I want to test the whole series for stationarity with KPSS. However I noticed that when run with all lags, the KPSS test always seems to return the 0.5
value, for example:
import numpy as np
from statsmodels.tsa.stattools import kpss
kpss(np.random.uniform(0,1,100), nlags=99)
(0.499999999999999,
0.04166666666666689,
99,
{'10%': 0.347, '5%': 0.463, '2.5%': 0.574, '1%': 0.739})
I'm surely missing something, my business requirement is to test the series for stationarity in the long period (meaning: the whole series) and in the short period (meaning: i.e. the latest 10 values), so I assumed to run the KPSS test with nlags=N
and nlags=10
.
Could you help me understanding what I'm getting wrong?