Skip to content

twoSampleTTest(first, second, options?): TwoSampleTTestResult

Defined in: packages/hypothesis-test/src/two-sample-t-test.ts:23

Student’s pooled-variance t-test of whether two independent samples share a mean, matching scipy.stats.ttest_ind(first, second, equal_var=True). The statistic is (mean₁ - mean₂) / se, where se uses the pooled variance, with m + n - 2 degrees of freedom. greater tests a first mean above the second. Use welchTTest when the variances may differ. Uses O(m + n) time and constant working storage.

Constant samples have zero pooled variance. SciPy returns NaN or an infinite statistic there; this function throws.

ArrayLike<number>

ArrayLike<number>

TwoSampleTTestOptions

TwoSampleTTestResult

With EMPTY_SAMPLE, TOO_SMALL_SAMPLE below three pooled values, NON_FINITE_SAMPLE, ZERO_VARIANCE, or INVALID_OPTION.

With INVALID_PARAMETER above 1e5 degrees of freedom.