mod_duration: Calculate the modified duration of a bond

View source: R/mod_duration.R

mod_durationR Documentation

Calculate the modified duration of a bond

Description

Calculate the modified duration of a bond

Usage

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

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.

Value

A series of modified duration


treasuryTR documentation built on April 3, 2023, 5:39 p.m.