powered by
duration(cashFlows, timeIds, i, k = 1, macaulay = TRUE) convexity(cashFlows, timeIds, i, k = 1)
annuity
#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