Skip to content

oneSampleTTest(sample, expectedMean, options?): OneSampleTTestResult

Defined in: packages/hypothesis-test/src/one-sample-t-test.ts:21

Student’s t-test of whether a sample’s mean equals expectedMean, matching scipy.stats.ttest_1samp. The statistic is (mean - expectedMean) / sqrt(variance / n) with n - 1 degrees of freedom. greater tests a mean above expectedMean. Uses O(n) time and constant working storage.

A constant sample has zero variance. SciPy returns NaN or an infinite statistic there; this function throws.

ArrayLike<number>

number

OneSampleTTestOptions

OneSampleTTestResult

With EMPTY_SAMPLE, TOO_SMALL_SAMPLE below two values, NON_FINITE_SAMPLE (also for a non-finite expectedMean), ZERO_VARIANCE, or INVALID_OPTION.

With INVALID_PARAMETER above 1e5 degrees of freedom.