Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: is there a syntax that inverts what -centile- does?


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: is there a syntax that inverts what -centile- does?
Date   Mon, 14 Jan 2008 10:31:00 -0500

Yang Lu--
If you read the FAQ at
http://www.stata.com/support/faqs/stat/pcrank.html you would see that
this trick imposes symmetry on the extremes of the data.  Alternatives

by mi: g r=(srank-srank[1])/srank[_N] if mi==0
by mi: g r=(srank)/srank[_N] if mi==0

would have quantiles in a range [0,1-a] or [a,1] rather than [a/2,1-a/2].

On Jan 11, 2008 6:11 PM, Yang Lu <[email protected]> wrote:
> Thank you, Austin, the code is very helpful.
>
> One more question (though trivial):
> When calculating the rank, you wrote
> > by mi: g r=(srank-srank[1]/2)/srank[_N] if mi==0
> I noticed that you divided the first srank value by 2 so that the
> percentile for the first obs (with lowest bmi) won't be zero. I'm
> wondering if this is a standard formula, and if not, why can't we just
> write
> by mi: g r=srank/srank[_N] if mi==0
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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