Critical fix: Corrected the proportional trimmed
mean formula for cases where k = trim * n >= 1. The
previous implementation (v0.1.0) incorrectly applied a
(1 - k) discount to x[1] and x[n]
for all cases, which is only correct when k < 1 (Type A
distortion). For k >= 1, this produced incorrect
results.
For exact integer k >= 2, sgmean()
now correctly returns the same result as mean(..., trim)
(as documented and expected).
For non-integer k > 1 (Type B distortion),
sgmean() now correctly applies a fractional discount
(1 - delta) to x[floor(k) + 1] and
x[n - floor(k)], consistent with expression (4) of the
companion article and verified against Statgraphics output.
The fix was discovered and verified during peer review of the companion article submitted to The R Journal. The corrected implementation produces results identical to Statgraphics for all tested cases.
mean(..., trim)mean(..., trim).