TrimmedVariance
✖
TrimmedVariance

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

- TrimmedVariance gives a robust estimate of the variance 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.
- TrimmedVariance[list,{f1,f2}] gives the variance of Sort[list,Less]〚1+
;;n-
〛 where n equals the length of list.
- TrimmedVariance[{{x1,y1,…},{x2,y2,…},…},f] gives {TrimmedVariance[{x1,x2,…},f],TrimmedVariance[{y1,y2,…},f],…}.
- TrimmedVariance[dist,{f1,f2}] gives Variance[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 variance after removing extreme values:

https://wolfram.com/xid/0gfret6wydge-cacnen

Trimmed variance after removing the smallest extreme values:

https://wolfram.com/xid/0gfret6wydge-clbc5x

Trimmed variance of a list of dates:

https://wolfram.com/xid/0gfret6wydge-wpdopd


https://wolfram.com/xid/0gfret6wydge-ziof1v

Trimmed variance of a symbolic distribution:

https://wolfram.com/xid/0gfret6wydge-b133z2

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

https://wolfram.com/xid/0gfret6wydge-ug7y2


https://wolfram.com/xid/0gfret6wydge-bcry2t

Approximate input yields approximate output:

https://wolfram.com/xid/0gfret6wydge-ksx55


https://wolfram.com/xid/0gfret6wydge-d02ofx

TrimmedVariance for a matrix gives columnwise variances:

https://wolfram.com/xid/0gfret6wydge-jywoa6

Trimmed variance works with large arrays:

https://wolfram.com/xid/0gfret6wydge-enve04


https://wolfram.com/xid/0gfret6wydge-if5yx4

SparseArray data can be used just like dense arrays:

https://wolfram.com/xid/0gfret6wydge-2bvdh

https://wolfram.com/xid/0gfret6wydge-paeyu

Trimmed variance of a TimeSeries:

https://wolfram.com/xid/0gfret6wydge-tg8p6z

https://wolfram.com/xid/0gfret6wydge-ffhpdi

Trimmed variance depends only on the values:

https://wolfram.com/xid/0gfret6wydge-fy9fte

Trimmed variance works with data involving quantities:

https://wolfram.com/xid/0gfret6wydge-jopin9


https://wolfram.com/xid/0gfret6wydge-e8c21s

Compute trimmed variance of dates:

https://wolfram.com/xid/0gfret6wydge-b1smxx

https://wolfram.com/xid/0gfret6wydge-pa4nmn


https://wolfram.com/xid/0gfret6wydge-uok1il


https://wolfram.com/xid/0gfret6wydge-o9ersi

Compute trimmed variance of times:

https://wolfram.com/xid/0gfret6wydge-et9bla


https://wolfram.com/xid/0gfret6wydge-ztsexm

List of times with different time zone specifications:

https://wolfram.com/xid/0gfret6wydge-mrqghz


https://wolfram.com/xid/0gfret6wydge-ow7hca

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

https://wolfram.com/xid/0gfret6wydge-cexxtn

Extreme values have a large influence on the Variance:

https://wolfram.com/xid/0gfret6wydge-blrzc0

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

https://wolfram.com/xid/0gfret6wydge-cevfij

https://wolfram.com/xid/0gfret6wydge-fllmtw


https://wolfram.com/xid/0gfret6wydge-celepo

Plot the trimmed variance as a function of trimmed fraction:

https://wolfram.com/xid/0gfret6wydge-fgqfgk

https://wolfram.com/xid/0gfret6wydge-doz2wp

Plot the square root of the trimmed variance with respect to the trimmed mean:

https://wolfram.com/xid/0gfret6wydge-g98mgx

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

https://wolfram.com/xid/0gfret6wydge-k3hcsh


https://wolfram.com/xid/0gfret6wydge-fc96q6

TrimmedVariance approaches 0 as f approaches 1/2:

https://wolfram.com/xid/0gfret6wydge-dy2d21

https://wolfram.com/xid/0gfret6wydge-ed6bml

TrimmedVariance of a distribution is the variance of its TruncatedDistribution:

https://wolfram.com/xid/0gfret6wydge-yd3d3n

https://wolfram.com/xid/0gfret6wydge-lr5uh3

Variance of the TruncatedDistribution with appropriate bounds:

https://wolfram.com/xid/0gfret6wydge-clxbr6

https://wolfram.com/xid/0gfret6wydge-u4mwsn

TrimmedVariance of a sample gives an estimate of the variance of a truncated distribution:

https://wolfram.com/xid/0gfret6wydge-jcz7or

https://wolfram.com/xid/0gfret6wydge-bj114x

Variance of the TruncatedDistribution with appropriate bounds:

https://wolfram.com/xid/0gfret6wydge-31l1ws

https://wolfram.com/xid/0gfret6wydge-mtzrl

TrimmedVariance drops the data beyond a certain quantile level, then computes the sample variance:

https://wolfram.com/xid/0gfret6wydge-cm3s6i

https://wolfram.com/xid/0gfret6wydge-gmitza

https://wolfram.com/xid/0gfret6wydge-bgojw

WinsorizedVariance clips the data beyond a certain quantile level, then computes the sample variance:

https://wolfram.com/xid/0gfret6wydge-hqnggt

https://wolfram.com/xid/0gfret6wydge-xbwg2

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

https://wolfram.com/xid/0gfret6wydge-gc5h1e

https://wolfram.com/xid/0gfret6wydge-ts5rus

Possible Issues (1)Common pitfalls and unexpected behavior
TrimmedVariance requires numeric values:

https://wolfram.com/xid/0gfret6wydge-g88


Wolfram Research (2017), TrimmedVariance, Wolfram Language function, https://reference.wolfram.com/language/ref/TrimmedVariance.html (updated 2024).
Text
Wolfram Research (2017), TrimmedVariance, Wolfram Language function, https://reference.wolfram.com/language/ref/TrimmedVariance.html (updated 2024).
Wolfram Research (2017), TrimmedVariance, Wolfram Language function, https://reference.wolfram.com/language/ref/TrimmedVariance.html (updated 2024).
CMS
Wolfram Language. 2017. "TrimmedVariance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/TrimmedVariance.html.
Wolfram Language. 2017. "TrimmedVariance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/TrimmedVariance.html.
APA
Wolfram Language. (2017). TrimmedVariance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TrimmedVariance.html
Wolfram Language. (2017). TrimmedVariance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TrimmedVariance.html
BibTeX
@misc{reference.wolfram_2025_trimmedvariance, author="Wolfram Research", title="{TrimmedVariance}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/TrimmedVariance.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_trimmedvariance, organization={Wolfram Research}, title={TrimmedVariance}, year={2024}, url={https://reference.wolfram.com/language/ref/TrimmedVariance.html}, note=[Accessed: 29-March-2025
]}