R/ce_p.R

Defines functions ce_p

Documented in ce_p

#' Certainty Equivalent Function with Power Utility Function
#'
#' @param profit \code{data.frame} with profit values
#' @param rac scalar of RAC value
#' @param weight original wealth
#'
#' @return Scalar with the CE value
#'

ce_p <- function(profit,rac,weight=0){

  profit <- as.matrix(profit)

  if(rac == 0){

    CEpower <- mean(profit, na.rm = TRUE)

  } else {

    su      <- sum((profit + weight)^(1 - rac), na.rm = TRUE)
    CEpower <- ((su / length(profit))^(1 / (1 - rac))) - weight

  }

  return(CEpower)

}
ArielSotoCaro/ceRtainty documentation built on March 10, 2020, 6:55 a.m.