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

mannWhitneyUTest

二つの母集団からのサンプルに対してMann-Whitney順位検定を適用します。

構文

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

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

引数

パラメータ

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

戻り値

タプルで二つの要素を含みます:

  • 計算された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)                                │
└────────────────────────────────────────────────────────┘

関連情報