[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: Aggregate constant to scalar and local
There are partial sorting algorithms for the case
in which only selected quantiles are needed -- a
Knonical source is Knuth TAOCP volume 3
-- but I do not know if -_pctile- uses them.
> 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: