Diagnostik model

Model ARIMA di Python

James Fulton

Climate informatics researcher

Pengantar diagnostik model

  • Seberapa baik model akhir?
Model ARIMA di Python

Residual

Model ARIMA di Python

Residual

# 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
       ...         ...
Model ARIMA di Python

Rata-rata galat absolut

Seberapa jauh prediksi dari nilai aktual?

mae = np.mean(np.abs(residuals))
Model ARIMA di Python

Plot diagnostik

Jika model pas dengan baik, residual akan berupa white Gaussian noise

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

Model ARIMA di Python

Plot residual

Model ARIMA di Python

Plot residual

Model ARIMA di Python

Histogram dan kerapatan taksiran

Model ARIMA di Python

Q-Q normal

Model ARIMA di Python

Korelogram

Model ARIMA di Python

Statistik ringkas

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-value untuk hipotesis nol bahwa residual tidak berkorelasi
  • Prob(JB) - p-value untuk hipotesis nol bahwa residual berdistribusi normal
Model ARIMA di Python

Ayo berlatih!

Model ARIMA di Python

Preparing Video For Download...