REGR_SXX
REGR_SXX(Y, X)
Section titled “REGR_SXX(Y, X)”- 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.
Example
Section titled “Example”SELECTREGR_SXX(salary, commission_pct) AS "Regr_Sxx"FROM employees;Output
Section titled “Output”Regr_Sxx------------4.256389877Explanation
Section titled “Explanation”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.
REGR_SXX(Y, X)
Section titled “REGR_SXX(Y, X)”- y: This is the dependent variable in the regression equation. It is a numeric or a non-null input column in the database from which the function will establish a relationship.
- x: This is the independent variable in the regression equation. It represents a numeric or non-null input column in the database that influences a dependent variable (Y).
Example
Section titled “Example”SELECT REGR_SXX(work_experience, salary)FROM Employee;Output
Section titled “Output”4.67Explanation
Section titled “Explanation”In the provided example, the REGR_SXX() function is applied on work_experience and salary columns of the Employee table. This function calculates the sum of squares of differences from the mean for work_experience (the dependent variable) per unit of salary (the independent variable). The resultant value, 4.67, indicates the variability of work_experience per unit of salary.