http://zorba.io/modules/excel/statistical-zorba

View as XML or JSON.

This module implements some Excel 2003 statistical functions that cannot be implemented with standard XQuery functions. It uses Zorba specific functions.

Function Summary

stdev ($numbers as xs:anyAtomicType+) as xs:anyAtomicType

Estimates standard deviation based on a sample.

stdeva ($numbers as xs:anyAtomicType+) as xs:anyAtomicType

Estimates standard deviation based on a sample.

stdevp ($numbers as xs:anyAtomicType+) as xs:anyAtomicType

Calculates standard deviation based on the entire population given as arguments.

stdevpa ($numbers as xs:anyAtomicType+) as xs:anyAtomicType

Calculates standard deviation based on the entire population given as arguments.

subtotal ($function_num as xs:integer, $numbers as xs:anyAtomicType*) as xs:anyAtomicType

Moved from math module.

Functions

stdev#1

declare  function excel:stdev($numbers as xs:anyAtomicType+) as xs:anyAtomicType
Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VAR(numbers) )

Parameters

numbers as xs:anyAtomicType
the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.

Returns

xs:anyAtomicType
the standard deviation, as numeric type

stdeva#1

declare  function excel:stdeva($numbers as xs:anyAtomicType+) as xs:anyAtomicType
Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VARA(numbers) )

Parameters

numbers as xs:anyAtomicType
the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.

Returns

xs:anyAtomicType
the standard deviation, as numeric type

stdevp#1

declare  function excel:stdevp($numbers as xs:anyAtomicType+) as xs:anyAtomicType
Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARP(numbers) )

Parameters

numbers as xs:anyAtomicType
the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.

Returns

xs:anyAtomicType
the standard deviation, as numeric type

stdevpa#1

declare  function excel:stdevpa($numbers as xs:anyAtomicType+) as xs:anyAtomicType
Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARPA(numbers) )

Parameters

numbers as xs:anyAtomicType
the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.

Returns

xs:anyAtomicType
the standard deviation, as numeric type

subtotal#2

declare  function excel:subtotal($function_num as xs:integer, $numbers as xs:anyAtomicType*) as xs:anyAtomicType
Moved from math module. Returns a subtotal in a sequence of numbers. The function applied is given by $function_num.

Parameters

function_num as xs:integer
defines the function to be applied on sequence values. The possible values are:
1 or 101
AVERAGE
2 or 102
COUNT
3 or 103
COUNTA
4 or 104
MAX
5 or 105
MIN
6 or 106
PRODUCT
7 or 107
STDEV
8 or 108
STDEVP
9 or 109
SUM
10 or 110
VAR
11 or 111
VARP
In this implementation there is no difference between x and 10x.

numbers as xs:anyAtomicType
the sequence of numbers or values castable to numeric. The sequence can be of any length.

Returns

xs:anyAtomicType
The function result, as numeric type