studentTTest
Introduced in: v21.1.0
Applies Student’s t-test to samples from two populations.
Values of both samples are in the sample_data column. If sample_index equals to 0 then the value in that row belongs to the sample from the first population. Otherwise it belongs to the sample from the second population.
The null hypothesis is that means of populations are equal. Normal distribution with equal variances is assumed.
See Also
Syntax
studentTTest([confidence_level])(sample_data, sample_index)Parameters
confidence_level— Optional. Confidence level in order to calculate confidence intervals.Float
Arguments
Returned value
Returns a tuple with two or four elements (if the optional confidence_level is specified): calculated t-statistic, calculated p-value, [calculated confidence-interval-low], [calculated confidence-interval-high]. Tuple(Float64, Float64) or Tuple(Float64, Float64, Float64, Float64)
Examples
Basic usage
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) │
└───────────────────────────────────────────┘See Also