variance — aggregate function to return the variance of a range of values.


variance (expr)


This function computes a value for each record returned by the query predicate, or from the specified column of a base table, and returns the variance of those values.

Variance is a measure of the dispersion of a set of data points around their mean value. It is a mathematical expectation of the average squared deviations from the mean. Variance measures the variability (volatility) from an average, and can be applied as a measure of risk. For example, this statistic can help determine the risk an investor might take on when purchasing a specific security.

The variance() function is calculated using the unbiased (or n-1) method, and is usually used when the incoming data represents a random sample. Use variancep() when the incoming data represents the entire population of data.

Expression expr must include the name of a column in a LiveView table, where that column's data type is int, long, or double. The returned value is of type double.


This LiveView aggregate function is based on the variance aggregate function in the StreamBase expression language.