Re: [R] Percentiles for unequal probability sample

2013-11-21 Thread Thomas Lumley
On Thu, Nov 21, 2013 at 8:35 AM, Trevor Walker wrote: > I often work with tree data that is sampled with probability proportional > to size, which presents a special challenge when describing the frequency > distribution. The survey package does lots of calculations (including quantiles) for un

Re: [R] Percentiles for unequal probability sample

2013-11-20 Thread Roger Koenker
You could try: require(quantreg) qs <- rq(x ~ 1, weights = w, tau = 1:3/4) Roger Koenker rkoen...@illinois.edu On Nov 20, 2013, at 4:56 PM, David Winsemius wrote: > > On Nov 20, 2013, at 11:35 AM, Trevor Walker wrote: > >> I often work with tree data that is sampled with probability propo

Re: [R] Percentiles for unequal probability sample

2013-11-20 Thread David Winsemius
On Nov 20, 2013, at 11:35 AM, Trevor Walker wrote: > I often work with tree data that is sampled with probability proportional > to size, which presents a special challenge when describing the frequency > distribution. For example, R functions like quantile() and fitdistr() > expect each observa

Re: [R] Percentiles for unequal probability sample

2013-11-20 Thread Adams, Jean
Rather than "exploding", I suggest you order your data according to tree diameter, then calculate the cumulative sum of the tree densities, and use linear interpolation to estimate the percentiles. For example ... library(plotrix) attach(trees.df) ord <- order(Diameter) CumDensOrdScaled <- resc

[R] Percentiles for unequal probability sample

2013-11-20 Thread Trevor Walker
I often work with tree data that is sampled with probability proportional to size, which presents a special challenge when describing the frequency distribution. For example, R functions like quantile() and fitdistr() expect each observation to have equal sample probability. As a workaround, I ha