เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Minimum variance portfolio weights

A portfolio invested in two stocks is not realistic. A more realistic example is to consider an equity portfolio invested in two diversified exchange traded funds (ETFs), like an ETF invested in US stocks and an ETF invested in EU stocks. In this exercise you need to use the GARCH estimation output available as usgarchfit and eugarchfit to compute the weights of the US ETF in the minimum variance portfolio invested in the US and EU ETF using the formula Min variance weights

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

GARCH Models in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Compute the standardized US and EU returns, together with their correlation.
  • Compute the covariance and variance of the US and EU returns.
  • Compute the minimum variance weights and plot them.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Compute the standardized US and EU returns, together with their correlation 
stdusret <- residuals(usgarchfit, standardize = TRUE)
stdeuret <- ___

useucor <- as.numeric(___(___, ___))
print(useucor)

  # Compute the covariance and variance of the US and EU returns 
useucov <- ___ * sigma(___) * ___
usvar <- ___
euvar <- ___

# Compute the minimum variance weight of the US ETF in the US-EU ETF portfolio 
usweight <- (euvar - ___) / (usvar + ___ - 2 * ___)
plot(usweight)
แก้ไขและรันโค้ด