Hey Rick,

I believe the original permutation test is to generate the sampling distribution under the null hypothesis by taking all possible combinations of the samples. This data might be a bit large to do, but how would you do it in theory? Something like (I know this won't work, but just thinking out loud):

*** Concatenate the data ***;
alldat = G1 // G2;

*** Generate the labels ***;
labels = repeat(0, nrow(G1)) // repeat(1, nrow(G2));

*** Create a matrix of permuted labels. ***;
perm_labels = allperm(labels)

*** Uh oh, allperm isnt correct. It generates duplicates since the permutations is n!. ***;
*** Need something like allcomb - but that isnt really what we want either. Need to get rid of those dups ***;

*** Create a loop or something to get the mean difference. Should be a good way to vectorize this. ***;

do i = 1 to ncol(perm_labels);
mm = mean(alldat[loc(perm_labels[:,i] = 0)]) - mean(alldat[loc(perm_labels[:,i] = 1)])
end;

I'm sure you have a better working solution than this.

Thanks for your help.