Introductie tot tijdreeksen en stationariteit

ARIMA-modellen in Python

James Fulton

Climate informatics researcher

Motivatie

Tijdreeksen zijn overal

  • Wetenschap
  • Technologie
  • Bedrijf
  • Financiën
  • Beleid
ARIMA-modellen in Python

Cursusinhoud

Je leert

  • Opbouw van ARIMA-modellen
  • Hoe een ARIMA-model te fitten
  • Hoe het model te optimaliseren
  • Hoe te voorspellen
  • Hoe onzekerheid in voorspellingen te berekenen
ARIMA-modellen in Python

Laden en plotten

import pandas as pd
import matplotlib as plt

df = pd.read_csv('time_series.csv', index_col='date', parse_dates=True)
date            values
2019-03-11    5.734193    
2019-03-12    6.288708    
2019-03-13    5.205788    
2019-03-14    3.176578
ARIMA-modellen in Python

Trend

fig, ax = plt.subplots()
df.plot(ax=ax)
plt.show()

ARIMA-modellen in Python

Seizoenspatroon

ARIMA-modellen in Python

Cyclisch gedrag

ARIMA-modellen in Python

White noise

White noise heeft ongecorreleerde waarden

  • kop, kop, kop, munt, kop, munt, ...
  • 0.1, -0.3, 0.8, 0.4, -0.5, 0.9, ...
ARIMA-modellen in Python

Stationariteit

Stationair

  • Trend-stationair: trend is nul

Niet-stationair

ARIMA-modellen in Python

Stationariteit

Stationair

  • Trend-stationair: trend is nul
  • Variantie is constant

Niet-stationair

ARIMA-modellen in Python

Stationariteit

Stationair

  • Trend-stationair: trend is nul
  • Variantie is constant
  • Autocorrelatie is constant

Niet-stationair

ARIMA-modellen in Python

Train-test-split

# Train data - all data up to the end of 2018
df_train = df.loc[:'2018']

# Test data - all data from 2019 onwards
df_test = df.loc['2019':]
ARIMA-modellen in Python

Laten we oefenen!

ARIMA-modellen in Python

Preparing Video For Download...