Skip to contents

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.

Usage

one_permutation(x, stat_fun)

Arguments

x

An object of class CSuperSample, representing the original super sample.

stat_fun

A function to compute a statistic on the resulting CSuperSample object.

Value

The value returned by stat_fun when applied to the permuted super sample.

Details

This function performs a permutation test by:

  1. Extracting all data points from all groups

  2. Randomly shuffling the data

  3. Reassigning data to groups with the same sample sizes as the original

  4. 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.