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

studentTTest

二つの母集団からのサンプルに対して、Studentのt検定を適用します。

構文

studentTTest([confidence_level])(sample_data, sample_index)

両方のサンプルの値は sample_data カラムにあります。sample_index が 0 の場合、その行の値は最初の母集団からのサンプルに属します。そうでない場合は、第二の母集団からのサンプルに属します。 帰無仮説は、母集団の平均が等しいというものです。等しい分散を持つ正規分布が仮定されます。

引数

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

パラメータ

  • confidence_level — 信頼区間を計算するための信頼レベル。 Float

返される値

Tuple は二つまたは四つの要素を持ちます(オプションの confidence_level が指定されている場合):

  • 計算された t 検定統計量。 Float64
  • 計算された p 値。 Float64
  • [計算された信頼区間下限。 Float64。]
  • [計算された信頼区間上限。 Float64。]

入力テーブル:

┌─sample_data─┬─sample_index─┐
│        20.3 │            0 │
│        21.1 │            0 │
│        21.9 │            1 │
│        21.7 │            0 │
│        19.9 │            1 │
│        21.8 │            1 │
└─────────────┴──────────────┘

クエリ:

SELECT studentTTest(sample_data, sample_index) FROM student_ttest;

結果:

┌─studentTTest(sample_data, sample_index)───┐
│ (-0.21739130434783777,0.8385421208415731) │
└───────────────────────────────────────────┘

関連情報