# pairedTTest

> **pairedTTest**(`first`, `second`, `options?`): [`PairedTTestResult`](/reference/knotkit/hypothesis-test/interfaces/pairedttestresult/)

Defined in: [packages/hypothesis-test/src/paired-t-test.ts:21](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/hypothesis-test/src/paired-t-test.ts#L21)

Paired-sample t-test of whether the mean of `first[i] - second[i]` is zero, matching `scipy.stats.ttest_rel`. It is `oneSampleTTest` of the differences against zero. `greater` tests a first mean above the second. Uses O(n) time and space.

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

## Parameters

### first

`ArrayLike`<`number`>

### second

`ArrayLike`<`number`>

### options?

[`PairedTTestOptions`](/reference/knotkit/hypothesis-test/interfaces/pairedttestoptions/)

## Returns

[`PairedTTestResult`](/reference/knotkit/hypothesis-test/interfaces/pairedttestresult/)

## Throws

With `EMPTY_SAMPLE`, `LENGTH_MISMATCH`, `TOO_SMALL_SAMPLE` below two pairs, `NON_FINITE_SAMPLE` (also when a difference overflows), `ZERO_VARIANCE`, or `INVALID_OPTION`.

## Throws

With `INVALID_PARAMETER` above 1e5 degrees of freedom.
