Skip to content

tTest

tTest(sample, other, options?): TTestResult

Defined in: t-test.ts:63

Student’s t-test, in whichever of its three forms the arguments describe.

Passing a number as other runs the one-sample test against it as a hypothesised mean; passing a second sample runs the two-sample test, or the paired test with options.paired. The form is read off the arguments rather than named by an option, because an option could contradict them.

The p-value comes from the tail of the t distribution computed directly, not from 1 − cdf, so a result significant at 1e-17 reports that rather than zero.

readonly number[]

The sample. Not modified.

number | readonly number[]

A second sample, or the hypothesised mean to test against.

TTestOptions

How the samples relate and which alternative to test.

TTestResult

The statistic, its degrees of freedom and the p-value.

When a sample is too small, or a paired test is given samples of different lengths.