Creates a rate curve instance

Description

Creates a rate curve instance

Usage

1
2
3
rate_curve(rates = NULL, rate_type = "zero_eff", pers = 1:length(rates),
  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")

pers

The periods the rates correspond to

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

  1. A discount factor function

  2. A rate function and a rate type from the following types: "fut", "zero_nom", "zero_eff" or "swap"

  3. A rate vector, a pers vector and a rate type as before

Examples

1
2
3
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)