Standard Library function that calculates the standard deviation value of an array. (Optionally, it can also calculate the standard deviation over one dimension of an array as a function of the other dimensions.)
npar (optional) The number of parameters. (Default: 0)
dim (optional) The dimension over which to calculate the standard deviation.
The number of degrees of freedom in SIGMA is equal to the number of elements in array minus the value supplied in the optional npar. In other words:
If dim is used, then the result of SIGMA is an array with the same dimensions as the input array, except for the dimension specified. Each element in the resulting array is the standard deviation of the corresponding vector in the input array.
The dimension specified in a SIGMA call must be valid for the array passed; otherwise, the input array is returned as the output array.
If
array
is an array with dimensions of (3,4,5), then the command:
std = SIGMA(array, 2, 1)
std = FLTARR(3,5) FOR j = 0, 4 DO BEGIN
FOR i = 0, 2 DO BEGIN
STD(i, j) = SIGMA(array(i, *, j), 2)
ENDFOR
ENDFOR
y = [1., 5., 9., 3., 10., 4.] std = SIGMA(y, 1) PRINT, 'The standard deviation = ', std
3.50238
a = FLTARR(3, 3) a(*, 0) = [2., 2., 2.] a(*, 1) = [4., 4., 4.] a(*, 2) = [6., 6., 6.] PRINT, a PRINT, SIGMA(a, 1, 0)
0.00000 0.00000 0.00000
PRINT, SIGMA(a, 1, 1)
2.00000 2.00000 2.00000