Name

VAR_SAMP — Returns the sample variance.

Synopsis

numeric VAR_SAMP ( in expr any );

Description

VAR_SAMP returns the sample variance of a set of numbers after discarding the nulls in this set. The expr is a numeric expression, and the function returns a value of type NUMERIC. If the function is applied to an empty set, then it returns null. The function makes the following calculation:

(SUM(expr2) - SUM(expr)2 / COUNT(expr)) / (COUNT(expr) - 1)

This function is similar to VAR, except that given an input set of one element, VAR returns 0 and VAR_SAMP returns null.

Parameters

expr

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.