R/r.med.R

Defines functions r.med

Documented in r.med

r.med <-
function(x, weight, k){
  n <- length(x)
  if (is.null(weight)) weight <- rep(1, n)
  
    rhow <- k*weighted.median(x, weight)
    gap <- sum(sapply(1:n, function(i){
      max(x[i] - rhow, 0)*weight[i]}))/sum(weight)
  return(gap)
}

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.