Covariance แบบไดนามิกในการปรับพอร์ตโฟลิโอให้เหมาะสม

GARCH Models ใน Python

Chelsea Yang

Data Science Instructor

Covariance คืออะไร

  • อธิบายความสัมพันธ์ระหว่างการเคลื่อนไหวของตัวแปรสองตัว
  • Covariance เป็นบวก: เคลื่อนไหวในทิศทางเดียวกัน
  • Covariance เป็นลบ: เคลื่อนไหวในทิศทางตรงข้าม

ตัวอย่าง Covariance

GARCH Models ใน Python

Dynamic Covariance ด้วย GARCH

หากผลตอบแทนของสินทรัพย์สองตัวมีค่าสหสัมพันธ์ $\rho$ และความผันผวนที่เปลี่ยนแปลงตามเวลา $\sigma_1$ และ $\sigma_2$ :

$Covariance = \rho \cdot \sigma_1 \cdot \sigma_2$

covariance =  correlation * garch_vol1 * garch_vol2
GARCH Models ใน Python

คำนวณ GARCH Covariance ใน Python

ขั้นตอนที่ 1: ฟิตโมเดล GARCH และดึงค่าความผันผวนของแต่ละชุดผลตอบแทน

# gm_eur, gm_cad are fitted GARCH models
vol_eur = gm_eur.conditional_volatility
vol_cad = gm_cad.conditional_volatility

ขั้นตอนที่ 2: คำนวณค่าคงเหลือมาตรฐาน (standardized residuals) จากโมเดล GARCH ที่ฟิตแล้ว

resid_eur = gm_eur.resid/vol_eur
resid_cad = gm_cad.resid/vol_cad
GARCH Models ใน Python

คำนวณ GARCH Covariance ใน Python (ต่อ)

ขั้นตอนที่ 3: คำนวณ $\rho$ เป็นค่าสหสัมพันธ์อย่างง่ายของ standardized residuals

corr = np.corrcoef(resid_eur, resid_cad)[0,1]

ขั้นตอนที่ 4: คำนวณ GARCH covariance โดยคูณค่าสหสัมพันธ์กับความผันผวน

covariance =  corr * vol_eur * vol_cad
GARCH Models ใน Python

ทฤษฎีพอร์ตโฟลิโอสมัยใหม่ (MPT)

  • ริเริ่มโดย Harry Markowitz ในบทความ "Portfolio Selection" (1952)
  • ใช้ประโยชน์จากผลของการกระจายความเสี่ยง
  • พอร์ตโฟลิโอที่เหมาะสมให้ผลตอบแทนสูงสุดในระดับความเสี่ยงต่ำสุด
GARCH Models ใน Python

แนวคิดเบื้องหลัง MPT

  • Variance ของพอร์ตโฟลิโอสองสินทรัพย์:

_W1$*$ Variance1 + W2$*$ Variance2 + 2$*$W1$*$W2$*$Covariance _

 

  • ผลของการกระจายความเสี่ยง:

ความเสี่ยงในพอร์ตโฟลิโอลดลงได้โดยจับคู่สินทรัพย์ที่มี covariance เป็นลบ

GARCH Models ใน Python

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

GARCH Models ใน Python

Preparing Video For Download...