Exercise

# Interest-rate data

The object `zcb`

contains daily values of Canadian zero-coupon-bond yields, expressed as percentages, for the period 2006-2015. **Yields** are the key risk-factor when it comes to analysing the interest-rate risk in a portfolio of bonds or other fixed-income products.

It is not so clear what is the best way of calculating risk-factor changes for yields. It is possible to compute log-returns, provided yields are not negative, and it is also possible to calculate simple returns. To compute the simple returns of a series, use only `diff()`

instead of `diff()`

and `log()`

.

In this exercise, you will plot time series of yields for fixed times to maturity, and plot risk-factor changes for these yields. You will also plot the whole yield curve on particular dates. The `zcb`

data has been loaded into your workspace. A vector `yield_cols`

containing the names of the columns corresponding to maturities of 1, 5 and 10 years has been created. A numerical vector `maturity`

containing all the maturities in years has also been created.

Instructions

**100 XP**

- Compute the log-returns of
`zcb`

as`zcb_x`

and the simple log-returns as`zcb_x2`

. - Plot
`zcb_x`

for 1, 5 and 10-year maturities in one plot. - Plot
`zcb_x2`

for 1, 5 and 10-year maturities in one plot. - Index
`zcb`

in`plot()`

to plot the yield curve for the*first*day in`zcb`

. - Index
`zcb`

in`lines()`

to add a line to the yield curve for the*last*day in`zcb`

.