regr_intercept

regr_intercept

regr_intercept 介绍

regr_intercept(y, x) - 返回在组中非空值对的单变量线性回归线的截距,其中 y 是因变量,x 是自变量。

Examples:

> SELECT regr_intercept(y, x) FROM VALUES (1,1), (2,2), (3,3) AS tab(y, x);
 0.0
> SELECT regr_intercept(y, x) FROM VALUES (1, null) AS tab(y, x);
 NULL
> SELECT regr_intercept(y, x) FROM VALUES (null, 1) AS tab(y, x);
 NULL

Since: 3.4.0