Modeldiagnostiek

ARIMA-modellen in Python

James Fulton

Climate informatics researcher

Introductie tot modeldiagnostiek

  • Hoe goed is het eindmodel?
ARIMA-modellen in Python

Residuals

ARIMA-modellen in Python

Residuals

# 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
       ...         ...
ARIMA-modellen in Python

Gemiddelde absolute fout

Hoe ver liggen de voorspellingen van de echte waarden?

mae = np.mean(np.abs(residuals))
ARIMA-modellen in Python

Diagnostische plots

Als het model goed past, zijn de residuals witte Gaussische ruis

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

ARIMA-modellen in Python

Residualplot

ARIMA-modellen in Python

Residualplot

ARIMA-modellen in Python

Histogram met geschatte dichtheid

ARIMA-modellen in Python

Normale Q-Q

ARIMA-modellen in Python

Correlogram

ARIMA-modellen in Python

Samenvattingsstatistieken

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-waarde voor de nulhypothese dat residuals niet gecorreleerd zijn
  • Prob(JB) - p-waarde voor de nulhypothese dat residuals normaal zijn
ARIMA-modellen in Python

Laten we oefenen!

ARIMA-modellen in Python

Preparing Video For Download...