[R] conditional weighted quintiles

David Freedman 3.14david at gmail.com
Mon Jan 19 15:06:44 CET 2009


You might want to look at the 'quantreg' package, written by Roger Koenker,
in CRAN.  The associated vignette has many examples.


Abuzer Bakis wrote:
> 
> Dear All,
> 
> I am economist and working on poverty / income inequality.  I need
> descriptive
> statitics like the ratio of education expentitures between different
> income
> quintiles where each household has a different weight. After a bit of
> google search I found 'Hmisc' and 'quantreg' libraries for weighted
> quantiles.
> 
> The problem is that these packages give me only weighted quintiles; but
> what
> I need is conditional weighted quintiles. The below example illustrates
> what I mean.
> 
> x <- data.frame("id"=c(1:5),"income"=c(10,10,20,30,50),
>                 "education"=c(0,5,5,0,0),"weight"=c(3,2,3,1,1))
> x
> library(Hmisc)
> wtd.quantile(x$income,weights=x$weight)
> wtd.quantile(x$education,weights=x$weight)
> 
> I would like to see the expenditure of each quintile conditional on
> income, i.e.
> the education expenditures of the 5th quintile equal to zero.
> 
> Thanks in advance,
> -- 
> ozan bakis
>    --__--__--
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
> 
> 


-----
David Freedman
Atlanta
-- 
View this message in context: http://www.nabble.com/conditional-weighted-quintiles-tp21536671p21543626.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list