Revision as of 22:47, 12 January 2016 by Bbecane (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Mean(x, I, w)

Mean() computes the arithmetic average or weighted mean of an uncertain quantity «x», dependent on Analytica distribution functions. The full declaration is:

Mean(x : ContextSamp[I]; I: optional Index=Run; w: optional NonNegative[I])

Optional parameters


When the running index «I» is the system index Run (or not specified), the value of «x» is evaluated in Sample mode and the average value among numeric values computed. If the running index is anything other than Run, then «x» is evaluated in context.


Each sample point along the running index «I» can be assigned a non-negative weight to obtain Weighted Mean. When the running index «I» is the system index Run, the weights in the system variable SampleWeighting are used by default, otherwise samples are weighted equally by default. These weighting can be overridden by supplying the optional «w» parameter.

The weighted mean is defined by

[math]\displaystyle{ \sum_i w_i x_i / \sum_i w_i }[/math]

Mean will return NaN if both +INF and -INF are present in «x» with non-zero weight. Any INF or -INF sample with zero weight will be ignored. (Note: 0*INF = NAN, so this is not quite identical to the dot product above. Similarly, Mean will return NaN if there is any x_i = NAN having non-zero weight.

If there are non-numeric values in «x», they are ignored without an error or warning. The weighted mean is taken only over the numeric elements of «x». If there are no numeric elements, the result is NaN.

See Also


You are not allowed to post comments.