ILE COBOL Language Reference


VARIANCE

The VARIANCE function returns a numeric value that approximates the variance of its arguments.

The function type is numeric.

Format
 
                         .------------.
                         V            |
>>-FUNCTION VARIANCE--(----argument-1-+--)---------------------><
 
 
argument-1
Must be class numeric.

The returned value is the approximation of the variance of the argument-1 series.

The returned value is defined as the square of the standard deviation of the argument-1 series. This value is calculated as follows:

  1. The difference between each argument-1 value and the arithmetic mean of the argument-1 series is calculated and squared.
  2. The values obtained are then added together. This quantity is divided by the number of values in the argument series.

If the argument-1 series consists of only one value, or if the argument-1 series consists of all variable occurrence data items and the total number of occurrences for all of them is one, the returned value is zero.

The equivalent arithmetic expression for FUNCTION VARIANCE is:

  1. For one occurrence of argument-1,

    (0)

  2. For two occurrences of argument-1,

    ( ((argument-11 - FUNCTION MEAN (argument-1)) ** 2 + (argument-12 - FUNCTION MEAN (argument-1)) ** 2) / 2)

  3. For n occurrences of argument-1,

    ( FUNCTION SUM ( ((argument-11 - FUNCTION MEAN (argument-1)) ** 2) ... ((argument-1n - FUNCTION MEAN (argument-1)) ** 2)) / n)

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]