cf.analysis {FinancialMath}R Documentation

Cash Flow Analysis

Description

Calculates the present value, macaulay duration and convexity, and modified duration and convexity for given cash flows. It also plots the convexity and time diagram of the cash flows.

Usage

cf.analysis(cf,times,i,plot=FALSE,time.d=FALSE)

Arguments

cf

vector of cash flows

times

vector of the periods for each cash flow

i

interest rate per period

plot

tells whether or not to plot the convexity

time.d

tells whether or not to plot the time diagram of the cash flows

Details

pv=\sum_{k=1}^n\frac{cf_k}{(1+i)^{times_k}}

MAC D=\frac{\sum_{k=1}^n times_k*(1+i)^{-times_k}*cf_k}{pv}

MOD D=\frac{\sum_{k=1}^n times_k*(1+i)^{-(times_k+1)}*cf_k}{pv}

MAC C=\frac{\sum_{k=1}^n {times_k}^2*(1+i)^{-times_k}*cf_k}{pv}

MOD C=\frac{\sum_{k=1}^n times_k*(times_k+1)*(1+i)^{-(times_k+2)}*cf_k}{pv}

Value

A matrix of all of the calculated values.

Note

The periods in t must be positive integers.

See Also

TVM

Examples

cf.analysis(cf=c(1,1,101),times=c(1,2,3),i=.04,time.d=TRUE)

cf.analysis(cf=c(5,1,5,45,5),times=c(5,4,6,7,5),i=.06,plot=TRUE)

[Package FinancialMath version 0.1.1 Index]