[R] problem for wtd.quantile()

2006-03-16 Thread Jing Yang
Dear R-users, I don't know if there is a problem in wtd.quantile (from library Hmisc): x - c(1,2,3,4,5) w - c(0.5,0.4,0.3,0.2,0.1) wtd.quantile(x,weights=w) --- The output is: 0% 25% 50% 75% 100% 3.00 3.25 3.50 3.75 4.00 The

Re: [R] problem for wtd.quantile()

2006-03-16 Thread Liaw, Andy
Perhaps you're looking for this? ?wtd.quantile wtd.quantile(x,weights=w, normwt=TRUE) 0% 25% 50% 75% 100% 12235 Andy From: Jing Yang Dear R-users, I don't know if there is a problem in wtd.quantile (from library Hmisc): x -

Re: [R] problem for wtd.quantile()

2006-03-16 Thread roger koenker
Certainly an improvement, but probably not what is really wanted... I get: rq(x ~ 1, weights=w,tau = c(.01,.25,.5,.75,.99)) Call: rq(formula = x ~ 1, tau = c(0.01, 0.25, 0.5, 0.75, 0.99), weights = w) Coefficients: tau= 0.01 tau= 0.25 tau= 0.50 tau= 0.75 tau= 0.99 (Intercept)

Re: [R] problem for wtd.quantile()

2006-03-16 Thread Jing Yang
Actually, I am looking for this result: 0% 25% 50% 75% 100% 11235 --- y - c(1,1,1,1,1,2,2,2,2,3,3,3,4,4,5) quantile(y) --- Since x with weights w is equivalant to y. === At 2006-03-16, 14:34:14 you wrote: === Perhaps

Re: [R] problem for wtd.quantile()

2006-03-16 Thread Liaw, Andy
I don't know why using the fractional weights and normwt=TRUE gives that answer, but: wtd.quantile(x, 5:1) 0% 25% 50% 75% 100% 11235 Andy From: Jing Yang Actually, I am looking for this result: 0% 25% 50% 75% 100% 11235

Re: [R] problem for wtd.quantile()

2006-03-16 Thread Jing Yang
Thanks. But that's interesting. === At 2006-03-16, 15:15:49 you wrote: === I don't know why using the fractional weights and normwt=TRUE gives that answer, but: wtd.quantile(x, 5:1) 0% 25% 50% 75% 100% 11235 Andy From: Jing Yang Actually, I am looking for