Difference between revisions of "Mean"

m (adding doc status category)
 
Line 2: Line 2:
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
 
   
 
   
Computes the arithmetic average or weighted mean of an uncertain quantity.
 
  
= Declaration =
+
==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])
  
Mean( x : ContextSamp[I] ; I : optional Index=Run ; w : optional NonNegative[I])
+
==Optional parameters==
 +
===I===
 +
When the running index «I» is the system index [[Run]] (or not specified), the value of «x» is evaluated in [[Evaluation Modes|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.
  
= Simple Usage =
+
=== W ===
 
+
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 defaultThese weighting can be overridden by supplying the optional «w» parameter.  
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 [[Evaluation Modes|Sample mode]] and the average value among numeric values computedIf the running index is anything other than Run, then X is evaluated in context.
 
 
 
= Description =
 
  
 
The weighted mean is defined by
 
The weighted mean is defined by
  
<math>\sum_i w_i x_i / \sum_i w_i</math>
+
:<math>\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.  
+
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: <code>0*INF = NAN</code>, so this is not quite identical to the dot product above. Similarly, [[Mean]] will return [[NaN]] if there is any <code>x_i = NAN</code> having non-zero weight.  
  
= See Also =
+
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 ==
  
 
* [[Statistical Functions and Importance Weighting]]
 
* [[Statistical Functions and Importance Weighting]]
 
* [[Average]]
 
* [[Average]]

Latest revision as of 22:47, 12 January 2016


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

I

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.

W

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

Comments


You are not allowed to post comments.