Greetings,

I am having a problem with DescTools::Quantile
(a function computing quantiles from weighted samples):

# these sum to one
probWeights = c(
     0.0043, 0.0062, 0.0087, 0.0119, 0.0157, 0.0204, 0.0257, 0.0315, 0.0378, 
     0.0441, 0.0501, 0.0556, 0.06, 0.0632, 0.0648, 0.0648, 0.0632, 0.06, 
     0.0556, 0.0501, 0.0441, 0.0378, 0.0315, 0.0257, 0.0204, 0.0157, 0.0119, 
     0.0087, 0.0062, 0.0043
  )
  x = seq(-100,100,length.out=length(probWeights))

  qtls <- DescTools::Quantile(x, weights=probWeights, probs=c(0.1,0.9))
  
cat("\nQuantiles:\n")
  print(qtls)


Both quantiles are equal to 100!
Is this function working or am I not using it correctly? 

Michael Meyer

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to