Aggregate. Computes the coefficient of determination (also referred to as R-squared or the goodness of fit statistic) for the regression line.
regr_r2 ( dependent-expression , independent-expression )
dependent-expression | The variable that is affected by the independent variable. The expression accepts numeric datatypes, except timestamp, bigdatetime, and interval. |
independent-expression | The variable that influences the outcome. The expression accepts numeric datatypes, except timestamp, bigdatetime, and interval. |
covarPOP = ((_sum_xy * count) – (sum_x * sum_y)) * ((_sum_xy * count) – (sum_x * sum_y)) xVarPop = (sum_xx * count) – (sum_x * sum_x) yVarPop = (sum_yy * count) – (sum_y * sum_y) result = covarPOP / (xvarPop * yVarPop)