# analysisOfVariance (/docs/reference/sql/aggregate-functions/analysisofvariance)



This page describes the RawTree engine binary used to generate this reference. It does not define Query API support. Descriptions retain upstream ClickHouse terminology. See [SQL interface scope](/docs/reference/clickhouse-compatibility#service-interfaces).

Provides a statistical test for one-way analysis of variance (ANOVA test). It is a test over several groups of normally distributed observations to find out whether all groups have the same mean or not.

:::note
Groups are enumerated starting from 0 and there should be at least two groups to perform a test.
There should be at least one group with the number of observations greater than one.
:::

**Syntax**

```sql
analysisOfVariance(val, group_no)
```

**Arguments**

* `val` — Value. [`(U)Int*`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float) or [`Decimal`](/reference/data-types/decimal)
* `group_no` — Group number that `val` belongs to. [`(U)Int*`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float) or [`Decimal`](/reference/data-types/decimal)

**Returned value**

Returns a tuple with the F-statistic and p-value. [`Tuple(Float64, Float64)`](/reference/data-types/tuple)

**Examples**

**Basic usage**

```sql title=Query
SELECT analysisOfVariance(number, number % 2) FROM numbers(1048575);
```

```text title=Response
┌─analysisOfVariance(number, modulo(number, 2))─┐
│ (0,1)                                         │
└───────────────────────────────────────────────┘
```

*Introduced in version 22.10.0.*
