## stdev

stdev — aggregate function to return the standard deviation of a range of values.

## DESCRIPTION

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 standard deviation of those values.

Standard deviation is a measure of the dispersion of a set of data from its mean. The more spread apart the data is, the higher the deviation. For example, in financial applications, standard deviation could be applied to the annual rate of return of an investment to measure the investment's volatility (risk). A volatile stock would have a high standard deviation. In mutual funds, the standard deviation indicates how much the return on the fund is currently deviating from the expected normal returns.

Expression * expr* must be the name of a column in a LiveView table, where that column's data type is int, long, double, or timestamp. If the
field's type is an int, double, or long, it returns a double. If the field's type is a timestamp, it returns an interval timestamp.
For timestamp values, the input field should contain all interval timestamps or all absolute timestamps, but not both.

This function calculates its return value based on the *unbiased* or *n-1* method, and is usually used when the incoming data represents a random sample of data. Use stdevp for a similar function that calculates its return value using the *biased* or *n* method, which is used when the incoming data represents an entire population of data.

## SEE ALSO

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