🎯 Stddev (Standard Deviation)
The ‘stddev’ condition implements standard deviation logic. It takes a list or a list of lists, along with a standard deviation threshold (‘compare_to’), and returns all values that are farther away from the mean than the standard deviation.
Example
For this example, the output of db-step
step is a list of rows from the db:
[(1, 2 ,3), (1, 4, 5), (7, 8, 9)]
The pivot_column
is 2, hence the values for the stddev calculation are:
3
, 5
and 9
.
Next, the sttdev condition calculates the stddev:
And the standard deviation (sd) is:
Therefore, the standard deviation of the dataset [3, 5, 9] is approximately 2.596.
Thus, the values that are more than 1 standard deviation from the mean are 3 and 9, since they are outside the range of 5.666666666666667+-2.5961484292674155 (which is [3.0705, 8.2628]).
Same example without pivot_column
Notice that we used pivot_column
since the output db db-step
was a list of rows.
If the output was just list, we could skip it.
For example, if the output of db-step
was (3, 5 ,9)
, we could just use: