Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cf.analysis

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=∑_{k=1}^n\frac{cf_k}{(1+i)^{times_k}}

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

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

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

MOD C=\frac{∑_{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

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)

FinancialMath

Financial Mathematics for Actuaries

v0.1.1
GPL-2
Authors
Kameron Penn [aut, cre], Jack Schmidt [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.