regr_avgx()

Aggregate. Computes the average of the independent variable of the regression line.

Syntax

regr_avgx ( dependent-expression , independent-expression ) 

Parameters

dependent-expression

The variable that is affected by the independent variable. The expression accepts integer, long, float, timestamp, interval, and money datatypes.

independent-expression

The variable that influences the outcome. The expression accepts integer, long, float, timestamp, interval, and money datatypes.

Usage

This function converts its arguments to float, performs the computation in double-precision floating point, and returns a float. If the function is applied to an empty set, the result is NULL. The function is applied to sets of dependent-expression and independent-expression pairs after eliminating all pairs where either variable is NULL. The function is computed simultaneously during a single pass through the data. After eliminating NULL values, this computation is made, where y represents the dependent-expression:
avg( y )