การพยากรณ์ด้วย GARCH แบบ rolling window

GARCH Models ใน Python

Chelsea Yang

Data Science Instructor

Rolling window สำหรับการพยากรณ์นอกตัวอย่าง

หนึ่งในส่วนที่น่าตื่นเต้นของการสร้างโมเดลทางการเงิน: การทำนายสิ่งที่ยังไม่รู้

Prediction art

Rolling window forecast: ทำการฟิตโมเดลและพยากรณ์ซ้ำๆ ตามช่วงเวลาที่เลื่อนไปข้างหน้า

Rolling

GARCH Models ใน Python

การพยากรณ์แบบ expanding window

เพิ่มข้อมูลใหม่เข้าในตัวอย่างอย่างต่อเนื่อง

Expanding window forecast

GARCH Models ใน Python

เหตุผลที่ใช้การพยากรณ์แบบ rolling window

  • หลีกเลี่ยง lookback bias
  • ลดความเสี่ยงของการ overfitting
  • ปรับการพยากรณ์ให้สอดคล้องกับข้อมูลใหม่
GARCH Models ใน Python

การนำ expanding window forecast ไปใช้งาน

การพยากรณ์แบบ expanding window:

for i in range(120):
    gm_result = basic_gm.fit(first_obs = start_loc, 
                             last_obs = i + end_loc, disp = 'off')
    temp_result = gm_result.forecast(horizon = 1).variance
GARCH Models ใน Python

การพยากรณ์แบบ fixed rolling window

เพิ่มข้อมูลใหม่เข้ามา พร้อมกับนำข้อมูลเก่าออกจากตัวอย่าง

Fixed rolling window forecast

GARCH Models ใน Python

การนำ fixed rolling window forecast ไปใช้งาน

การพยากรณ์แบบ fixed rolling window:

for i in range(120):
    # Specify rolling window range for model fitting
    gm_result = basic_gm.fit(first_obs = i + start_loc, 
                             last_obs = i + end_loc, disp = 'off')
    temp_result = gm_result.forecast(horizon = 1).variance
GARCH Models ใน Python

การกำหนดขนาด window

โดยทั่วไปขึ้นอยู่กับแต่ละกรณี

  • Window size กว้างเกินไป: อาจรวมข้อมูลที่ล้าสมัย ทำให้ variance สูงขึ้น

  • Window size แคบเกินไป: อาจตัดข้อมูลที่เกี่ยวข้องออก ทำให้ bias สูงขึ้น

ขนาด window ที่เหมาะสม: ต้องสมดุลระหว่าง bias และ variance

Balancing illustration art

GARCH Models ใน Python

มาฝึกกันเถอะ!

GARCH Models ใน Python

Preparing Video For Download...