stdBy

stdBy returns the sample standard deviation for each group. Null values are ignored.

Caution

Applying this aggregation to a column where the sample standard deviation cannot be computed will result in an error. For example, the standard deviation is not defined for a column of string values.

Syntax

Parameters

ParameterTypeDescription
groupByColumnsString...

The column(s) by which to group data.

  • NULL returns the sample standard deviation for all non-key columns.
  • "X" will output the sample standard deviation of each group in column X.
  • "X", "Y" will output the sample standard deviation of each group designated from the X and Y columns.
groupByColumnsColumnName...

The column(s) by which to group data.

  • NULL returns the sample standard deviation for all non-key columns.
  • "X" will output the sample standard deviation of each group in column X.
  • "X", "Y" will output the sample standard deviation of each group designated from the X and Y columns.
groupByColumnsCollection<String>

The column(s) by which to group data.

  • NULL returns the sample standard deviation for all non-key columns.
  • "X" will output the sample standard deviation of each group in column X.
  • "X", "Y" will output the sample standard deviation of each group designated from the X and Y columns.

Returns

A new table containing the sample standard deviation for each group.

How to calculate standard deviation

Sample standard deviation is a measure of the average dispersion of data values from the mean. Unlike sample variance, it is on the same scale as the data, meaning that sample standard deviation can be readily interpreted in the same units as the data. The formula for sample standard deviation is as follows:

s=i=1n(xixˉ)2n1s = \sqrt{\frac{\sum_{i=1}^{n}{(x_i - \bar{x})^2}}{n-1}}

Examples

In this example, stdBy returns the sample standard deviation of the whole table. Because the sample standard deviation cannot be computed for the string columns X and Y, these columns are dropped before applying stdBy.

In this example, stdBy returns sample the standard deviation, as grouped by X. Because sample the standard deviation cannot be computed for the string column Y, this column is dropped before applying stdBy.

In this example, stdBy returns the sample standard deviation, as grouped by X and Y.