Skip to contents

vasicek() is the Vasicek short rate, dr = a (b - r) dt + sigma dW; cir() the Cox-Ingersoll-Ross one, dr = a (b - r) dt + sigma sqrt(r) dW; hull_white() the Hull-White one-factor rate, fitted to an initial curve given as annually compounded spot rates by maturity or as a svensson() curve. Each is the rate of an esg().

Usage

vasicek(a, b, sigma, r0, ptr = NULL)

cir(a, b, sigma, r0, ptr = NULL)

hull_white(
  a,
  sigma,
  maturities = NULL,
  rates = NULL,
  svensson = NULL,
  ptr = NULL
)

bond_price(model, r, tau)

feller(model)

Arguments

a

The speed of mean reversion, positive.

b

The long-run mean.

sigma

The volatility, positive.

r0

The rate today (non-negative for cir()).

maturities, rates

The initial curve as annually compounded spot rates by maturity.

svensson

The initial curve as a svensson() curve, instead of maturities and rates.

model

A vasicek or cir.

r

The rate.

tau

The bonds' maturities in years.

Value

vasicek(), cir(), hull_white(): the model, with its parameters as properties. bond_price(): one price per tau. feller(): TRUE or FALSE.

Details

mean() and variance() give the rate's moments at t years, bond_price() the price of a zero-coupon bond of maturity tau when the rate is r, and feller() whether 2 a b >= sigma^2, so a CIR rate stays positive. A Hull-White model's discount_factor() and forward_rate() read its initial curve.

Examples

v <- vasicek(0.3, 0.04, 0.01, 0.02)
mean(v, 1)
#> [1] 0.02518364
variance(v, c(1, 5))
#> [1] 7.519806e-05 1.583688e-04
bond_price(v, 0.02, 5)
#> [1] 0.8629242
feller(cir(0.4, 0.03, 0.08, 0.02))
#> [1] TRUE
hw <- hull_white(0.1, 0.01, maturities = c(1, 10), rates = c(0.03, 0.04))
discount_factor(hw, 1)
#> [1] 0.9708738