BaşlayınÜcretsiz Başlayın

Calculate duration

In Chapter Three, you learned to use the approximate duration formula. As a refresher, the formula for approximate duration is:

$$(P(down) - P(up)) / (2 * P * \Delta y)$$

where \(P\) is the price of the bond today, \(P(up)\) is the price of the bond if yields increase, \(P(down)\) is the price of the bond if yields decrease, and \(\Delta y\) is the expected change in yield.

In this exercise, you will calculate duration. Specifically, you'll use the bondprc() function to calculate px_up and px_down.

The objects px and aaa_yield from the prior exercises are preloaded in your workspace. For this exercise, assume that the expected change in yield is an increase of 1%. As before, the coupon rate is 3% (0.03) and the time to maturity 8 years.

Bu egzersiz

Bond Valuation and Analysis in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use bondprc() to calculate the price of the bond when yields increase by 1%. Save this to px_up.
  • Use bondprc() to calculate the price of the bond when yields decrease by 1%. Save this to px_down.
  • Use px, px_up, and px_down to calculate duration with the formula above.
  • Calculate and view the percentage effect of duration on price (duration_pct_change) based on duration.
  • Calculate and view the dollar effect of duration on price (duration_dollar_change) based on duration.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Calculate bond price when yield increases
px_up <- bondprc(p = ___, r = ___, ttm = ___, y = ___)

# Calculate bond price when yield decreases
px_down <-

# Calculate duration
duration <- (___ - ___) / (2 * ___* ___)

# Calculate percentage effect of duration on price
duration_pct_change <-
duration_pct_change

# Calculate dollar effect of duration on price
duration_dollar_change <-
duration_dollar_change
Kodu Düzenle ve Çalıştır