Calculate approximate convexity for a bond
Recall from the video that we can improve the estimate of the bond price by adding a convexity term to the duration effect. The convexity term accounts for how bowed the price/YTM curve is for the bond.
In this exercise, you will calculate the approximate convexity for a bond with $100 par value, 10% coupon, 20 years to maturity, and 10% yield to maturity when you expect a 1% change in yield and add that to the duration effect. Recall that the approximate convexity formula is
$$(P(up) + P(down) - 2 * P) / (P * \Delta y ^ 2)$$
where \(P\) is the price of the bond, \(P(up)\) is the price of the bond when yields increase, \(P(down)\) is the price of the bond when yields decrease, and \(\Delta y\) is the expected change in yield.
The objects px
, px_up
, and px_down
from the earlier exercise are preloaded in your workspace.
This exercise is part of the course
Bond Valuation and Analysis in R
Exercise instructions
- Calculate approximate convexity by incorporating the
px
,px_up
, andpx_down
objects into the formula listed above. You will also need to input an appropriate value fordy
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate approximate convexity
convexity <- (___ + ___ - 2 * ___) / (___ * (___)^2)
convexity