Variance
(Engine-Level Function)
Description: | Returns the statistical sample variance for a subsection of an array. |
Returns: | Numeric |
Usage: | Script or steady state. |
Function Groups: | Array, Generic Math |
Related to: | AMax | AMin | AValid | FiltHigh | FiltLow | FitOffset | FitSlope | Mean | SDev | Sum |
Format: | Variance(ArrayElem, N) |
Parameters: |
ArrayElem |
Required. Any numeric array element giving the starting point in the array for the computation. The subscript for the array may be any numeric expression. If processing a multidimensional array, the usual rules apply to decide which dimension should be examined. |
N |
Required. 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. Because element 0 is an invalid element, the variance will be calculated using only the 3 valid elements.