Aan de slagGa gratis aan de slag

Plotting the investment grade spread

Aside from the risk-free rate changing through time, another determinant of the corporate bond yield is the size of the credit spread, which also changes through time. One way to observe this spread is to compare the yield on the highest rated investment grade bonds (Aaa rating) and the yield on the lowest investment grade bonds (Baa rating).

The investment grade (IG) spread can be viewed as the market's perception of how risky investing in bonds is at a certain point in time. The larger the IG spread, the more compensation investors demand for investing in riskier bonds.

In this exercise, you will plot the investment grade (IG) spread from January 2006 to September 2016. The object spread contains the Aaa and Baa yields (generated using the quantmod package).

Deze oefening maakt deel uit van de cursus

Bond Valuation and Analysis in R

Cursus bekijken

Oefeninstructies

  • Examine the first and last six elements of spread using calls to head() and tail().
  • Generate a diff column within spread that is equal to the difference between Baa yields (baa) and Aaa yield (aaa), converted to percentage points (* 100).
  • Use plot() to view spread over time. Set the x argument equal to spread$date and set the y argument equal to spread$diff.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Examine first and last six elements in spread
head(___)
tail(___)

# Calculate spread$diff
spread$diff <-

# Plot spread
plot(x = ___,
     y = ___,
     type = "l",
     xlab = "Date",
     ylab = "Spread (bps)",
     col = "red",
     main = "Baa - Aaa Spread")
Code bewerken en uitvoeren