trimmed_mean

std.stats.trimmed_mean · Level L2

Mean without the smallest and the largest value, which makes it resistant to one outlier at each end.

(1/(n − 2))·Σ₁≤ᵢ≤ₙ₋₂ x₍ᵢ₎

Signature

trimmed_mean(x: f64[n]) → f64[]

Requires: n ≥ 3

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

xf64[n]SortsSizen2.0SliceinnerSubtractkeptReduceSumtotalDividemmf64[]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size with n ≥ 3.
  • Equal to the reference np.mean(np.sort(x)[1:-1]) in exact rational arithmetic, on all 40 test cases.
  • All 40 float64 results inside the running error bound; the closest uses 22% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
93%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
1.29

Identity

Calls
—
Called by
—
sha256:bd5d2e3e95ccc3ca696a5286517f2897468e236f9882ab4d79d82c3109991588

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.