R/r.fgt.R

Defines functions r.fgt

Documented in r.fgt

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

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.