メインコンテンツまでスキップ
メインコンテンツまでスキップ

mannWhitneyUTest

2つの母集団からのサンプルに対してMann-Whitneyランクテストを適用します。

構文

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

両方のサンプルの値は sample_data カラムにあります。もし sample_index が0に等しい場合、その行の値は最初の母集団からのサンプルに属します。それ以外の場合は2番目の母集団からのサンプルに属します。 帰無仮説は、2つの母集団が確率的に等しいというものです。また、片側の仮説もテストできます。このテストはデータが正規分布していると仮定しません。

引数

  • sample_data — サンプルデータ。 IntegerFloat または Decimalです。
  • sample_index — サンプルインデックス。 Integerです。

パラメータ

  • alternative — 対立仮説。 (オプション、デフォルト: 'two-sided'。) String
    • 'two-sided';
    • 'greater';
    • 'less'.
  • continuity_correction — 0でない場合、p値の正規近似において連続性補正が適用されます。 (オプション、デフォルト: 1。) UInt64

返される値

Tupleの2つの要素:

  • 計算されたU統計量。 Float64
  • 計算されたp値。 Float64

入力テーブル:

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

クエリ:

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

結果:

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

関連項目