meandeviation()

Aggregate. Returns the mean absolute deviation of a given expression over multiple rows. Absolute deviation is the mean of the absolute value of the deviations from the mean of all values.

Syntax

meandeviation ( numeric-expression )

Parameters

numeric-expression

An expression, commonly a column name, for which the sample-based standard deviation is calculated over a set of rows. The expression will normally reference one or more columns in a group of records such that the mean deviation will be computed using the reference column value for each member of the group.

Usage

This function converts the argument to float, performs the computation in double-precision floating point, and returns a float. The mean deviation is computed according to the following formula:



This mean deviation does not include rows where numeric-expression is NULL. It returns NULL for a group containing no rows.

The mean deviation function could be used for optimization of stock portfolios on a real-time basis.