TrimmedMean
✖
TrimmedMean

gives the mean of the elements in list after dropping a fraction f of the smallest and largest elements.
gives the mean when a fraction f1 of the smallest elements and a fraction f2 of the largest elements are removed.
Details

- TrimmedMean gives a robust estimate of the mean by excluding extreme values.
- The trimming fraction is determined by the parameters f1 and f2, which indicate the fraction f1 of the smallest elements and the fraction f2 of the largest elements to be removed.
- TrimmedMean[list,{f1,f2}] gives the mean of Sort[list,Less]〚1+
;;n-
〛, where n equals the length of list.
- TrimmedMean[{{x1,y1,…},{x2,y2,…},…},f] gives {TrimmedMean[{x1,x2,…},f],TrimmedMean[{y1,y2,…},f],…}.
- TrimmedMean[dist,{f1,f2}] gives Mean[TruncatedDistribution[Quantile[dist,{f1,1-f2}],dist]] for a univariate distribution dist.

Examples
open allclose allBasic Examples (4)Summary of the most common use cases
Trimmed mean after removing extreme values:

https://wolfram.com/xid/05fh8k165m-cacnen

Trimmed mean after removing the smallest extreme values:

https://wolfram.com/xid/05fh8k165m-clbc5x

Trimmed mean of a list of dates:

https://wolfram.com/xid/05fh8k165m-prok5d


https://wolfram.com/xid/05fh8k165m-ziof1v

Trimmed mean of a symbolic distribution:

https://wolfram.com/xid/05fh8k165m-b133z2

Scope (10)Survey of the scope of standard use cases
Data (9)
Exact input yields exact output:

https://wolfram.com/xid/05fh8k165m-ug7y2


https://wolfram.com/xid/05fh8k165m-bcry2t

Approximate input yields approximate output:

https://wolfram.com/xid/05fh8k165m-ksx55


https://wolfram.com/xid/05fh8k165m-d02ofx

TrimmedMean for a matrix gives columnwise means:

https://wolfram.com/xid/05fh8k165m-jywoa6

Trimmed mean works with large arrays:

https://wolfram.com/xid/05fh8k165m-enve04


https://wolfram.com/xid/05fh8k165m-if5yx4

SparseArray data can be used just like dense arrays:

https://wolfram.com/xid/05fh8k165m-2bvdh

https://wolfram.com/xid/05fh8k165m-paeyu

Trimmed mean of a TimeSeries:

https://wolfram.com/xid/05fh8k165m-tg8p6z

https://wolfram.com/xid/05fh8k165m-ffhpdi

Trimmed mean depends only on the values:

https://wolfram.com/xid/05fh8k165m-fy9fte

Trimmed mean works with data involving quantities:

https://wolfram.com/xid/05fh8k165m-jopin9


https://wolfram.com/xid/05fh8k165m-e8c21s

Compute trimmed mean of dates:

https://wolfram.com/xid/05fh8k165m-b1smxx

https://wolfram.com/xid/05fh8k165m-pa4nmn


https://wolfram.com/xid/05fh8k165m-uok1il

Compute trimmed mean of times:

https://wolfram.com/xid/05fh8k165m-et9bla


https://wolfram.com/xid/05fh8k165m-ztsexm

List of times with different time zone specifications:

https://wolfram.com/xid/05fh8k165m-mrqghz


https://wolfram.com/xid/05fh8k165m-ow7hca


https://wolfram.com/xid/05fh8k165m-rq9534

Applications (3)Sample problems that can be solved with this function
Obtain a robust estimate of location when outliers are present:

https://wolfram.com/xid/05fh8k165m-cexxtn

Extreme values have a large influence on the Mean:

https://wolfram.com/xid/05fh8k165m-blrzc0

Simulate a trajectory with heavy-tailed measurement noise:

https://wolfram.com/xid/05fh8k165m-f63fz9
The underlying signal and simulated path with noise:

https://wolfram.com/xid/05fh8k165m-fh1mi1

Smooth the trajectory using a moving TrimmedMean:

https://wolfram.com/xid/05fh8k165m-l6h0g9

https://wolfram.com/xid/05fh8k165m-brc3ht
Increasing the block size gives a smoother trajectory:

https://wolfram.com/xid/05fh8k165m-bb2lqb

Find a trimmed mean for the heights of children in a class:

https://wolfram.com/xid/05fh8k165m-cevfij

https://wolfram.com/xid/05fh8k165m-fllmtw


https://wolfram.com/xid/05fh8k165m-celepo


https://wolfram.com/xid/05fh8k165m-fgqfgk


https://wolfram.com/xid/05fh8k165m-cny2bx

Plot the trimmed mean as a function of trimmed fraction:

https://wolfram.com/xid/05fh8k165m-dcgq58

https://wolfram.com/xid/05fh8k165m-doz2wp

Properties & Relations (5)Properties of the function, and connections to other functions
A 0% TrimmedMean is equivalent to Mean:

https://wolfram.com/xid/05fh8k165m-k3hcsh


https://wolfram.com/xid/05fh8k165m-fc96q6

TrimmedMean approaches Median as f approaches 1/2:

https://wolfram.com/xid/05fh8k165m-dy2d21

https://wolfram.com/xid/05fh8k165m-h9emyc


https://wolfram.com/xid/05fh8k165m-ed6bml

TrimmedMean of a distribution is the mean of its TruncatedDistribution:

https://wolfram.com/xid/05fh8k165m-yd3d3n

https://wolfram.com/xid/05fh8k165m-lr5uh3

Mean of the TruncatedDistribution with appropriate bounds:

https://wolfram.com/xid/05fh8k165m-clxbr6

https://wolfram.com/xid/05fh8k165m-u4mwsn

TrimmedMean of a sample gives an estimate of the mean of a truncated distribution:

https://wolfram.com/xid/05fh8k165m-jcz7or

https://wolfram.com/xid/05fh8k165m-dmr8h

Mean of the TruncatedDistribution with appropriate bounds:

https://wolfram.com/xid/05fh8k165m-j8hhnt

https://wolfram.com/xid/05fh8k165m-bo98xv

TrimmedMean drops the data beyond a certain quantile level, then computes the sample mean:

https://wolfram.com/xid/05fh8k165m-cm3s6i

https://wolfram.com/xid/05fh8k165m-01haem

https://wolfram.com/xid/05fh8k165m-bgojw

WinsorizedMean clips the data beyond a certain quantile level, then computes the sample mean:

https://wolfram.com/xid/05fh8k165m-wlch5r

https://wolfram.com/xid/05fh8k165m-xbwg2

Plot the sorted data against the sample with elements removed and the clipped sample:

https://wolfram.com/xid/05fh8k165m-gc5h1e

https://wolfram.com/xid/05fh8k165m-elvj1j

Possible Issues (1)Common pitfalls and unexpected behavior
Wolfram Research (2007), TrimmedMean, Wolfram Language function, https://reference.wolfram.com/language/ref/TrimmedMean.html (updated 2024).
Text
Wolfram Research (2007), TrimmedMean, Wolfram Language function, https://reference.wolfram.com/language/ref/TrimmedMean.html (updated 2024).
Wolfram Research (2007), TrimmedMean, Wolfram Language function, https://reference.wolfram.com/language/ref/TrimmedMean.html (updated 2024).
CMS
Wolfram Language. 2007. "TrimmedMean." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/TrimmedMean.html.
Wolfram Language. 2007. "TrimmedMean." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/TrimmedMean.html.
APA
Wolfram Language. (2007). TrimmedMean. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TrimmedMean.html
Wolfram Language. (2007). TrimmedMean. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TrimmedMean.html
BibTeX
@misc{reference.wolfram_2025_trimmedmean, author="Wolfram Research", title="{TrimmedMean}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/TrimmedMean.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_trimmedmean, organization={Wolfram Research}, title={TrimmedMean}, year={2024}, url={https://reference.wolfram.com/language/ref/TrimmedMean.html}, note=[Accessed: 29-March-2025
]}