ComeçarComece de graça

Calculate approximate duration for a bond

A useful approximation of the duration formula is called the approximate duration, which is given by $$(P(down) - P(up)) / (2 * P * \Delta y)$$

where \(P\) is the price of the bond, \(P(down)\) is the price of the bond if yield decreases, \(P(up)\) is the price of the bond if yield increases, and \(\Delta y\) is the expected change in yield.

The full duration formula is more complex. If you're interested, you can refer to the "Fixed Income" chapter of my book as a reference for that formula.

In this exercise, you will calculate the approximate duration of a bond with $100 par value, 10% coupon rate, 20 years to maturity, 10% yield to maturity, and a 1% expected change in yield. To make this calculation, use your familiar bondprc() function, which has been preloaded in the workspace.

Este exercício faz parte do curso

Bond Valuation and Analysis in R

Ver curso

Instruções do exercício

  • Use bondprc() to calculate the bond price today given 10% yield. Save this to px and then view px.
  • Use another call to bondprc() to calculate the bond price (px_up) if the yield increases by 1%.
  • Use a third call to bondprc() to calculate the bond price (px_down) if the yield decreases by 1%.
  • Use your three objects (px, px_up, px_down) to calculate the approximate duration assuming a 1% change in yields.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Calculate bond price today
px <- bondprc(p = ___, r = ___, ttm = ___, y = ___)
px

# Calculate bond price if yields increase by 1%
px_up <- 
px_up

# Calculate bond price if yields decrease by 1%
px_down <- 
px_down

# Calculate approximate duration
duration <- (___ - ___) / (___ * ___ * ___)
duration
Editar e executar o código