R/pt.cmrtn.R

Defines functions pt.cmrtn

Documented in pt.cmrtn

###############################################################################################
##### cumulative return
###############################################################################################

#' @name pt.cmrtn
#' @aliases pt.cmrtn
#' @title Cumulative return
#' @description Cumulative return is the compounded return in a given period.
#' @usage pt.cmrtn(r)
#' @param r :a vector of periodic returns
#' @examples rt <- runif(12,-1,1) # generate random number to simulate returns
#' pt.cmrtn(rt)

pt.cmrtn <- function(r){

  rr <- prod(1+r) - 1

  return(rr)
}

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.