ClickHouse/docs/en/sql-reference/aggregate-functions/reference/welchttest.md

2.1 KiB

toc_priority toc_title
301 welchTTest

welchTTest

Applies Welch's t-test to samples from two populations.

Syntax

welchTTest(sample_data, sample_index)

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 is assumed. Populations may have unequal variance.

Arguments

Returned values

Tuple with two elements:

Example

Input table:

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

Query:

SELECT welchTTest(sample_data, sample_index) FROM welch_ttest;

Result:

┌─welchTTest(sample_data, sample_index)─────┐
│ (2.7988719532211235,0.051807360348581945) │
└───────────────────────────────────────────┘

See Also

Original article