R/r.cha.R

Defines functions r.cha

Documented in r.cha

r.cha <- function(x, weight, k, beta){
  n <- length(x)
  if (is.null(weight)) weight <- rep(1, n)
  
  rhow <- k*weighted.median(x, weight)
  ind <- ifelse(x > rhow, 1, 0)
  r.cha <- sum(((1-(rhow/(x[x>0]))^beta)*ind[x>0])*weight[x>0])/sum(weight)
  return(r.cha)
}

Try the affluenceIndex package in your browser

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

affluenceIndex documentation built on Jan. 5, 2022, 5:07 p.m.