R/pt.annrtn.R

Defines functions pt.annrtn

Documented in pt.annrtn

###############################################################################################
##### Annualized return
###############################################################################################

#' @name pt.annrtn
#' @aliases pt.annrtn
#' @title Annualized return
#' @description This function takes a series of annual returns and calculate the annualized return.
#' @usage pt.annrtn(r,n)
#' @param r :annual returns
#' @param n :number of years
#' @examples r <- runif(100,-1,1) # generate random number to simulate returns
#' annualizedreturn <- pt.annrtn(r,100)

pt.annrtn <- function(r,n){

  po <- 1/n

  art <- prod(1+r)^po - 1

  return(art)
}

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.