Var

Use var to calculate the variance of a series of numeric values. It works on a list of elements that can be:
* Expressions.
* Arrays or subarrays of an array.
* Properties in an array of references.

Syntax

sum(ELEMENT_LIST)

Examples

# Computes the variance of a list of computed valuesRESULT=var(15*3,pi,PRICE*2)# Variance on a children instancesMYORDER.VARIANCE=var(MYORDER.LINES(1..maxtab(MYORDER.LINES)).PRICE,&MYORDER.TAXES(1..3).AMOUNT, MYORDER.FREIGHT)

Description

var calculates the variance of a series, given by the following formula:

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

Where:

If one of the arguments in the function is an array variable without specifying index or range of indexes, all the variable elements are used. The index or range of indexes specified determines the elements to consider.

If a range of indexes is given such as there is no element to consider in the whole list, the result is 0.

The type of result depends on the type of arguments, but it is usually Decimal.

Associated errors

Error codeDescription
8Range error for indexes.
10The indexes given are not numeric.
50At least one argument is not numeric.
55Too many dimensions given for an argument.

See also

find, max, min, uni, prd, avg, sum.