メインコンテンツへスキップ
メインコンテンツへスキップ

mannWhitneyUTest

2 つの母集団からの標本に対して、マン=ホイットニーの順位検定を適用します。

構文

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

両方のサンプルの値は sample_data カラムにあります。sample_index が 0 の場合、その行の値は第1母集団からのサンプルに属します。0 以外の場合は第2母集団からのサンプルに属します。 帰無仮説は、2つの母集団が確率的に等しい(同一の分布に従う)というものです。片側検定も実行できます。この検定はデータが正規分布に従うことを仮定しません。

引数

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

パラメータ

  • alternative — 対立仮説。(省略可能、デフォルト: 'two-sided'。)String
    • 'two-sided';
    • 'greater';
    • 'less'
  • continuity_correction — 0 でない場合、p 値の正規近似において連続性補正を適用します。(省略可能、デフォルト: 1。)UInt64

戻り値

2要素からなる Tuple:

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

関連項目