Skip to content

REGR_SLOPE

  • y: This is the dependent variable in the regression equation. It represents the data column whose values are to be predicted.
  • x: This is the independent variable in the regression equation. It represents the data column used to make predictions for the Y values.
SELECT
REGR_SLOPE(sales, cost) AS slope
FROM
transactions;
SLOPE
-------------
1.25

The REGR_SLOPE function calculates the slope of the line of best fit through a dataset. The line is calculated such that the sum of the squared differences between the y-coordinates of the data points and the y-coordinates of the corresponding points (“expected values”) on the line of best fit, is minimized.

In the given example, it is utilized to determine the relationship between sales and cost in the transactions table. The output 1.25 represents the estimated increase in sales for every one unit increase in cost.