R: Short Selection of Financial Mathematical Functions

NPV {DescTools} | R Documentation

## Short Selection of Financial Mathematical Functions

### Description

Calculate the one period returns, the net present value (`NPV()`), the internal rate of return (`IRR()`) of a sequence of payments. `NPVFixBond()` returns the netpresent value for a fixed-rate bond, `YTM()` the yield to maturity for a bond.

### Usage

    OPR(K, D = NULL, log = FALSE)
    NPV(i, cf, t = seq(along = cf) - 1)
    IRR(cf, t = seq(along = cf) - 1, interval = c(-1.5, 1.5), ...)

    NPVFixBond(i, Co, RV, n)
    YTM(Co, PP, RV, n)

### Arguments

`i` | the interest rate
`cf` | numeric vector with the payments
`t` | periods
`K` | the capital at time t
`D` | dividend at time t
`log` | logical, determining if the simple returns (default) or log returns are to be calculated.
`interval` | a vector containing the end-points of the interval to be searched for the root in the function `IRR`.
`Co` | coupon payments of a fixed-rate bond
`PP` | purchase price for a fixed-rate bond
`RV` | redemption value
`n` | the term of the bond, total number of periods
`...` | the dots are passed to the `UnirootAll` function in `IRR`

### Details

The one period returns are calculated as

r_t = \frac{D_t+K_t-K_t-1}{K_t-1}

### Value

a numeric value

### Author(s)

Andri Signorell <andri@signorell.net>

### See Also

`Gmean`

### Examples

    # one root
    IRR(cf <- c(-900, -250+450-90, 460-100, 500-120, 550-140))
    # several IRR solutions
    IRR(cf = c(-100, 500, -600))
    # no solution
    IRR(cf = c(-100, 400, -600))
    # negative and huge solution
    IRR(cf = c(-100, 1000, -600), interval = c(-1.5, 1000))

[Package DescTools version 0.99.36 Index]