From | James Muller <[email protected]> |
To | [email protected] |
Subject | Re: st: RE: combinatorics |
Date | Thu, 18 Aug 2005 09:23:17 +1000 |
In addition to other replies, there is a -selectvars- package on SSC:
----------------------- extract from help -selectvars- produces a list of all possible n-tuples from a list of
variable names. That is, given a list of k variable names, it produces the
empty list; all possible distinct singletons (each individual variable
name); all possible distinct pairs; and so forth. Tuples are bound in " ".
As -selectvars- is intended for programming, the list is not displayed, but
left behind as a saved result.
Note that there is no checking of a possible error with even modest k:
that a full list of (at most 2^k) tuples can not be accommodated in a
macro.
------------------------
Note that -selectvars- long predates Mata. I would be interested to know if it could be speeded up. Mata or not, I have always been queasy about programs like this because I feared that someone would engender a combinatorial explosion (a genuine term in the literature).
Nick [email protected]
* * 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 |