Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
regr_r2
aggregate functionApplies to: Databricks SQL
Databricks Runtime 11.3 LTS and above
Returns the coefficient of determination from values of a group where xExpr
and yExpr
are NOT NULL
.
regr_r2( [ALL | DISTINCT] yExpr, xExpr) [FILTER ( WHERE cond ) ]
This function can also be invoked as a window function using the OVER
clause.
yExpr
: A numeric expression, the dependent variable.xExpr
: A numeric expression, the independent variable.cond
: An optional Boolean expression filtering the rows used for the function.A DOUBLE
.
Any nulls within the group are ignored. If a group is empty or consists only of nulls, the result is NULL
.
If DISTINCT
is specified, the average is computed after duplicates are removed.
> SELECT regr_r2(y, x) FROM VALUES (1, 2), (2, 3), (2, 3), (null, 4), (4, null) AS T(y, x);
1
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in