regr_sxx

regr_sxx

regr_sxx 介绍

regr_sxx(y, x) - 对于组中的非空值对,返回 REGR_COUNT(y, x) * VAR_POP(x),其中 y 是因变量,x 是自变量。

Examples:

> SELECT regr_sxx(y, x) FROM VALUES (1, 2), (2, 2), (2, 3), (2, 4) AS tab(y, x);
 2.75
> SELECT regr_sxx(y, x) FROM VALUES (1, 2), (2, null), (2, 3), (2, 4) AS tab(y, x);
 2.0
> SELECT regr_sxx(y, x) FROM VALUES (1, 2), (2, null), (null, 3), (2, 4) AS tab(y, x);
 2.0

Since: 3.4.0