REGR_INTERCEPT

functionsupportedCore SQL functions

docs.snowflake.com ↗

Aggregate functionsWindow function syntax and usage

Returns the intercept of the univariate linear regression line for non-null pairs in a group. It is computed for non-null pairs using the following formula: AVG(y)-REGR_SLOPE(y,x)*AVG(x) Where x is the independent variable and y is the dependent variable.

Syntax

supportedpartialnot supportednot scored

Aggregation function

REGR_INTERCEPT(y, x)

Window function

REGR_INTERCEPT(y, x) OVER ( [ PARTITION BY <expr3> ] )

Parameters

NameRequiredDescription
yrequiredThe dependent variable. This must be an expression that can be evaluated to a numeric type.
xrequiredThe independent variable. This must be an expression that can be evaluated to a numeric type.
expr3requiredThis is the optional expression used to group rows into partitions.

Returns

If any of the input expressions is of type DECFLOAT, the returned type is DECFLOAT. Otherwise, the returned type is FLOAT.

Usage notes