[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: nchoosek in Stata?
I am trying to create a new data set by relabeling vector observations
from a treatment and a control group. I would like to include all possible
relabelings in this final data set.
To elaborate, let's say I have a matrix X that is n by k, and it contains
values for k variables for n people. I would like to create a data set that
consists of ALL possible reassignments of the vector observations to two
groups. Thus for example if I have two outcomes and two people, and let's
say my actual data looks like this:
x1 x2 treatment
1 1 1
0 0 0
I would like to get something like this:
x1 x2 treatment permutation
1 1 1 1
0 0 0 1
1 1 0 2
0 0 1 2
Is this feasible with Stata 8.2 SE? It looks to me that most of the
permutation modules I found with "findit" and Google simply assign treatment
at random, rather than generating ALL possible combinations. I realize
this may be impossible with Stata due to memory considerations, but let's
say I had a 10 vector observations with a treatment group of 5 people.
This means that there would be [10!/(5!(10-5)!)]=252 possible
permutations, counting the one that you actually observe. Is there a
clever way to do this?
I would be very grateful for any help.
Dimitriy V. Masterov
Center for Social Program Evaluation
1155 East 60th St. Room 038
Chicago, IL 60637
* For searches and help try: