Skip to main content

Nonparametric Tests

AnoFox provides 7 nonparametric test functions that make no assumptions about the underlying data distribution. The suite includes rank-based group comparisons (Mann-Whitney U for 2 groups, Kruskal-Wallis for 3+ groups), paired comparisons (Wilcoxon signed-rank), robust alternatives (Brunner-Munzel without equal variance assumption), exact testing (permutation t-test with configurable iterations up to 10,000), and full distribution comparison (energy distance, Maximum Mean Discrepancy). These tests are the correct choice when normality tests reject or when working with ordinal data, heavy-tailed distributions, or small sample sizes.

Nonparametric tests are distribution-free statistical methods that make no assumptions about the shape of the underlying data distribution. They work with ranks or permutations instead of raw values, making them robust to outliers, skewness, and non-normal data. Use these tests when normality tests reject or when working with ordinal data.


Group Comparison Tests

Mann-Whitney U Test

Test for stochastic superiority between two groups.

Parameters

ParameterTypeRequiredDefaultDescription
valueDOUBLEYes-Measurement values
group_idINTEGERYes-Group identifier (0 or 1)
optionsMAPNo-Configuration options

Options MAP:

OptionTypeDefaultDescription
alternativeVARCHARtwo_sidedtwo_sided, less, greater
correctionBOOLEANtrueApply continuity correction
confidence_levelDOUBLE0.95Confidence level

Output

FieldTypeDescription
u_statisticDOUBLEU statistic
p_valueDOUBLEp-value
z_scoreDOUBLEz approximation
effect_sizeDOUBLERank-biserial correlation

Example

SELECT anofox_stats_mann_whitney_u_agg(
value,
group_id
) as result
FROM data;

Kruskal-Wallis Test

Test whether samples originate from the same distribution across 3+ groups.

Parameters

ParameterTypeRequiredDefaultDescription
valueDOUBLEYes-Measurement values
group_idINTEGERYes-Group identifier

Output

FieldTypeDescription
h_statisticDOUBLEH statistic
p_valueDOUBLEp-value
dfBIGINTDegrees of freedom
epsilon_squaredDOUBLEEffect size

Example

SELECT anofox_stats_kruskal_wallis_agg(
value,
group_id
) as result
FROM data;

Wilcoxon Signed-Rank Test

Paired samples comparison.

Parameters

ParameterTypeRequiredDefaultDescription
value1DOUBLEYes-First measurement
value2DOUBLEYes-Paired measurement
optionsMAPNo-Configuration options

Example

SELECT anofox_stats_wilcoxon_signed_rank_agg(
value1,
value2
) as result
FROM paired_data;

Brunner-Munzel Test

Robust comparison without equal variance assumption.

Parameters

ParameterTypeRequiredDefaultDescription
valueDOUBLEYes-Measurement values
group_idINTEGERYes-Group identifier
optionsMAPNo-Configuration options

Example

SELECT anofox_stats_brunner_munzel_agg(
value,
group_id
) as result
FROM data;

Permutation t-Test

Exact test using permutation distribution.

Parameters

ParameterTypeRequiredDefaultDescription
valueDOUBLEYes-Measurement values
group_idINTEGERYes-Group identifier
optionsMAPNo-n_permutations (default: 10000)

Example

SELECT anofox_stats_permutation_t_test_agg(
value,
group_id,
MAP {'n_permutations': '10000'}
) as result
FROM data;

Distribution Comparison

Compare entire distributions.

Energy Distance

Parameters

ParameterTypeRequiredDefaultDescription
valueDOUBLEYes-Values
group_idINTEGERYes-Group identifier

Example

SELECT anofox_stats_energy_distance_agg(
value,
group_id
) as result
FROM data;

Maximum Mean Discrepancy (MMD)

Parameters

ParameterTypeRequiredDefaultDescription
valueDOUBLEYes-Values
group_idINTEGERYes-Group identifier
optionsMAPNo-Kernel settings

Example

SELECT anofox_stats_mmd_agg(
value,
group_id
) as result
FROM data;

🍪 Cookie Settings