Statalist The Stata Listserver


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

RE: st: Aggregate constant to scalar and local


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Aggregate constant to scalar and local
Date   Fri, 13 Oct 2006 14:17:31 +0100

There are partial sorting algorithms for the case
in which only selected quantiles are needed -- a
Knonical source is Knuth TAOCP volume 3 
http://www-cs-faculty.stanford.edu/~knuth/taocp.html
-- but I do not know if -_pctile- uses them. 

Nick 
n.j.cox@durham.ac.uk 

Ulrich Kohler
 
> Nick Cox wrote:
> > Uli is right. -_pctile- is faster than -summarize, detail-
> > to get the median. But, interestingly, not much: a few
> > quick experiments indicate ~10% faster. The story,
> > presumably, is that most of the work is in the sorting,
> > and the fact that -summarize, detail- calculates so much
> > more is secondary.
> 
> Hm. If I needed the median from data that is not machine 
> readable, I would 
> only sort until the half is reached, and would leave the 
> upper half unsorted. 
> If Stata did the same the speed increase could be stronger. 
> However, I guess 
> Stata is very efficient in sorting. For me, personally, it is 
> always quite a 
> burden to sort student's examinations alphabetically, for 
> example. It always 
> requires all desks and even the floor of my tiny little 
> office. Wonder if I 
> can learn something from how Stata does it. 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index