<title>Analyze · Compare Means</title>
<description>Entry-point wrapper `CompareMeans` for mean-comparison tests (t-tests, ANOVA).</description>
<keywords>analyze, compare, means, class, comparemeans, methods, js, new, data, record, string, number</keywords>

# Analyze · Compare Means

Entry-point wrapper `CompareMeans` for mean-comparison tests (t-tests, ANOVA).

## Class: `CompareMeans`

**Constructor**

```js
new CompareMeans(data: Record<string, number[]>)
```

- `data` – object mapping **group name → numeric array**.

### Methods

- `paired(...colNames): PairedTTest` – paired t-test on two named columns; trims to equal length.
- `independent(...colNames): IndependentTTest` – two-sample **Student** t-test (pooled variance).
- `independentWelch(...colNames): IndependentTTest` – two-sample **Welch** t-test.
- `anova(...colNames): OneWayAnova` – one‑way ANOVA (pooled/“classic”).
- `anovaWelch(...colNames): OneWayAnova` – Welch’s one‑way ANOVA.
- `oneSample(colName?, mu0=0): OneSampleTTest` – one-sample t‑test for a single column (defaults to the first key if `colName` omitted).

All methods accept optional **column names**. If omitted, the test uses all keys from the constructor `data`.
