# In a permutation test, is it necessary to preserve the unequal group sizes?

I think I know how the permutation test works when computing the non-parameteric empirical p-value to test for the mean difference between groups:

1. permute the labels for each group in your original data
2. compute the percentage of simulations where the simulated statistic was more extreme in the direction of the alternative hypothesis test, than observed.
3. The percentage is the permutation-based p-value.

My question is, if you have severely imbalanced labels for your groups, do you rebalance them when you permute in step #1? Why or why not?

If, for example, I have 30 examples in class A and 4 in class B, when I permute the labels can I rebalance them to have 17 in both class A and class B?

• If you "rebalance" you aren't doing a permutation. – Wayne Feb 21 '16 at 20:16