ClickHouse/docs/en/sql-reference/aggregate-functions/reference/mannwhitneyutest.md
lehasm 363aefb42e
DOCSUP-3908: mannWitneyUTest, welchTTest and studentTTest documentation (#19784)
* studentTTest function description

* welchttest description, links in studentttest

* mannWhitneyUTest description

* Text changed slightly

* Text changed slightly

* Text changed slightly

* Text changed slightly

* - First header is first level.
- sample_index type set to UInt64.
- Return values renamed.

- mannWhitneyUTest:
  - added continuity_correction parameter
  - optional parameters wrapped in braces [ ]
  - description refactored
  - example SQL placed on single line

* Improved formulations (hopefully)
General data type names used (Integer, Float, Decimal)
Removed names from return values

* Fixes

* Optional parameters stated explicitly

* New line at the end of files

* Russian function description

* Files moved in the right folder

* Translated 'Original article' to russian

* Typos are fixed

* fixed alowed parameter value: "two sided" -> "two-sided"
* duplicate word "require" is removed from exception messages

* mannWhitneyUTest description changed
Added Tuple link in return values
"samples from two populations" added in short descriptions

* Russian translation updated

* fix

Co-authored-by: Alexey Smirnov <alexey-sm@yandex-team.ru>
2021-02-08 15:58:27 +03:00

2.7 KiB
Raw Blame History

toc_priority toc_title
310 mannWhitneyUTest

mannWhitneyUTest

Applies the Mann-Whitney rank test to samples from two populations.

Syntax

mannWhitneyUTest[(alternative[, continuity_correction])](sample_data, sample_index)

Values of both samples are in the sample_data column. If sample_index equals to 0 then the value in that row belongs to the sample from the first population. Otherwise it belongs to the sample from the second population. The null hypothesis is that two populations are stochastically equal. Also one-sided hypothesises can be tested. This test does not assume that data have normal distribution.

Parameters

  • alternative — alternative hypothesis. (Optional, default: 'two-sided'.) String.
    • 'two-sided';
    • 'greater';
    • 'less'.
  • continuity_correction - if not 0 then continuity correction in the normal approximation for the p-value is applied. (Optional, default: 1.) UInt64.
  • sample_data — sample data. Integer, Float or Decimal.
  • sample_index — sample index. Integer.

Returned values

Tuple with two elements:

Example

Input table:

┌─sample_data─┬─sample_index─┐
│          10 │            0 │
│          11 │            0 │
│          12 │            0 │
│           1 │            1 │
│           2 │            1 │
│           3 │            1 │
└─────────────┴──────────────┘

Query:

SELECT mannWhitneyUTest('greater')(sample_data, sample_index) FROM mww_ttest;

Result:

┌─mannWhitneyUTest('greater')(sample_data, sample_index)─┐
│ (9,0.04042779918503192)                                │
└────────────────────────────────────────────────────────┘

See Also

Original article