rate_curve {tvm} | R Documentation |
Creates a rate curve instance
Description
Creates a rate curve instance
Usage
rate_curve(
rates = NULL,
rate_type = "zero_eff",
pers = 1:length(rates),
rate_scale = 1,
fun_d = NULL,
fun_r = NULL,
knots = seq.int(from = 1, to = max(pers), by = 1),
functor = function(x, y) splinefun(x = x, y = y, method = "monoH.FC")
)
Arguments
rates |
A rate vector |
rate_type |
The rate type. Must be on of c("fut", "zero_nom", "zero_eff", "swap", "zero_cont) |
pers |
The periods the rates correspond to |
rate_scale |
In how many periods is the rate expressed. For example, when measuring periods in days, and using annual rates, you should use 365. When measuring periods in months, and using annual rates, you should use 12. If no scaling, use 1. |
fun_d |
A discount factor function. fun_d(x) returns the discount factor for time x, vectorized on x |
fun_r |
A rate function. fun_r(x) returns the EPR for time x, vectorized on x |
knots |
The nodes used to bootstrap the rates. This is a mandatory argument if a rate function or discount function is provided |
functor |
A function with parameters x and y, that returns a function used to interpolate |
Note
Currently a rate curve can only be built from one of the following sources
A discount factor function
A rate function and a rate type from the following types: "fut", "zero_nom", "zero_eff", "swap" or "zero_cont
A rate vector, a pers vector and a rate type as before
Examples
rate_curve(rates = c(0.1, 0.2, 0.3), rate_type = "zero_eff")
rate_curve(fun_r = function(x) rep_len(0.1, length(x)), rate_type = "swap", knots = 1:12)
rate_curve(fun_d = function(x) 1 / (1 + x), knots = 1:12)