Session Ready
Exercise

Discounting bond cash flows with a known yield

After laying out the bond's cash flows, we can now go through the steps of calculating the present value of each cash flow and value the bond. Recall that the value of the bond is the sum of the present value of its cash flows.

In this exercise, you will calculate the appropriate present value factor, pv_factor, for each cash flow, so we can calculate each cash flow's present value pv. You will then sum the pv to find the value of the bond.

Recall that this bond has a yield of 6%, which acts as the discount rate. The data frame you created in the prior exercise, cf, is present in your workspace.

Instructions
100 XP
  • Create a new column, t, in your cf data frame to indicate the year in which cash flow is received. Note that for your purposes, the year is equivalent to the name of the rows in your data frame (1, 2, 3, etc.). This means you can simply use rownames() to name t. Use as.numeric() to make sure the values of t are numeric.
  • Create another new column, pv_factor in your cf object to store each year's present value factor. Recall that each year's present value factor is calculated as 1 divided by 1 + the yield rate (in this case 6%, or 0.06) set to the power of your time variable (t).
  • Create a pv column in cf to store the present value of each year's cash flow. The present value is calculated as cash flow (cf) multiplied by the year's present value factor (pv_factor).
  • Finally, use sum() to sum the values in pv to find the value of the bond.