variance
Computes an unbiased estimate the variance of all input points.
Prototype
function variance ( value : numeric ) return_val [1] : float or double
Arguments
valueAn array of any dimensionality.
Return value
Returns a floating point value, or type double if value is of type double.
Description
This function computes the unbiased estimate of the variance for all input points, regardless of the dimensionality of the input. Technically, this function calculates an estimate of the population variance. This means that it divides by [1/(N-1)] where N is the total number of non-missing values.
See Also
Examples
Example 1
The following calculates the sample variance of 5 values.
f = (/ 7, 9, -2, -8, 2/) variance_f = variance(f) print(variance_f) Variable: variance_f Type: float Total Size: 4 bytes 1 values Number of Dimensions: 1 Dimensions and sizes: [1] Coordinates: (0) 47.3
Example 2
The following calculates the overall variance of a (3,5,10) array, f.
f = onedtond(ispan(1, 150, 1), (/3, 5, 10/)) variance_f = variance(f) print(variance_f) Variable: variance_f Type: float Total Size: 4 bytes 1 values Number of Dimensions: 1 Dimensions and sizes: [1] Coordinates: (0) 1887.5