Skip to contents

Shuffles the combined samples n_permutations times to construct the null distribution of the chosen test statistic. coin's coin::oneway_test(distribution = "approximate") implements the same test with a Monte-Carlo null; it is delegated to when coin is installed and statistic is the default "mean_diff" (the rmorie API allows arbitrary f(g1, g2) which coin does not expose, so a custom statistic falls back to the inline shuffle loop). The inline path keeps the full null distribution which downstream MRM code consumes.

Usage

permutation_test(
  group1,
  group2,
  statistic = "mean_diff",
  n_permutations = 9999L,
  alternative = "two-sided",
  seed = 42L
)

Arguments

group1, group2

Numeric vectors.

statistic

Either "mean_diff", "median_diff", "t_stat", or a function f(g1, g2) -> scalar.

n_permutations

Number of permutations.

alternative

"two-sided", "greater", or "less".

seed

Random seed.

Value

A morie_permutation_test_result.