REGR_SXY

REGR_SXY is a statistical aggregate function in SQL used to compute the sum of products of differences for paired observations from their respective means. It is useful in conducting regression analyses. This function evaluates the linear relationship between two variables in a dataset, returning a numerical value representing such relationship.

REGR_SXY(Y, X)

  • y: This is the dependent variable in the regression equation. It is the variable that we want to predict or explain using the regression equation.
  • x: This is the independent variable in the regression equation. It is the variable that we use to predict or explain the dependent variable Y.

Example

SELECT REGR_SXY(column1, column2)
FROM tableName;

Output

REGR_SXY(column1, column2)
--------------------------
0.75

Explanation

The REGR_SXY() function is used for statistical analysis in an Oracle database. It calculates and returns the covariation of the two variables (column1 and column2 in this instance) observed in a particular table (tableName in this example). The returned value, 0.75 in this case, represents the covariance of the two columns. A positive value signifies a positive linear relationship, a negative value signifies a negative linear relationship, and a value of zero signifies no linear relationship.

REGR_SXY(Y, X)

  • y: The dependent variable in the regression equation to be analyzed. It is the outcome or response variable whose behavior or pattern is being studied in relation to the independent variable X.
  • x: The independent variable in the regression equation. It is the predictor or explanatory variable that is used to explain or predict the state of the dependent variable Y.

Example

SELECT
REGR_SXY(col1, col2)
FROM
table;

Output

0.789123456789123456789123456789

Explanation

In the provided example, the REGR_SXY() function computes the covariance of the point pair (col1, col2) from the selected records in the table. The PostgreSQL returns the computed covariance value as output.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.