mcframework.stats_engine.mean#
- mcframework.stats_engine.mean(x: ndarray, ctx: StatsContext) float | None[source]#
Sample mean \(\bar X = \frac{1}{n}\sum_{i=1}^n x_i\).
- Parameters:
- x
ndarray Input sample.
- ctx
StatsContext If
nan_policy="omit", non-finite values are excluded.
- x
- Returns:
Notes
The averaging is performed on the filtered array returned by
_clean(), so the effective sample size corresponds to the number of finite values that survive the configured NaN policy.Examples
>>> mean(np.array([1, 2, 3]), StatsContext(n=3)) 2.0