R/r.fgt.sub.R

Defines functions r.fgt.sub

Documented in r.fgt.sub

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