KPSS test: p-value greater than 0.05 but test statistic is less than critical values

I am using Python Statsmodels to find out if my time series is stationary or not. My time series (after the first level shift) passed the ADF test and it suggested that the time series is stationary. However, when I run the KPSS test, I get the following results, which is confusing to me:

KPSS Statistic: 0.150119
p-value: 0.100000
Critical Values:
10%: 0.347
5%: 0.463
2.5%: 0.574
1%: 0.739


As you can see, the p-value is greater than 0.05, but the tstat is less than the critical values. the Arima ndiff also return 0, which suggest the time series is constant. Here is the code:

    for i in range(1):
result = kpss(df['key'].values)
if (result[1] < 0.05): #or (result[0] < min(list(result[3].values()))):
num_req_diff = arima.ndiffs(df['key'], test='kpss', max_d = 5)
print(num_req_diff)

else:
print('KPSS Statistic: %f' % result[0])
print('p-value: %f' % result[1])
print('Critical Values:')
for key, value in result[3].items():
print('\t%s: %.3f' % (key, value))



I tried to detrend my time series (quadratic trend, linear trend) by it does not help with the kpss test.

I appreciate it if someone please help me to understand if the result is expected or if I am doing something wrong!

The null hypothesis of the test is that the series is stationary, and you would reject the null if the computed statistic is sufficiently in the tail of the distribution under the null hypothesis. In this case, the appropriate tail is the right tail, and so in order to have more confidence that you could reject the null hypothesis, you would want to see a larger test statistic.

So when you observe a test statistic that is less than even the 10% critical value, as in your example, you know that you cannot reject the null at even the 10% significance level (and certainly not at the 5%, 2.5%, or 1% levels).

As to why the p-value is reported to be 0.1, that is just the way Statsmodels works. From the documentation:

The p-value is interpolated from Table 1 in Kwiatkowski et al. (1992), and a boundary point is returned if the test statistic is outside the table of critical values, that is, if the p-value is outside the interval (0.01, 0.1).

In your case, the statistic is lower than the lowest value recorded in the table of critical values, so the boundary p-value 0.1 is returned.

• Thank you @cfulton for the quick answer! In this case, your answer suggests that the time series is not stationary. However, the ndiff returns 0, which suggests no differencing is needed! Also, I detrended the linear and quadratic trends form the time series and I applied the moving average. Seems like at this point nothing can help me to make my time series stationary. Do you think it can be because of the limited number of data points? I have 9 month data and I am doing weekly analysis on them. Apr 7, 2021 at 1:09
• Actually, my answer suggests that the time series is stationary. The null hypothesis is that the time series is stationary, and you were not able to reject that hypothesis at even the 10% level. Apr 7, 2021 at 1:32
• Thank you very much! I was going crazy as I could not make the (already stationary data), stationary! Apr 7, 2021 at 2:22