Quick Search:
 
 The Oracle PL/SQL REGR_AVGY Function      [Return To Index] Jump to:  

Term: REGR_AVGY

Definition:
In Oracle PL/SQL, the function REGR_AVGY is a linear regression analytic function which takes two numeric inputs and calculates average of the second argument (the independent variable) of a regression line. It completely ignores the pair of values where any of the arguments is NULL.

Example Syntax:

REGR_AVGX(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 uses REGR_AVGY function to get average of dependent variable 'SAL'.

sql> SELECT deptno, sal, regr_avgy(sal, deptno) OVER (partition by deptno) "REGR_AVGY"
FROM employee
/


DEPTNO SAL REGR_AVGY
----------- ---------- ----------
100 2300 4223.33333
100 3810 4223.33333
100 3810 4223.33333
100 8300 4223.33333
100 4820 4223.33333
100 2300 4223.33333
110 3900 5003.33333
110 8210 5003.33333
110 2900 5003.33333
120 4500 4300
120 8300 4300
120 1200 4300
120 3200 4300

13 rows selected.



Related Links:

Related Code Snippets:
  • REGR_AVGY - REGR_AVGY evaluates the average of the independent variable (expr1) of the regression ...
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org