Week9
pandas
pd.to_datetime
pd.DataFrame
pd.DataFrame.set_index
Rolling values
timeseries.rolling_mean(window=k,center=False)
timeseries.rolling_std(window=k, center=False)
Stationary TS data
mean is not function of time
variance is not function of time
covariance of ith and i+m are not function of time
How to check
Plotting Rolling Statistics
Dickey-Fuller Test
from statsmodels.tsa.stattools import adfuller results=adfuller(TS data)
Correlation Functions
AutoCorrelation Function (ACF) [TS and lagged TS correlation]
Partial AutoCorrelation Function (PACF)
CrossCorrelation Function (CCF) self-similarity between two timeseries
from statsmodels.tsa.stattools import acf
from statsmodels.tsa.stattools import pacf
from statsmodels.tsa.stattools import ccf
lag_acf=acf(ts, nlags=NL)
lag_pacf=pacf(ts, nlags=NL)
lag_ccf=ccf(ts1,ts2)
ARIMA: Auto-Regressive Integrated Moving Average
http://people.duke.edu/~rnau/Slides_on_ARIMA_models--Robert_Nau.pdf
Differencing: remove changes in the level of a TS, eliminting trend and consequently stabilizing the mean
yt=yt-y(t-1)
ARMA
ARIMA--integrated: be differenced
ARIMA(p,d,q)
import statsmodels.tsa.stattools as tsast
from statmodels.tsa.arima_model import ARIMA
model=ARIMA(series, order(p,d,q))
model_fit=model.fit()
output=model_fit.forecast()
Last updated
Was this helpful?