studentTTest
引入版本:v21.1.0
对来自两个总体的样本应用 Student's t 检验。
两个样本的值都位于 sample_data 列中。如果 sample_index 等于 0,则该行中的值属于第一个总体的样本;否则,属于第二个总体的样本。
原假设为两个总体的均值相等。假设数据服从方差相等的正态分布。
另请参阅
语法
studentTTest([confidence_level])(sample_data, sample_index)参数
confidence_level— 可选。用于计算置信区间的置信水平。Float
参数列表
返回值
返回一个包含两个或四个元素的 Tuple (如果指定了可选参数 confidence_level) :计算得到的 t 统计量、p 值、[计算得到的置信区间下限]、[计算得到的置信区间上限]。Tuple(Float64, Float64) 或 Tuple(Float64, Float64, Float64, Float64)
示例
基本用法
CREATE TABLE student_ttest (sample_data Float64, sample_index UInt8) ENGINE = Memory;
INSERT INTO student_ttest VALUES (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.8385421208415734) │
└───────────────────────────────────────────┘另请参阅