Cash Flow Analysis
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.
cf.analysis(cf,times,i,plot=FALSE,time.d=FALSE)
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 |
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}
A matrix of all of the calculated values.
The periods in t must be positive integers.
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.