Skip to contents

Computes a permutation-based p-value for a given super sample. The statistic used for the permutation test can be specified via the stat_fun argument.

Usage

riem_anova(ss, stat_fun = log_wilks_lambda, nperm = 1000)

Arguments

ss

An object of class CSuperSample.

stat_fun

A function to compute a statistic on the CSuperSample object (default: log_wilks_lambda).

nperm

The number of permutations to generate for estimating the p-value (default: 1000).

Value

numeric A permutation-based p-value.

Details

The function computes the statistic on the observed data and compares it to the distribution of statistics computed on permuted samples. Under the null hypothesis that group labels are exchangeable, this provides an exact test (subject to Monte Carlo error).

The permutation test:

  1. Computes the test statistic on the observed data

  2. Randomly shuffles group assignments while preserving sample sizes

  3. Recomputes the test statistic on each permuted dataset

  4. Calculates the p-value as the proportion of permuted statistics that exceed the observed statistic

This approach is computationally efficient and does not require parameter estimation or synthetic data generation.