I don't think your question is really well-formed ("Can Stata handle
the latter situation?"), as I don't understand exactly what you want
here, and you are ignoring the symmetry (i.e. what's the difference in
switching the first obs vs switching both the second and third?) in
various permutations you want to claim are distinct (which is at least
going to prolong computing time). But let's assume you want to do
something to each of 2^_N different versions of a dataset with two
variables s1 and s2, depending on whether or not each observation has
the original s1 and s2 or the two values reversed. Then you could
loop over the numbers from 1 to 2^_N and toggle each observation iff
the binary representation of the current index has a one in that
place. Note that 30 obs would imply executing your code a billion
times, and 40 obs would mean looping a trillion times. There is
almost certainly a better way by rethinking your problem a bit to
eliminate redundant calculations, and then framing everything in terms
of matrices, and programming the solution in Mata.
On 2/6/06, Raphael Fraser <[email protected]> wrote:
> I have two samples:
> s1 s2
> 20 18
> 30 60
> 40 61
> I want to rearrange the labels with some restrictions using Stata. If
> the labels were exchangeable and we want to test for a difference in
> the two samples there would be 20 possible rearrangements or
> permutations using say the sum of s1 as our test statistic. However,
> If one wanted to restrict the first label to 20 or 18, the second to
> 30 or 60 and the third to 40 or 61 we now end up with 2^3=8 possible
> rearrangements. Can Stata handle the latter situation?
*
* 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/