Skip to content

REGR_AVGX

  • y: This is the dependent variable parameter in the function REGR_AVGX(y, x). It represents the set of values that are to be predicted or estimated.
  • x: This is the independent variable parameter in the function REGR_AVGX(y, x). It is the set of values used for prediction or estimation of the dependent variable ‘y’.
SELECT REGR_AVGX(y, x) FROM (VALUES (1, 2), (2, 4), (3, 6)) AS t(x, y);
2

The REGR_AVGX function calculates the average of the independent variable (x). In our example, with the input values for variable x being 1, 2, and 3, the average of these numbers equals 2.