Learn R Programming

lifecontingencies (version 1.1.10)

duration: Functions to evaluate duration and convexity

Description

These functions evaluate the duration or the convexity of a series of cash flows

Usage

duration(cashFlows, timeIds, i, k = 1, macaulay = TRUE)

convexity(cashFlows, timeIds, i, k = 1)

Arguments

cashFlows
A vector representing the cash flows amounts.
timeIds
Cash flows times
i
APR interest, i.e. nominal interest rate compounded m-thly.
k
Compounding frequency for the nominal interest rate $i$.
macaulay
Is the macaulay duration (default value) or the effective duration to be evaluated?

Value

  • A numeric value representing either the duration or the convexity of the cash flow series

Details

The Macaulay duration is defined as $\sum\limits_t^{T} \frac{t*CF_{t}\left( 1 + \frac{i}{k} \right)^{ - t*k}}{P}$, while $\sum\limits_{t}^{T} t*\left( t + \frac{1}{k} \right) * CF_t \left(1 + \frac{y}{k} \right)^{ - k*t - 2}$

References

Broverman, S.A., Mathematics of Investment and Credit (Fourth Edition), 2008, ACTEX Publications.

See Also

annuity

Examples

Run this code
#evaluate the duration of a coupon payment
cf=c(10,10,10,10,10,110)
t=c(1,2,3,4,5,6)
duration(cf, t, i=0.03)
#and the convexity

convexity(cf, t, i=0.03)

Run the code above in your browser using DataLab