Intro tot AR-, MA- en ARMA-modellen

ARIMA-modellen in Python

James Fulton

Climate informatics researcher

AR-modellen

Autoregressief (AR) model

AR(1)-model: $$y_t = a_1 y_{t-1} + \epsilon_t$$

ARIMA-modellen in Python

AR-modellen

Autoregressief (AR) model

AR(1)-model: $$y_t = a_1 y_{t-1} + \epsilon_t$$

AR(2)-model: $$y_t = a_1 y_{t-1} + a_2 y_{t-2} + \epsilon_t$$

AR(p)-model: $$y_t = a_1 y_{t-1} + a_2 y_{t-2} + ... + a_p y_{t-p} + \epsilon_t$$

ARIMA-modellen in Python

MA-modellen

Moving average (MA) model

MA(1)-model: $$y_t = m_1 \epsilon_{t-1} + \epsilon_t$$

MA(2)-model: $$y_t = m_1 \epsilon_{t-1} + m_2 \epsilon_{t-2} + \epsilon_t$$

MA(q)-model: $$y_t = m_1 \epsilon_{t-1} + m_2 \epsilon_{t-2} + ... + m_q \epsilon_{t-q} + \epsilon_t$$

ARIMA-modellen in Python

ARMA-modellen

Autoregressieve moving-average (ARMA) modellen

  • ARMA = AR + MA

ARMA(1,1)-model: $$y_t = a_1 y_{t-1} + m_1 \epsilon_{t-1} + \epsilon_t$$

ARMA(p, q)

  • p is de orde van het AR-deel
  • q is de orde van het MA-deel
ARIMA-modellen in Python

ARMA-data maken

$$y_t = a_1 y_{t-1} + m_1 \epsilon_{t-1} + \epsilon_t$$

ARIMA-modellen in Python

ARMA-data maken

$$y_t = 0.5 y_{t-1} + 0.2 \epsilon_{t-1} + \epsilon_t$$

from statsmodels.tsa.arima_process import arma_generate_sample

ar_coefs = [1, -0.5] ma_coefs = [1, 0.2]
y = arma_generate_sample(ar_coefs, ma_coefs, nsample=100, scale=0.5)
ARIMA-modellen in Python

ARMA-data maken

$$y_t = 0.5 y_{t-1} + 0.2 \epsilon_{t-1} + \epsilon_t$$

ARIMA-modellen in Python

Een ARMA-model fitten

from statsmodels.tsa.arima.model import ARIMA

# Modelobject maken model = ARIMA(y, order=(1,0,1))
# Model fitten results = model.fit()
ARIMA-modellen in Python

Laten we oefenen!

ARIMA-modellen in Python

Preparing Video For Download...