The yield on the Moody's Baa index
In the previous chapter, you valued a bond with a $100 par value, 5% coupon rate, and 5 years to maturity. You then assumed a yield to maturity of 6% for that bond. Recall from the video that a bond's yield can be estimated by looking at the yield of comparable bonds.
In this exercise, you'll assume that the bond you valued has a Baa credit rating by Moody's and the bond will be issued on September 30, 2016. With this information, you can use the quantmod package in R to obtain the yield of the Moody's Baa index (use the ticker "DBAA" from src = "FRED") on September 30, 2016.
This exercise is part of the course
Bond Valuation and Analysis in R
Exercise instructions
- Use
library()to load thequantmodpackage. - Use
getSymbols()to obtain data on Moody's Baa index ("DBAA"). Save this data tobaa. - Identify the yield for
baaon September 30, 2016 using square brackets. Save this tobaa_yield.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Load quantmod library
# Obtain Moody's Baa index data
baa <- getSymbols("___", src = "FRED", auto.assign = FALSE)
# Identify 9/30/16 yield
baa_yield <- baa["___"]
baa_yield