Name

COVAR_SAMP — Returns the sample covariance of a set of number pairs.

Synopsis

numeric COVAR_SAMP ( in expr1 any ,
in expr2 any );

Description

COVAR_SAMP returns the sample covariance of a set of number pairs. Both expr1 and expr2 are numeric expressions. Virtuoso applies the function to the set of (expr1, expr2) pairs after eliminating all pairs for which either expr1 or expr2 is null. Then Virtuoso makes the following computation:

(SUM(expr1 * expr2) - SUM(expr2) * SUM(expr1) / n) / (n-1)

where n is the number of (expr1, expr2) pairs where neither expr1 nor expr2 is null.

Parameters

expr1

Number expression.

expr2

Number expression.

Return Types

The function returns a value of type NUMERIC. If the function is applied to an empty set, then it returns null.