Pythonで学ぶGARCHモデル
Chelsea Yang
Data Science Instructor
from arch import arch_model

GARCHモデルは次の3ステップで実装:
【モデルの前提】
"normal"(既定)、"t"、"skewt""constant"(既定)、"zero"、"AR""GARCH"(既定)、"ARCH"、"EGARCH"
basic_gm = arch_model(sp_data['Return'], p = 1, q = 1,
mean = 'constant', vol = 'GARCH', dist = 'normal')
nイテレーションごとに適合出力を表示:
gm_result = gm_model.fit(update_freq = 4)

表示をオフにする:
gm_result = gm_model.fit(disp = 'off')
「最尤法」で推定
print(gm_result.params)
mu 0.077239
omega 0.039587
alpha[1] 0.167963
beta[1] 0.786467
Name: params, dtype: float64
print(gm_result.summary())

gm_result.plot()

# 5期先まで予測
gm_forecast = gm_result.forecast(horizon = 5)
# 分散予測の最終行を表示
print(gm_forecast.variance[-1:])
h.1 h.2 h.3 h.4 h.5
Date
2019-10-10 0.994079 0.988366 0.982913 0.977708 0.972741
「2019-10-10」の h.1:その日までのデータで行った1期先予測
Pythonで学ぶGARCHモデル