Mean
Computes the arithmetic average or weighted mean of an uncertain quantity.
Declaration
Mean( x : ContextSamp[I] ; I : optional Index=Run ; w : optional NonNegative[I])
Simple Usage
If X is an uncertain quantity, dependent on Analytica distribution functions, the mean is obtained using
Mean(X)
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.
Description
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 is 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.
Weighted Mean
Each sample point along the running index, I, can be assigned a non-negative weight. 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 overriden by supplying the optional w parameter.
Enable comment auto-refresher