Bond valuation
Duration calculation is indeed contained in termstrc
The entry is given as...
duration {termstrc}
The function calculates the Macauly duration, modified duration and
duration based weights.
Usage
duration(cf_p, m_p, y)
Arguments
cf_p cashflows matrix including the prices of the bonds.
m_p maturity matrix, the first row is filled with zeros.
y yields of the bonds.
Charles Ward
Paul DeBruicker wrote:
I thought duration varied with market interest rates, time to maturity, coupon rate and the affect of any embedded options in the bond as in the formulas cited on this page: http://en.wikipedia.org/wiki/Bond_duration Specifically the section on Macaulay duration & effective duration To the question, I know of no R packages that provide a function to calculate duration. Maybe fBonds will when released. Paul On Fri, Jun 27, 2008 at 9:48 AM, Brian G. Peterson <brian at braverock.com> wrote:
Hongchuan Xia wrote:
Does R offer any package can calculate the duration of bond?
The duration of a bond is specified in the bond issue, it is not calculated. So perhaps your question is not as clear as you might like? So, I'll guess: The R package 'termstrc' contains a number of functions for calculating metrics related to bonds such as the term structure of interest rates. It also contains some functionality which can be used to calculate the effective duration of a portfolio of bonds. Regards, - Brian
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.