TrimmedMean
TrimmedMean[list,f]
gives the mean of the elements in list after dropping a fraction f of the smallest and largest elements.
TrimmedMean[list,{f1,f2}]
gives the mean when a fraction f1 of the smallest elements and a fraction f2 of the largest elements are removed.
TrimmedMean[list]
gives the 5% trimmed mean TrimmedMean[list,0.05].
TrimmedMean[dist,…]
gives the trimmed mean of a univariate distribution dist.
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)
Scope (10)
Data (9)
Exact input yields exact output:
Approximate input yields approximate output:
TrimmedMean for a matrix gives columnwise means:
Trimmed mean works with large arrays:
SparseArray data can be used just like dense arrays:
Trimmed mean of a TimeSeries:
Trimmed mean depends only on the values:
Trimmed mean works with data involving quantities:
Compute trimmed mean of dates:
Applications (3)
Obtain a robust estimate of location when outliers are present:
Extreme values have a large influence on the Mean:
Simulate a trajectory with heavy-tailed measurement noise:
The underlying signal and simulated path with noise:
Smooth the trajectory using a moving TrimmedMean:
Increasing the block size gives a smoother trajectory:
Properties & Relations (5)
A 0% TrimmedMean is equivalent to Mean:
TrimmedMean approaches Median as f approaches 1/2:
TrimmedMean of a distribution is the mean of its TruncatedDistribution:
Mean of the TruncatedDistribution with appropriate bounds:
TrimmedMean of a sample gives an estimate of the mean of a truncated distribution:
Mean of the TruncatedDistribution with appropriate bounds:
TrimmedMean drops the data beyond a certain quantile level, then computes the sample mean:
WinsorizedMean clips the data beyond a certain quantile level, then computes the sample mean:
Plot the sorted data against the sample with elements removed and the clipped sample:
Possible Issues (1)
TrimmedMean requires numeric values:
Text
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.
APA
Wolfram Language. (2007). TrimmedMean. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TrimmedMean.html