CommencerCommencer gratuitement

Obtain Risk-Free Rate Data

A common proxy for the risk-free rate is the yield on US Treasury bonds. You can obtain the yield data from the Federal Reserve Electronic Database (FRED). For this exercise, we will use the yield on a 10-Year Constant Maturity Treasury security. The US Treasury data is stored in the data.frame object labeled treas, which has two variables: date and yield. Because our valuation date is the end of 2016, we need to extract the yield on December 30, 2016, which is the last trading day of 2016 and store it in the object rf.

Cet exercice fait partie du cours

Equity Valuation in R

Afficher le cours

Instructions

  • Extract the yield for "2016-12-30" from treas.
  • Keep only the observation in the yield column.
  • Convert from percentage terms to decimal terms.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Review treas
head(treas)

# Extract 2016-12-30 yield 
rf <- ___
rf

# Keep only the observation in the second column
rf_yield <- ___
rf_yield

# Convert yield to decimal terms
rf_yield_dec <- ___
rf_yield_dec
Modifier et exécuter le code