Skip to content

REGR_SXX

  • y: This is the dependent variable in the linear regression model. It is typically a column name indicating the response, or output, variable whose values you seek to explain or predict.
  • x: This is the independent variable in the linear regression model. It is typically a column name representing the predictor, or input, variable that explains or predicts the values of the dependent variable Y.
SELECT
REGR_SXX(salary, commission_pct) AS "Regr_Sxx"
FROM employees;
Regr_Sxx
------------
4.256389877

In the provided example, REGR_SXX(salary, commission_pct) computes the covariance of the salary and commission percentage of employees. Covariance is a measure of how much two random variables vary together. It is easy to calculate the covariance between two variables using the REGR_SXX function in SQL.