regression-r2

Returns the coefficient of determination (also known as "R-squared" or "goodness of fit") of the regression line. This value is computed based on the following conditions: IF VAR_POP(numeric_expression2) = 0 THEN NULL IF VAR_POP(numeric_expression1) = 0 AND VAR_POP(numeric_expression2) <> 0 THEN 1 IF VAR_POP(numeric_expression1) > 0 and VAR_POP(numeric_expression2) <> 0 THEN POWER(CORR (numeric_expression1, numeric_expression2))

Note: Supported only in dynamic query mode.

Syntax

regression-r2 ( numeric_expression1 ,  numeric_expression2 )
regression-r2 ( numeric_expression1 ,  numeric_expression2 for 
[ all|any ] expression { , expression } )
regression-r2 ( numeric_expression1 ,  numeric_expression2 for 
report )

Example

regression-r2 ( Cost ,  Margin  for report)

Result

The coefficient of determination of the regression line for Cost and Margin.

Result data

Cost Margin regression-r2 (Cost, Margin for report)
4 0.33 0.00761514
5 0.28 0.00761514
9.22 0.23 0.00761514
15.93 0.28 0.00761514
34.97 0.3 0.00761514