R/cv.annu.fv.R

Defines functions cv.annu.fv

Documented in cv.annu.fv

##################################################################################################
### Annuity Future Value
##################################################################################################

#' @name cv.annu.fv
#' @aliases cv.annu.fv
#' @title Calculate future value of annuity
#' @description Calculate future value of an ordinary annuity or an annuity due.
#' @usage cv.annu.fv(pmt,i,n,type = 0)
#' @param pmt :the equal amount of payment of each period
#' @param i :interest rate according to the period
#' @param n :number of periods
#' @param type :type = 0 for ordinary annuity, type = 1 for annuity due
#' @examples cv.annu.fv(100,0.0248,10,0)


cv.annu.fv <- function(pmt,i,n,type = 0){

  if(type == 1){

    fv <- pmt*((((1+i)^n)-1)/i)*(1+i)
  }else{

    fv <- pmt*((((1+i)^n)-1)/i)
  }

  return(fv)
}

Try the YRmisc package in your browser

Any scripts or data that you put into this service are public.

YRmisc documentation built on March 25, 2020, 5:13 p.m.