Skip to content

REGR_INTERCEPT

  • y: This is the dependent variable in the regression equation. It denotes the response or the output value that the equation predicts.
  • x: This is the independent variable in the regression equation. It denotes the predictor or the input value that the equation uses to forecast the dependent variable Y.
SELECT REGR_INTERCEPT(y, x) as intercept
FROM (SELECT 1 as x, 3 as y FROM dual
UNION ALL SELECT 2 as x, 5 as y FROM dual
UNION ALL SELECT 3 as x, 7 as y FROM dual)
INTERCEPT
-----------
1

The REGR_INTERCEPT function computes the y-intercept of the least-squares-fit linear equation determined by the (x, y) pairs. In the code above, (1, 3), (2, 5), and (3, 7) pairs are provided. These points all lie on the line y = 2x + 1, hence intercept of the line which is the expected output returns 1.