Learn R Programming

treasuryTR (version 0.1.6)

mod_duration: Calculate the modified duration of a bond

Description

Calculate the modified duration of a bond

Usage

mod_duration(yields, maturity, format_out = "xts")

Value

A series of modified duration

Arguments

yields

a series of yields

maturity

constant bond maturity in years

format_out

xts or tibble

Details

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\).