3

17.7736 17.7736 17.7638 17.7638 17.754 17.754 17.7834 17.7834 17.7834 17.7834 17.7834 17.7834 17.7834 17.7834 17.8324 17.8324 17.8324 17.852 17.9304 17.9304 17.9304 18.1166 18.1166 18.1166 18.1166 18.1166 18.1166 18.1166 18.1362 18.146 18.146 18.1656 18.1754 18.1656 18.1656 18.1656 18.1656 18.1656 18.146 18.1362 18.1362 18.1656 18.1656 18.1656 18.1264 18.1264 18.1264 18.1264 18.1264 18.1166 18.1166 18.1166 18.1166 18.1166 18.1166 18.1166 18.1166 18.1166 18.1264 18.1264 18.1264 18.1264 18.1

I think this dataset is stationary because the values very near with each other But the surprise when using the Kpss test with this code show that this is not stationary . What is the wrong please I am very confuse

# KPSS test
from statsmodels.tsa.stattools import kpss
#57358

data = pd.read_csv("C:/Users/3800.txt") #, header=0, index_col=0)

def kpss_test(data, kw):
statistic, p_value, n_lags, critical_values = kpss(data,
kw) # Format Output print(f'KPSS Statistic: {statistic}') print(f'p-value: {p_value}')

print(f'num lags: {n_lags}')

print('Critial Values:')

for key, value in critical_values.items():
    print(f'   {key} : {value}')

print(f'Result: The series is {"not " if p_value < 0.05 else ""}stationary')

kpss_test(data)

ayla
  • 177

2 Answers2

7

Have you plotted your data? I did. Does it look stationary or “almost stationary” to you?

dipetkov
  • 9,805
3

I didn’t count how many points you have, but it looks like “a lot” is a good description.

When you have “a lot” of points, hypothesis tests have the to reject small deviations from the null hypothesis, even deviations so small that they are not of any practical consequence.

This could be what you’re seeing: you’re right that the time series is just about stationary, and the formal test is catching that the time series is not quite exactly stationary.

(I’m not actually convinced that “almost stationary” applies to your time series, but if it does, the test is catching that it is almost stationary, not perfectly stationary.)

Dave
  • 62,186
  • Could you check the update please? why this difference? – ayla Sep 01 '22 at 12:15
  • @oleva It’s really not fair to answerers (or future readers) to make the question a moving target. If you have a new question (and yours is totally legitimate), please post it – Dave Sep 01 '22 at 12:38
  • Yes, that's right, I modified it, I know it is not permissible, but I asked before and did not get an answer, so I thought I would get the answer here. – ayla Sep 01 '22 at 12:51