Applies the Mann-Whitney rank test to samples of two populations.
Syntax
mannWhitneyUTest[(alternative[, continuity_correction])](sample_data, sample_index)
The values for both samples are in the sample_data column. If sample_index equals to 0, then the value in that row belongs to the sample of the first population. Otherwise, it belongs to the sample of the second population.
The null hypothesis is that the two populations are randomly equal. One-sided hypotheses can also be tested. This test does not assume that the data has a normal distribution.
Paramsample_data— Sample data. Integer, Float, or Decimal.sample_index— Sample index. Integer.
Paramalternative— Alternative hypothesis. (Optional; 'two-sided' is the default.) String.
'two-sided';'greater';'less'。
continuity_correction: If not 0, a continuity correction is carried on for the normal approximation of the P-value. (Optional, Default: 1.) UInt64.
Return value
A tuple with two elements:
Example
Input table:
┌─sample_data─┬─sample_index─┐ │ 10 │ 0 │ │ 11 │ 0 │ │ 12 │ 0 │ │ 1 │ 1 │ │ 2 │ 1 │ │ 3 │ 1 │ └─────────────┴──────────────┘
Search:
SELECT mannWhitneyUTest('greater')(sample_data, sample_index) FROM mww_ttest;
As a result:
┌─mannWhitneyUTest('greater')(sample_data, sample_index)─┐ │ (9,0.04042779918503192) │ └────────────────────────────────────────────────────────┘