Skip to content

conditional weighted quintiles

2 messages · Ozan Bakis, David Freedman

#
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,
#
You might want to look at the 'quantreg' package, written by Roger Koenker,
in CRAN.  The associated vignette has many examples.
Abuzer Bakis wrote:
-----
David Freedman
Atlanta