# sampleVariance

> **sampleVariance**(`values`, `options?`): `number`

Defined in: [packages/distribution/src/sample-statistics.ts:122](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/distribution/src/sample-statistics.ts#L122)

Variance by Welford’s one-pass algorithm. The divisor is `length - degreesOfFreedomCorrection`, so the default `1` is the unbiased sample variance and `0` is the population variance.

## Parameters

### values

[`NumericSample`](/reference/knotkit/distribution/type-aliases/numericsample/)

### options?

[`SampleMomentOptions`](/reference/knotkit/distribution/interfaces/samplemomentoptions/)

## Returns

`number`

## Throws

`INVALID_PARAMETER` when the correction is not a nonnegative integer; `INVALID_SAMPLE` when `values` holds a non-finite value or no more than `degreesOfFreedomCorrection` values.
