COBOL Manual for TNS and TNS/R Programs
Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs—522555-006
14-62
VARIANCE Function
VARIANCE Function
VARIANCE, a numeric function, returns a value that approximates the variance of its
arguments.
argument
is a numeric argument.
argument can be an array; for example,
FUNCTION VARIANCE (ARRAY1(ALL))
returns a value that approximates the variance of the elements of the array
ARRAY1.
The returned value is the approximation of the variance of the argument series.
If there is only one argument, or if every argument is a variable occurrence data
item and the total number of occurrences for all of them is one, the returned value is
zero; otherwise, the returned value is the square of the standard deviation of the
argument series; that is:
( )
VARIANCEFUNCTION argument
VST466.vsd
argument
i
FUNCTION MEAN argument
1
… argument,
n
(, )–()
2
i 1=
n
∑
n
-------------------------------------------------------------------------------------------------------
2