Skip to content
ClickHouse Docs

regr_intercept

Autogenerated from ClickHouse system tables

Introduced in: v26.9.0

Returns the intercept of the least-squares fit of y on x:

yˉ−slope⋅xˉ\bar{y} - slope \cdot \bar{x}

Returns nan when x is constant, because the fitted line is vertical.

Syntax

regr_intercept(y, x)

Arguments

Returned value

Returns the intercept of the regression line. Float64

Examples

Basic usage

SELECT regr_intercept(y, x)
FROM VALUES('x Float64, y Float64', (1, 2), (2, 4), (3, 6), (4, 8))
┌─regr_intercept(y, x)─┐
│                    0 │
└──────────────────────┘