Lets imagine we have 2 classes (A and B), with 2 samples in each class, like so:
A A B B
1 2 3 4
I want to generate all possible unique permutations where the new class groups are mixtures of the old, to calculate new statistics. In this case, we would get:
A A B B
1 3 2 4
1 4 2 3
Any other permutation, when doing a t-test (or ANOVA, etc) between classes A and B will give the same results as the original ordering, and I don’t want it. Is there a simple way to do this using R?
I can imagine generating all permutations of the original index vector, doing splits on the sample class for each permutation, and then checking if that combination of sample classes already exists or not, and if not updating the list of permutations, and going to the next permutation, and so on and so on. I just wanted to check if there was some way to do this using the permute package, or another package function in R.
Found the answer. The
partitionspackage has some great tools for working with these kinds of permutations of sets or partitionsFor the example above, where we have 2 items in two partitions, one would simply do:
This returns