Collection Contents Previous Next PDF

ASA SQL Reference

SQL Functions

Alphabetical list of functions

COVAR_POP function [Aggregate]


Function 

Returns the population covariance of a set of number pairs.

Syntax 

COVAR_POP ( dependent-expression, independent-expression )

Parameters 

dependent-expression    The variable that is affected by the independent variable.

independent-expression    The variable that influences the outcome.

Usage 

The function returns a numeric value. If the function is applied to an empty set, then it returns NULL.

Both dependent-expression and independent-expression are numeric. The function is applied to the set of (dependent-expression, independent-expression) pairs after eliminating all pairs for which either dependent-expression or independent-expression is NULL. The following computation is then made:

(SUM ( x * y ) - SUM ( y ) * SUM ( x ) * SUM ( x ) / n) / n

where x represents the dependent-expression and y represents the independent-expression.

Standards and compatibility 
See also 
Example 

The following example measures the strength of association between employees' age and salary. This function returns the value 73785.84005866687.

SELECT COVAR_POP (salary, (year(now()) - year(birth_date)))
FROM employee 

Collection Contents Previous Next PDF