compound {fixedincome} | R Documentation |
Compound method
Description
Computes the compounding (and discount) factor for spot rates and curves.
Usage
compound(x, t, val, ...)
discount(x, t, val, ...)
Arguments
x |
can be a |
t |
represents the term to compound. Can be a numeric, a |
val |
is the value of the spot rate to be compounded in the given term.
Can be a numeric, a |
... |
additional arguments. |
Details
For Compounding
classes the arguments t
and val
must be
provided.
For a SpotRate
class, if the t
argument is numeric,
representing the term to be compounded, the argument val
must
be a character with the units of the Term class. If otherwise t
is a Term object, val
is missing.
For SpotRateCurve
and ForwardRate
classes, that already have
terms associated, t
and val
are missing.
discount()
method is the inverse of compound: 1 / compound()
.
Value
A numeric value that represents the compounding factor for the given spot rate.
Examples
compound("simple", 2, 0.05)
compound("discrete", 2, 0.05)
compound("continuous", 2, 0.05)
spr <- spotrate(0.06, "simple", "actual/365", "actual")
compound(spr, 10, "days")
discount(spr, 10, "days")
t <- term(10, "days")
compound(spr, t)
discount(spr, t)
d1 <- Sys.Date()
d2 <- Sys.Date() + 10
compound(spr, d1, d2)
discount(spr, d1, d2)
terms <- c(1, 11, 26, 27, 28)
rates <- c(0.0719, 0.056, 0.0674, 0.0687, 0.07)
curve <- spotratecurve(rates, terms, "discrete", "actual/365", "actual")
compound(curve)
discount(curve)