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
.
This exercise is part of the course
Equity Valuation in R
Exercise instructions
- Extract the yield for
"2016-12-30"
fromtreas
. - Keep only the observation in the yield column.
- Convert from percentage terms to decimal terms.
Hands-on interactive exercise
Have a go at this exercise by completing this sample 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