VAR

Summary


var is used to find variance of a series of numeric variables.

Syntax

   var( list_exprg )

Parameters

Element

Description

Remarks

list_exprg

List of generalised expressions separated by the character ','.

The expressions must be of the numeric type.

Examples

   # Variance of several numeric expressions
    VAR_CA = var( MONTHLY_CA(1..12) )

Description and comments

var is used to calculate the variance for any number of numeric variables or expressions, that is to say the result of the following calculation :

( sx2 - ( sx * sx / n ) ) / n

with the following conventions :

sx2 = squared sum of the elements,
sx = sum of the elements,
n = number of elements.

It is possible to mix variables of the type label, decimal, integer, floating point and double precision.

The result type depends on the type of arguments and the increasing order of the result. It can be Integer if all the elements are of the type Integer and if all the intermediate calculations are integers as well as the variance, Double if there is at least one Double in the series of arguments, Decimal in all other cases.

If one of the arguments for the function is a dimensioned variable without specifying an index or index interval, all the elements of the variable are used. The specifying of an index or index interval determines the elements to be taken into account.

If an index interval is given in such a way that no element exists where it is possible to calculate the variance, for example var(VARIABLES(1..0)), the result returned is 0.

Associated errors

Error

Description

ERMODE (10)

The given indexes are not numeric.

ERINDI ( 8)

Error in the index ranges.

ERDOM (50)

The arguments are not numeric.

ERDIM (55)

Too many dimensions given.

Associated keywords

MIN - MAX - SUM - PRD - AVG - UNI - FIND


SUMMARY]


Copyright © Sage 1999 - 2007