Get startedGet started for free

Bond valuation

In Chapter One, you valued a bond using a step-by-step approach. In this exercise, you will value a bond with a $100 par value, 3% coupon rate, and 8 years to maturity. You will layout the bond's cash flows and calculate the present value of each of those cash flows using the Aaa yield you obtained in the previous exercise.

The aaa_yield object is preloaded into your workspace with the value 0.0341.

This exercise is part of the course

Bond Valuation and Analysis in R

View Course

Exercise instructions

  • Create a cash flow object (cf) containing the bond's cash flows.
  • Use data.frame() to convert cf into a data frame so you can add additional variables needed for your analysis.
  • Add a time indicator (cf$t) representing years from 1 to 8 using the seq() command.
  • Calculate PV factor (cf$pv_factor) based on the Moody's Aaa yield (aaa_yield) and your time indicator (cf$t).
  • Calculate the present value of each cash flow (cf$pv) as the product of cf$cf and the PV factor (cf$pv_factor).
  • Finally, calculate the price of the bond as the sum() of the present value of each cash flow.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Layout the bond's cash flows
cf <- c(___, ___, ___, ___, ___, ___, ___, ___)

# Convert to data.frame
cf <-

# Add time indicator
cf$t <- seq(___, ___, ___)

# Calculate PV factor
cf$pv_factor <- 1 / (1 + ___)^___

# Calculate PV
cf$pv <-

# Price bond
sum(___)
Edit and Run Code