regr_slope

regr_slope

regr_slope 介绍

regr_slope(y, x) - 返回组中非空值对的线性回归线的斜率,其中 y 是因变量,x 是自变量。

Examples:

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

Since: 3.3.0