Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Mata and subsets...
From
Matthew Baker <[email protected]>
To
[email protected]
Subject
st: Mata and subsets...
Date
Thu, 1 Mar 2012 15:03:47 -0500
Dear Listers --
I have a question about obtaining subsets and their complements in
mata. To be clear, what I am trying to do is get a listing of both the
subsets and their corresponding complements.
For example,
mata
mm_subsets(4,2)
gives me the subsets:
1 2 3 4 5 6
+-------------------------+
1 | 1 1 1 2 2 3 |
2 | 2 3 4 3 4 4 |
+-------------------------+
But the question is: is there also an (efficient, general) way to
obtain the corresponding complements:
1 2 3 4 5 6
+-------------------------+
1 | 3 2 2 1 1 1 |
2 | 4 4 3 4 3 2 |
+-------------------------+
I'm hoping for a general method that doesn't depend upon having four
items or the two-element subsets but am baffled about how to do this
without looping, etc.
Thanks in advance!
Matt Baker
--
Dr. Matthew J. Baker
Department of Economics
Hunter College and the Graduate Center, CUNY
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/