Reference Guide > TDV Support for SQL Functions > TDV-Supported Analytical Functions > REGR_R2
 
REGR_R2
REGR_R2 returns the coefficient of determination (also called R-squared or goodness of fit) for the regression.
Syntax
REGR_R2 (expression1, expression2) OVER (window_clause)
Remarks
The return value is a numeric data type and can be NULL.
VAR_POP (expression1) and VAR_POP (expression2) are evaluated after the elimination of NULL pairs. The return values are:
NULL if VAR_POP (expression2) = 0
1 if VAR_POP (expression1) = 0 and VAR_POP (expression2) != 0
POWER (CORR (expression1,expression2) if VAR_POP (expression1) > 0 and VAR_POP (expression2) != 0
Without a window clause, REGR_R2 is a simple aggregate function.