Python으로 배우는 GARCH 모델
Chelsea Yang
Data Science Instructor
from arch import arch_model

GARCH 모델은 세 단계로 개발합니다:
모형 가정:
"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 모델