Hello! I am wondering if there is a function in R that returns quantiles of a weighted sample, i.e., a set of values, each coming with a different weight. The function quantile() does that only for the case when the weights are all equal. In other words, I am looking for a quantile function that applies to a discrete distribution specified by values and their probabilities. Thanks in advance. Best, Giovanni Petris -- Giovanni Petris <GPetris at uark.edu> Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) definetti.uark.edu/~gpetris
see nabble.com/weighted-quantiles-to19864562.html#a19865869 url: econ.uiuc.edu/~roger Roger Koenker email rkoenker at uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Champaign, IL 61820 On Oct 8, 2008, at 12:37 PM, Giovanni Petris wrote:> > Hello! > > I am wondering if there is a function in R that returns quantiles of a > weighted sample, i.e., a set of values, each coming with a different > weight. The function quantile() does that only for the case when the > weights are all equal. > > In other words, I am looking for a quantile function that applies to > a discrete distribution specified by values and their probabilities. > > Thanks in advance. > > Best, > Giovanni Petris > > -- > > Giovanni Petris <GPetris at uark.edu> > Associate Professor > Department of Mathematical Sciences > University of Arkansas - Fayetteville, AR 72701 > Ph: (479) 575-6324, 575-8630 (fax) > definetti.uark.edu/~gpetris > > ______________________________________________ > R-help at r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
On Wed, 8 Oct 2008, Giovanni Petris wrote:> I am wondering if there is a function in R that returns quantiles of a > weighted sample, i.e., a set of values, each coming with a different > weight. The function quantile() does that only for the case when the > weights are all equal. > > In other words, I am looking for a quantile function that applies to > a discrete distribution specified by values and their probabilities. >There are at least two weighted quantile functions in packages: Hmisc::weighted.quantile and survey::svyquantile -thomas