Skip to content

Instantly share code, notes, and snippets.

@mvervuurt
Last active August 29, 2019 05:47
Show Gist options
  • Save mvervuurt/ec64f9a220322113bd3c6945ab055fda to your computer and use it in GitHub Desktop.
Save mvervuurt/ec64f9a220322113bd3c6945ab055fda to your computer and use it in GitHub Desktop.
Python statsmodels Time Series Tests
# Ljung-Box test for no autocorrelation
statsmodels.stats.diagnostic.acorr_ljungbox()
# Augmented Dickey-Fuller unit root test
statsmodels.tsa.stattools.adfuller()
# Kwiatkowski-Phillips-Schmidt-Shin test for stationarity.
statsmodels.tsa.stattools.kpss()
from statsmodels.tsa.stattools import ccovf,ccf,periodogram
from statsmodels.tsa.stattools import adfuller,kpss,coint,bds,q_stat,grangercausalitytests,levinson_durbin
from statsmodels.tools.eval_measures import mse, rmse, meanabs
@mvervuurt
Copy link
Author

from statsmodels.graphics.tsaplots import month_plot,quarter_plot
month_plot(df['Thousands of Passengers']);

dfq = df['Thousands of Passengers'].resample(rule='Q').mean()
quarter_plot(dfq);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment