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

st: RE: combinatorics

From   "Nick Cox" <>
To   <>
Subject   st: RE: combinatorics
Date   Wed, 17 Aug 2005 20:33:42 +0100

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

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). 


James Muller
> Does anybody know of a package that generates permutations and 
> combinations? That is, the actual ordered/unordered sets of 
> combinations 
> or permutations of elements from a set.
> I wrote a little package that does this for the set {1,2,...,n} a few 
> months ago, and just want to check that there isn't already something 
> equivalent out there.
> Also, does anybody have a wishlist of combinatoric operations 
> that they would like to see in Stata, other than for the generation of 
> the above sequences?

*   For searches and help try:

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