calc_ytm: Yield or IRR for a Single Set of Cashflows with the Outflow

Description Usage Arguments Value See Also Examples

Description

Used in yield_cfs_single to do the actual yield calc. The equivalent of the ytm function from the NMOF manual is used to calculate the yield, with a 5% initial guess. It assumes that the first cashflow in the cf vector is negative as it is an outflow equal to the present value of the cashflows. The corresponding element in the times vector should be 0.

Usage

1
calc_ytm(cf, times, y0 = 0.05, tol = 1e-05, maxit = 1000L)

Arguments

cf

Vector of cashflow amounts (first cashflow is an outflow)

times

Vector of yearfracs (times to cashflow, first should be 0)

y0

Initial yield guess (5% default)

tol

Tolerance in the yield calculation

maxit

Maximum number of iterations

Value

Numeric value of the yield/IRR for the given cashflow amounts and yearfracs in decimal form (not percentage) (e.g. .05)

See Also

Other pricing functions: acc_int; calc_clean_px, calc_clean_px.bond, calc_clean_px.default; calc_dirty_px, calc_dirty_px.bond, calc_dirty_px.default; calc_dv01, calc_dv01.bond, calc_dv01.default, calc_risk, calc_risk.bond, calc_risk.default; calc_yield, calc_yield.bond, calc_yield.default; discount_cfs_single; risk_cfs_single; yield_cfs_single

Examples

1
2
3
cf <- c(-101, 3, 3, 3, 103)
times <- c(0, 1, 2, 3, 4)
calc_ytm(cf, times)

Tsunamical28/mdpr documentation built on May 9, 2019, 5:15 p.m.