Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: survey median estimator

From   Clyde Schechter <>
Subject   st: RE: survey median estimator
Date   Mon, 18 Nov 2002 10:54:52 -0500

As Nick Cox points out, -egen- can't be combined with pweights.  But
-pctile- does accept pweights.  Unfortunately, -pctile- is not compatible
with -by-.  One possibility would be to hack the code of -pctile- and make
it byable--I haven't looked to see how easy or hard that would be.  

Another possibility is to loop on the values of the grouping variable
"type."   The resulting medians should be properly estimated. The standard
errors would probably be incorrect because -pctile- will not account for
the stratification and clustering--but based on the wished for model of
-egen median=median(edpct) if salquart==3, by(type)- that is probably not
of concern here.

Hope this helps.

Clyde Schechter
Dept. of Family Medicine & Community Health
Albert Einstein College of Medicine
Bronx, NY, USA

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index