R/geometric.mean.R

#' Geometric mean return
#' 
#' @param r returns over multiple periods
#' @export
#' @examples
#' geometric.mean(r=c(-0.0934, 0.2345, 0.0892))
geometric.mean <- function(r){
  rs <- r + 1
  return(prod(rs)^(1/length(rs))-1)
}

Try the FinCal package in your browser

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

FinCal documentation built on May 2, 2019, 1:29 p.m.