Learn R Programming

tvm (version 0.5.2)

rate_curve: 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

Examples

Run this code
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)

Run the code above in your browser using DataLab