Randomly shuffles all observations across groups while preserving group sample sizes, creating a new super sample under the null hypothesis of no group differences, and computes a specified statistic on the resulting permuted super sample.
one_permutation(x, stat_fun)The value returned by stat_fun when applied
to the permuted super sample.
An object of class CSuperSample,
representing the original super sample.
A function to compute a statistic
on the resulting CSuperSample object.
This function performs a permutation test by:
Extracting all data points from all groups
Randomly shuffling the data
Reassigning data to groups with the same sample sizes as the original
Computing the test statistic on the permuted data
This approach tests the null hypothesis that group labels are exchangeable, which is natural for testing whether sub-populations differ.