bond_yields: Bond Yield Calculation

Description Usage Arguments Value See Also Examples

View source: R/bondpricing.R

Description

Function for the calculation of bond yields.

Usage

1
bond_yields(cashflows, m, searchint = c(-1, 1), tol = 1e-10)

Arguments

cashflows

matrix with the cashflows of the bonds, including the current dirty price.

m

maturity matrix of the bonds

searchint

search interval for root finding.

tol

desired accuracy for function uniroot.

Value

The function returns a matrix with the yields of the bonds and the associated maturities.

See Also

uniroot

Examples

1
2
3
4
data(govbonds)
cf_p <- create_cashflows_matrix(govbonds[[1]],include_price=TRUE)
m_p <- create_maturities_matrix(govbonds[[1]],include_price=TRUE)
bond_yields(cf_p,m_p)

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
                Maturity      Yield
DE0001141414  0.04383562 0.03525805
DE0001137131  0.12054795 0.03424302
DE0001141422  0.19726027 0.03798065
DE0001137149  0.36986301 0.03773425
DE0001135093  0.42739726 0.03784595
DE0001135077  0.42739726 0.03813817
DE0001137156  0.61917808 0.03760542
DE0001141430  0.69589041 0.03741182
DE0001137164  0.86849315 0.03667422
DE0001135101  0.93150685 0.03600012
DE0001137172  1.11780822 0.03604206
DE0001141448  1.21369863 0.03584180
DE0001137180  1.36712329 0.03562382
DE0001135127  1.42739726 0.03567594
DE0001135119  1.42739726 0.03561844
DE0001137198  1.61643836 0.03445107
DE0001141455  1.69315068 0.03483807
DE0001137206  1.86575342 0.03408231
DE0001135135  1.93150685 0.03460492
DE0001141463  2.19178082 0.03416641
DE0001135150  2.42739726 0.03454781
DE0001141471  2.69041096 0.03449436
DE0001135168  2.93150685 0.03503350
DE0001141489  3.18904110 0.03510814
DE0001135184  3.42739726 0.03540804
DE0001141497  3.70684932 0.03540941
DE0001135192  3.93150685 0.03573610
DE0001141505  4.20547945 0.03535706
DE0001135200  4.43013699 0.03602186
DE0001141513  4.70410959 0.03548021
DE0001135218  4.93424658 0.03577264
DE0001135234  5.43013699 0.03615551
DE0001135242  5.93424658 0.03674724
DE0001135259  6.43013699 0.03719170
DE0001135267  6.93424658 0.03758921
DE0001135283  7.43013699 0.03804338
DE0001135291  7.93424658 0.03839412
DE0001134468  8.39452055 0.03877768
DE0001135309  8.43287671 0.03874681
DE0001134492  8.64657534 0.03842981
DE0001135317  8.93698630 0.03883231
DE0001135333  9.43287671 0.03845874
DE0001135341  9.96438356 0.03857401
DE0001134922 15.93972603 0.04269650
DE0001135044 19.43835616 0.04370641
DE0001135069 19.94246575 0.04397389
DE0001135085 20.44109589 0.04400215
DE0001135143 21.94520548 0.04432294
DE0001135176 22.94520548 0.04436537
DE0001135226 26.44383562 0.04434252
DE0001135275 28.95068493 0.04424478
DE0001135325 31.44657534 0.04310960

termstrc documentation built on May 29, 2017, 1:05 p.m.