> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Retorna o intercepto da reta de regressão.

# regr_intercept

<h2 id="regr_intercept">
  regr\_intercept
</h2>

Introduzido em: v26.9.0

Retorna o intercepto do ajuste por mínimos quadrados de `y` em função de `x`:

$$
\bar{y} - slope \cdot \bar{x}
$$

Retorna `nan` quando `x` é constante, pois, nesse caso, a reta ajustada é vertical.

**Sintaxe**

```sql theme={null}
regr_intercept(y, x)
```

**Aliases**: `regrIntercept`

**Argumentos**

* `y` — Variável dependente. [`(U)Int*`](/pt-BR/reference/data-types/int-uint) ou [`Float*`](/pt-BR/reference/data-types/float)
* `x` — Variável independente. [`(U)Int*`](/pt-BR/reference/data-types/int-uint) ou [`Float*`](/pt-BR/reference/data-types/float)

**Valor retornado**

Retorna o intercepto da reta de regressão. [`Float64`](/pt-BR/reference/data-types/float)

**Exemplos**

**Uso básico**

```sql title=Query theme={null}
SELECT regr_intercept(y, x)
FROM VALUES('x Float64, y Float64', (1, 2), (2, 4), (3, 6), (4, 8))
```

```response title=Response theme={null}
┌─regr_intercept(y, x)─┐
│                    0 │
└──────────────────────┘
```
