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

meanZTest

2 つの母集団からの標本に対して平均の z検定を適用します。

構文

meanZTest(population_variance_x, population_variance_y, confidence_level)(sample_data, sample_index)

両方のサンプルの値は sample_data カラムに含まれています。sample_index が 0 の場合、その行の値は第1母集団からのサンプルに属します。それ以外の場合は第2母集団からのサンプルに属します。 帰無仮説は、母集団の平均が等しいというものです。正規分布に従うと仮定します。母集団の分散は等しくない場合があり、いずれの分散も既知であるとします。

引数

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

パラメータ

  • population_variance_x — 母集団 x の分散。Float
  • population_variance_y — 母集団 y の分散。Float
  • confidence_level — 信頼区間を計算するための信頼水準。Float

返される値

4 要素を持つ Tuple:

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

入力テーブル:

┌─sample_data─┬─sample_index─┐
│        20.3 │            0 │
│        21.9 │            0 │
│        22.1 │            0 │
│        18.9 │            1 │
│          19 │            1 │
│        20.3 │            1 │
└─────────────┴──────────────┘

クエリ:

SELECT meanZTest(0.7, 0.45, 0.95)(sample_data, sample_index) FROM mean_ztest

結果:

┌─meanZTest(0.7, 0.45, 0.95)(sample_data, sample_index)────────────────────────────┐
│ (3.2841296025548123,0.0010229786769086013,0.8198428246768334,3.2468238419898365) │
└──────────────────────────────────────────────────────────────────────────────────┘