Python으로 배우는 ARIMA 모델
James Fulton
Climate informatics researcher
계절 ARIMA = SARIMA
SARIMA(p,d,q)(P,D,Q)$_S$
ARIMA(2,0,1) 모형: $$y_t = a_1 y_{t-1} + a_2 y_{t-2} + m_1 \epsilon_{t-1} + \epsilon_t$$
SARIMA(0,0,0)(2,0,1)$_7$ 모형: $$y_t = a_7 y_{t-7} + a_{14} y_{t-14} + m_7 \epsilon_{t-7} + \epsilon_t$$
# Imports statsmodels.tsa.statespace.sarimax import SARIMAX# Instantiate model model = SARIMAX(df, order=(p,d,q), seasonal_order=(P,D,Q,S))# Fit model results = model.fit()
한 시즌 전 값을 빼서 계절 차분을 합니다
$$\Delta y_t = y_t - y_{t-S}$$
# Take the seasonal difference
df_diff = df.diff(S)
시계열
1차 차분 시계열
1차 차분 + 계절 1차 차분 시계열


# Create figure
fig, (ax1, ax2) = plt.subplots(2,1)
# Plot seasonal ACF
plot_acf(df_diff, lags=[12,24,36,48,60,72], ax=ax1)
# Plot seasonal PACF
plot_pacf(df_diff, lags=[12,24,36,48,60,72], ax=ax2)
plt.show()
Python으로 배우는 ARIMA 모델