Library: | finance |
See also: | american asset bitree bs1 european stocksim |
Quantlet: | cir | |
Description: | computes and displays the bond yield curve by using the model of Cox/Ingersoll/Ross (1985) |
Usage: | {z,ylim}=cir() or {z,ylim}=cir(k,mu,sigma,tau,sr {,display}) | |
Input: | ||
k | scalar, reversion rate | |
mu | scalar, steady state of the short rate | |
sigma | scalar, volatility coefficient | |
tau | scalar, time horizon in years | |
sr | scalar, today's short rate | |
display | optional text; if "no" is specified, no graph will be displayed | |
Output: | ||
z | n x 3 matrix, where the first column represents the time to maturity, the second column contains the bond prices, and the third column the bond yields | |
ylim | scalar, limit of yields for increasing maturity |
library("finance") cir()
Opens an interactive menu where you are asked to enter the details of your bond. Additionally the corresponding yield curve is displayed.
library("finance") k = 0.1 mu = 0.1 sigma = 0.1 tau = 10 sr = 0.1 a=cir(k, mu, sigma, tau, sr) a
Contents of a.z [ 1,] 1 0.90498 0.099846 [ 2,] 2 0.81967 0.099429 [ 3,] 3 0.74346 0.098813 [ 4,] 4 0.67556 0.098054 [ 5,] 5 0.61509 0.097197 [ 6,] 6 0.5612 0.09628 [ 7,] 7 0.51307 0.095333 [ 8,] 8 0.46999 0.094379 [ 9,] 9 0.43131 0.093436 [10,] 10 0.39647 0.092515 Contents of a.ylim [1,] 0.073205 Additionally a graph displaying the simulated yield curve as a blue solid line and the limit of yields as a red dashed line is shown.