Definition:
In Oracle PL/SQL, the function REGR_SXX is an auxillary analytic function to generate statistics for data diagnostics based on independent variable of regression line. It takes two numeric inputs and returns a numeric output based on the formula shown below:
REGR_COUNT(x,y) * VAR_POP(y)
Note that the pairs having any argument's value as NULL are eliminated, but the final result might be NULL: as per the above computation.
Example Syntax:
REGR_SXX(x,y)
In the syntax, 'x' is referred to as the dependent variable and 'y' is referred to as the independent variable of the Regression Line.
Example Usage:
The SQL query below demonstrates the use of REGR_SXX.
SELECT deptno, sal, REGR_SXX(deptno, sal) OVER (partition by deptno) "REGR_SXX"
FROM employee
/
DEPTNO SAL REGR_SXX
----------- ---------- ----------
100 2300 24288120
100 3810 24288120
100 3810 24288120
100 8300 24288120
100 24288120
100 2300 24288120
110 3900 15924066.7
110 8210 15924066.7
110 2900 15924066.7
120 4500 26860000
120 8300 26860000
120 1200 26860000
120 3200 26860000
13 rows selected.
Related Links:
Related Code Snippets:
- REGR_SXX - REGR_SXX makes the following computation after eliminating NULL (expr1, expr2) pairs:
...
