statsmodels / statsmodels.github.io

documentation for statsmodels - currently temporary structure and location
BSD 3-Clause "New" or "Revised" License
12 stars 9 forks source link

KPSS interpretation in stationarity_detrending_adf_kpss.ipynb #25

Closed mzietlow closed 3 years ago

mzietlow commented 3 years ago

Hi there 👋 Pretty sure this isn't the right place, but I could not find a better within decent time. I suspect there is a contradiction the interpretation of the KPSS statistics in stationarity_detrending_adf_kpss.ipynb

Claiming

  1. Results of KPSS Test:
    Test Statistic           0.669866
    p-value                  0.016285
    Lags Used                7.000000
    Critical Value (10%)     0.347000
    Critical Value (5%)      0.463000
    Critical Value (2.5%)    0.574000
    Critical Value (1%)      0.739000
    dtype: float64

    Based upon the significance level of 0.05 and the p-value of the KPSS test, the null hypothesis can not be rejected. Hence, the series is stationary as per the KPSS test. Claiming: p = 0.016 < 0.05 => not reject Ho => Series is stationary

  2. Results of KPSS Test:
    Test Statistic           0.021193
    p-value                  0.100000
    Lags Used                0.000000
    Critical Value (10%)     0.347000
    Critical Value (5%)      0.463000
    Critical Value (2.5%)    0.574000
    Critical Value (1%)      0.739000
    dtype: float64

    Based upon the p-value of KPSS test, the null hypothesis can not be rejected. Hence, the series is stationary. Claiming: p = 0.1 > 0.05 => not reject Ho => Series is stationary

In Summary:

  1. Claiming: p < 0.05 => not reject Ho => Series is stationary
  2. Claiming: p > 0.05 => not reject Ho => Series is stationary

To the best of my knowledge, 1. should reject Ho, 2. should not reject Ho. This gave me some serious headache, just learning about stationarity tests :)

I would suggest rephrasing similar to adfuller: Based upon the significance level of 0.05 and the p-value of KPSS test, there is evidence for rejecting the null hypothesis in favor of the alternative. Hence, the series is non-stationary as per the KPSS test.

bashtage commented 3 years ago

No null here is stationary, alt is non stationary, so I agree with you. Any interest in a PR to change this?

bashtage commented 3 years ago

Oh, this is the wrong place. Should be at https://github.com/statsmodels/statsmodels

bashtage commented 3 years ago

Closing here in favor of statsmodels/statsmodels#7089