모형 진단

Python으로 배우는 ARIMA 모델

James Fulton

Climate informatics researcher

모형 진단 소개

  • 최종 모형은 얼마나 좋은가?
Python으로 배우는 ARIMA 모델

잔차

Python으로 배우는 ARIMA 모델

잔차

# Fit model
model = ARIMA(df, order=(p,d,q))
results = model.fit()

# Assign residuals to variable residuals = results.resid
2013-01-23    1.013129
2013-01-24    0.114055
2013-01-25    0.430698
2013-01-26   -1.247046
2013-01-27   -0.499565
       ...         ...
Python으로 배우는 ARIMA 모델

평균 절대 오차

예측이 실제 값과 얼마나 다른가요?

mae = np.mean(np.abs(residuals))
Python으로 배우는 ARIMA 모델

진단 플롯

모형이 잘 맞으면 잔차는 백색 가우시안 잡음입니다

# Create the 4 diagostics plots
results.plot_diagnostics()
plt.show()

Python으로 배우는 ARIMA 모델

잔차 플롯

Python으로 배우는 ARIMA 모델

잔차 플롯

Python으로 배우는 ARIMA 모델

히스토그램 및 추정 밀도

Python으로 배우는 ARIMA 모델

정규 Q-Q

Python으로 배우는 ARIMA 모델

상관도표

Python으로 배우는 ARIMA 모델

요약 통계

print(results.summary())
...
===================================================================================
Ljung-Box (Q):                       32.10   Jarque-Bera (JB):                 0.02
Prob(Q):                              0.81   Prob(JB):                         0.99
Heteroskedasticity (H):               1.28   Skew:                            -0.02
Prob(H) (two-sided):                  0.21   Kurtosis:                         2.98
===================================================================================
  • Prob(Q) - 잔차가 비상관이라는 귀무가설의 p-값
  • Prob(JB) - 잔차가 정규분포라는 귀무가설의 p-값
Python으로 배우는 ARIMA 모델

가슴 평생!

Python으로 배우는 ARIMA 모델

Preparing Video For Download...