stdev
The stdev aggregate calculates the sample standard deviation.
Synopsis
AFL% aggregate(array,stdev(attribute)[,dimension_1,dimension_2,...])
AQL% SELECT stdev(attribute) FROM array;
Summary
The stdev aggregate calculates the sample standard deviation of a group of attribute values. You can optionally specify one or more grouping dimensions.
The standard deviation of an empty set is NULL. The standard deviation of a set that contains only NULL values is also NULL. If the set contains NULL and NOT NULL values, the stdev aggregate considers only NOT NULL values.
Example
This example finds the standard deviation of each row of a 2-dimensional array.
Create a 1-attribute, 2-dimensional array called m3x3:
AFL% CREATE ARRAY m3x3 <val:double>[i=0:2; j=0:2];
The output is:Query was executed successfully
Store some values between 0 and 1 in m3x3:
AFL% store(build(m3x3,(i+j)%9/10.0),m3x3);Â
The output is:{i,j} val {0,0} 0 {0,1} 0.1 {0,2} 0.2 {1,0} 0.1 {1,1} 0.2 {1,2} 0.3 {2,0} 0.2 {2,1} 0.3 {2,2} 0.4
Select the standard deviation of each row of m3x3:
AFL% aggregate(m3x3,stdev(val),i);Â
The output is:{i} val_stdev {0} 0.1 {1} 0.1 {2} 0.1
Remove the example array:
remove(m3x3);