नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
Applies to:
Databricks SQL
Databricks Runtime 11.3 LTS and above
Returns the intercept of the univariate linear regression line in a group where xExpr and yExpr are NOT NULL.
Syntax
regr_intercept( [ALL | DISTINCT] yExpr, xExpr) [FILTER ( WHERE cond ) ]
This function can also be invoked as a window function using the OVER clause.
Arguments
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.
Returns
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.
This function is a synonym for avg(y) - regr_slope(y,x) * avg(x).
Examples
> SELECT regr_intercept(y, x) FROM VALUES (1, 2), (2, 3), (2, 3), (null, 4), (4, null) AS T(y, x);
-0.9999999999999998