-
-
Save dpbac/6ebddb3ec668a8adb92e35d666bb134f to your computer and use it in GitHub Desktop.
original from https://www.statsmodels.org/stable/examples/notebooks/generated/stationarity_detrending_adf_kpss.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from statsmodels.tsa.stattools import kpss | |
| def kpss_test(timeseries): | |
| print ('Results of KPSS Test:') | |
| kpsstest = kpss(timeseries, regression='c', nlags="auto") | |
| kpss_output = pd.Series(kpsstest[0:3], index=['Test Statistic','p-value','Lags Used']) | |
| for key,value in kpsstest[3].items(): | |
| kpss_output['Critical Value (%s)'%key] = value | |
| print (kpss_output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment