# welchTTest

> **welchTTest**(`first`, `second`, `options?`): [`WelchTTestResult`](/reference/knotkit/hypothesis-test/interfaces/welchttestresult/)

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

Welch’s unequal-variance t-test of whether two independent samples share a mean, matching `scipy.stats.ttest_ind(first, second, equal_var=False)`. The statistic is `(mean₁ - mean₂) / sqrt(s₁²/m + s₂²/n)`, and the degrees of freedom follow Welch–Satterthwaite, so they are usually fractional. `greater` tests a first mean above the second. Uses O(m + n) time and constant working storage.

Two constant samples have zero standard error. SciPy returns NaN or an infinite statistic there; this function throws. One constant sample alongside a varying one is accepted.

## Parameters

### first

`ArrayLike`<`number`>

### second

`ArrayLike`<`number`>

### options?

[`WelchTTestOptions`](/reference/knotkit/hypothesis-test/interfaces/welchttestoptions/)

## Returns

[`WelchTTestResult`](/reference/knotkit/hypothesis-test/interfaces/welchttestresult/)

## Throws

With `EMPTY_SAMPLE`, `TOO_SMALL_SAMPLE` below two values in either sample, `NON_FINITE_SAMPLE`, `ZERO_VARIANCE`, or `INVALID_OPTION`.

## Throws

With `INVALID_PARAMETER` above 1e5 degrees of freedom.
