| mod_duration | R Documentation | 
Calculate the modified duration of a bond
mod_duration(yields, maturity, format_out = "xts")
| yields | a series of yields | 
| maturity | constant bond maturity in years | 
| format_out | xts or tibble | 
This function is normally used in combination with total_return() to compute bond total returns.
The modified duration is the interest rate sensitivity of the price of bond.
duration = \frac{1}{y_t}{z_t}^{2M}
with
z_t = 1+\frac{y_t}{2}
M is the maturity in years (e.g. 10), y_t is the yield at time t.
A series of modified duration
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.