R/weighted-quantile-top.R

Defines functions weighted.quantile.top

weighted.quantile.top <- function(dat, weights, p){
  weights <- weights[order(dat)]
  n       <- length(weights)
  dat     <- sort(dat)
  q       <- sum(weights)*p
  m<- w   <-0
  for (i in n : 1){
    w <-  w+weights[i]
    if (w >= q) {m<- dat[i] ; break}
  }
  m
 }

Try the robfilter package in your browser

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

robfilter documentation built on Nov. 10, 2022, 5:41 p.m.