Skip to content

stddev_y() | stddev_x()

Calculate the standard deviation from a two-dimensional statistical aggregate for the dimension specified

Since 1.3.0

Calculate the standard deviation from a two-dimensional statistical aggregate for the given dimension. For example, stddev_y() calculates the skewness for all the values of the y variable, independent of values of the x variable.

Calculate the standard deviation of a sample containing the integers from 0 to 100:

SELECT stddev_y(stats_agg(data, data))
FROM generate_series(0, 100) data;
stddev_y
--------
29.3002

The syntax is:

stddev_y(
summary StatsSummary2D,
[ method TEXT ]
) RETURNS DOUBLE PRECISION
stddev_x(
summary StatsSummary2D,
[ method TEXT ]
) RETURNS DOUBLE PRECISION
NameTypeDefaultRequiredDescription
summaryStatsSummary2D-The statistical aggregate produced by a stats_agg call
methodTEXTsample-The method used for calculating the standard deviation. The two options are population and sample, which can be abbreviated to pop or samp
ColumnTypeDescription
stddev_ystddev_xDOUBLE PRECISION