Learn R Programming

FinancialMath (version 0.1.1)

bond: Bond Analysis

Description

Solves for the price, premium/discount, and Durations and Convexities (in terms of periods). At a specified period (t), it solves for the full and clean prices, and the write up/down amount. Also has the option to plot the convexity of the bond.

Usage

bond(f,r,c,n,i,ic=1,cf=1,t=NA,plot=FALSE)

Arguments

f
face value
r
coupon rate convertible cf times per year
c
redemption value
n
the number of coupons/periods for the bond
i
nominal interest rate convertible ic times per year
ic
interest conversion frequency per year
cf
coupon frequency- number of coupons per year
t
specified period for which the price and write up/down amount is solved for, if not NA
plot
tells whether or not to plot the convexity

Value

Details

Effective Rate of Interest: $eff.i=(1+\frac{i}{ic})^{ic}-1$

$j=(1+eff.i)^{\frac{1}{cf}}-1$

coupon $=\frac{f*r}{cf}$ (per period)

price = coupon$*{a_{\left. {\overline {\, n \,}}\! \right |j}}+c*(1+j)^{-n}$

$MAC D=\frac{\sum_{k=1}^n k*(1+j)^{-k}*coupon+n*(1+j)^{-n}*c}{price}$

$MOD D=\frac{\sum_{k=1}^n k*(1+j)^{-(k+1)}*coupon+n*(1+j)^{-(n+1)}*c}{price}$

$MAC C=\frac{\sum_{k=1}^n k^2*(1+j)^{-k}*coupon+n^2*(1+j)^{-n}*c}{price}$

$MOD C=\frac{\sum_{k=1}^n k*(k+1)*(1+j)^{-(k+2)}*coupon+n*(n+1)*(1+j)^{-(n+2)}*c}{price}$

Price (for period t):

If t is an integer: price =coupon$*{a_{\left. {\overline {\, n-t \,}}\! \right |j}}+c*(1+j)^{-(n-t)}$

If t is not an integer then $t=t^*+k$ where $t^*$ is an integer and $0

full price $=($ coupon$*{a_{\left. {\overline {\, n-t^* \,}}\! \right |j}}+c*(1+j)^{-(n-t^*)})*(1+j)^k$

clean price = full price$-k*$coupon

If price > c :

premium = price$-c$

Write-down amount (for period t) $=($coupon$-c*j)*(1+j)^{-(n-t+1)}$

If price < c :

discount $=c-$price

Write-up amount (for period t) $=(c*j-$coupon$)*(1+j)^{-(n-t+1)}$

Examples

Run this code
bond(f=100,r=.04,c=100,n=20,i=.04,ic=1,cf=1,t=1)

bond(f=100,r=.05,c=110,n=10,i=.06,ic=1,cf=2,t=5)

Run the code above in your browser using DataLab