Variance

Description:              This function returns the statistical sample variance for a subsection of an array.

Returns:                    Numeric

Usage:                       Script or Steady State

Format:                      Variance(ArrayElem, N)

Parameters:             ArrayElem     { Numeric Array element }  { required }  { no default: }

                                                Any numeric array element giving the starting point in the array for the computation. The subscript for the array may be any numeric expression. Unless specified, the lowest dimension of a multidimensional array is used.

                                    N     { numeric }  { required }  { no default: }

                                                Any numeric expression giving the number of array elements to compute. If N extends past the upper bound of the lowest array dimension, this computation will "wrap-around" and resume at element 0, until N elements have been processed.

Comments:               The invalid parameters are not skipped over, but they are not included in the calculation. The function returns an invalid result if either of its parameters is invalid or if there are less than two valid numerical array elements in the specified range.

Example:

weight[0] = Invalid();

weight[1] = 0;

weight[2] = 1;

weight[3] = 3;

weight[4] = 1;

weight[5] = 5;

prodVariance = Variance(weight[4] { Starting array element },

4 { No. of elements to use }); 

The variable prodVariance will be the variance of elements 4, 5, 0 and 1 of the array weight, which is 7. Since element 0 is an invalid element, the variance will be calculated using only the 3 valid elements.

See Also:

AMax | AMin | AValid | FiltHigh | FiltLow | FitOffset | FitSlope | Mean | SDev | Sum