Variance
✖
Variance

Details




- Variance measures dispersion of data or distributions.
- Variance[data] gives the unbiased estimate of variance.
- For VectorQ data
, the variance estimate
is given by
for reals and
for complexes and
=Mean[data].
- For MatrixQ data, the variance estimate
is computed for each column vector, with Variance[{{x1,y1,…},{x2,y2,…},…}] equivalent to {Variance[{x1,x2,…}],Variance[{y1,y2,…}]}. »
- For ArrayQ data, variance is equivalent to ArrayReduce[Variance,data,1]. »
- For a real weighted WeightedData[{x1,x2,…},{w1,w2,…}], the variance is given by
. »
- Variance handles both numerical and symbolic data.
- The data can have the following additional forms and interpretations:
-
Association the values (the keys are ignored) » SparseArray as an array, equivalent to Normal[data] » QuantityArray quantities as an array » WeightedData weighted variance, based on the underlying EmpiricalDistribution » EventData based on the underlying SurvivalDistribution » TimeSeries, TemporalData, … vector or array of values (the time stamps ignored) » Image,Image3D RGB channel's values or grayscale intensity value » Audio amplitude values of all channels » DateObject, TimeObject list of dates or list of time » - For a univariate distribution dist, the variance is given by σ2=Expectation[(x-μ)2,xdist] with μ=Mean[dist]. »
- For a multivariate distribution dist, the variance is given by {σx2,σy2,…}=Expectation[{(x-μx)2,(y-μy)2,…},{x,y,…}dist]. »
- For a random process proc, the variance function can be computed for slice distribution at time t, SliceDistribution[proc,t], as σ[t]2=Variance[SliceDistribution[proc,t]]. »






Examples
open allclose allBasic Examples (4)Summary of the most common use cases
Variance of a list of numbers:

https://wolfram.com/xid/0ftyv7y-gax

Variance of elements in each column:

https://wolfram.com/xid/0ftyv7y-x2c


https://wolfram.com/xid/0ftyv7y-bpyuss

Variance of a parametric distribution:

https://wolfram.com/xid/0ftyv7y-n3bzeg

Scope (22)Survey of the scope of standard use cases
Basic Uses (7)
Exact input yields exact output:

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


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

Approximate input yields approximate output:

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


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

Find the variance of WeightedData:

https://wolfram.com/xid/0ftyv7y-d0wc9z


https://wolfram.com/xid/0ftyv7y-gbwndp

https://wolfram.com/xid/0ftyv7y-h8f9w3

Find the variance of EventData:

https://wolfram.com/xid/0ftyv7y-i4ryy7

https://wolfram.com/xid/0ftyv7y-m07ttq

Find the variance of TemporalData:

https://wolfram.com/xid/0ftyv7y-gx0rsr

https://wolfram.com/xid/0ftyv7y-f5ij1t

https://wolfram.com/xid/0ftyv7y-8e999

Find the variance of a TimeSeries:

https://wolfram.com/xid/0ftyv7y-b6530u

https://wolfram.com/xid/0ftyv7y-k0xfjy

The variance depends only on the values:

https://wolfram.com/xid/0ftyv7y-nnfg9

Find the variance of data involving quantities:

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


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

Array Data (5)
Variance for a matrix gives columnwise variances:

https://wolfram.com/xid/0ftyv7y-ezu2uz


https://wolfram.com/xid/0ftyv7y-h4n22m

Variance for a tensor gives columnwise variances at the first level:

https://wolfram.com/xid/0ftyv7y-lw96ov


https://wolfram.com/xid/0ftyv7y-dagpjp


https://wolfram.com/xid/0ftyv7y-nknun


https://wolfram.com/xid/0ftyv7y-ma3v2m

When the input is an Association, Variance works on its values:

https://wolfram.com/xid/0ftyv7y-cs7n5q


https://wolfram.com/xid/0ftyv7y-bv5njj

SparseArray data can be used just like dense arrays:

https://wolfram.com/xid/0ftyv7y-n691tv


https://wolfram.com/xid/0ftyv7y-drrysl

Find the variance of a QuantityArray:

https://wolfram.com/xid/0ftyv7y-lgwnaj


https://wolfram.com/xid/0ftyv7y-k03qc6

Image and Audio Data (2)
Channelwise variance of an RGB image:

https://wolfram.com/xid/0ftyv7y-hfby9q

Variance of a grayscale image:

https://wolfram.com/xid/0ftyv7y-ue2gq5

On audio objects, Variance works channelwise:

https://wolfram.com/xid/0ftyv7y-nq1jnz


https://wolfram.com/xid/0ftyv7y-mjmudf


https://wolfram.com/xid/0ftyv7y-bs38vd

Date and Time (5)

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

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


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


https://wolfram.com/xid/0ftyv7y-jbrj2r

Compute the weighted variance of dates:

https://wolfram.com/xid/0ftyv7y-c98kbd


https://wolfram.com/xid/0ftyv7y-8c1had

https://wolfram.com/xid/0ftyv7y-t71b2h

Compute the variance of dates given in different calendars:

https://wolfram.com/xid/0ftyv7y-wbzcuv


https://wolfram.com/xid/0ftyv7y-9ius88


https://wolfram.com/xid/0ftyv7y-o3oukb

Compute the variance of times:

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


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

Compute the variance of times with different time zone specifications:

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


https://wolfram.com/xid/0ftyv7y-1d7sk5

Distributions and Processes (3)
Find the variance for univariate distributions:

https://wolfram.com/xid/0ftyv7y-rxz55


https://wolfram.com/xid/0ftyv7y-hbq28j


https://wolfram.com/xid/0ftyv7y-ek075b


https://wolfram.com/xid/0ftyv7y-lzwoz3

Variance for derived distributions:

https://wolfram.com/xid/0ftyv7y-rgc72x


https://wolfram.com/xid/0ftyv7y-byqvvz


https://wolfram.com/xid/0ftyv7y-215ry

https://wolfram.com/xid/0ftyv7y-fq5ptk

Variance function for a random process:

https://wolfram.com/xid/0ftyv7y-fugn


https://wolfram.com/xid/0ftyv7y-g9pmgp

Applications (5)Sample problems that can be solved with this function
Variance is a measure of dispersion:

https://wolfram.com/xid/0ftyv7y-bhnrki

https://wolfram.com/xid/0ftyv7y-t94no


https://wolfram.com/xid/0ftyv7y-o9323q

Compute a moving variance for samples of three random processes:

https://wolfram.com/xid/0ftyv7y-ebo2c

https://wolfram.com/xid/0ftyv7y-e3pstb

Compare data volatility by smoothing with moving variance:

https://wolfram.com/xid/0ftyv7y-ii17q9

https://wolfram.com/xid/0ftyv7y-yg9t0a

Find the mean and variance for the number of great inventions and scientific discoveries in each year from 1860 to 1959:

https://wolfram.com/xid/0ftyv7y-kq0wb5


https://wolfram.com/xid/0ftyv7y-nfevvf


https://wolfram.com/xid/0ftyv7y-b7us08

Investigate weak stationarity of the process data by analyzing variance of slices:

https://wolfram.com/xid/0ftyv7y-r14k0m

https://wolfram.com/xid/0ftyv7y-hq9gxo

https://wolfram.com/xid/0ftyv7y-byyqpk

https://wolfram.com/xid/0ftyv7y-nhaulq

Use a larger plot range to see how relatively small the variations are:

https://wolfram.com/xid/0ftyv7y-xwv2xr

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

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

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


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

Properties & Relations (11)Properties of the function, and connections to other functions
The square root of Variance is StandardDeviation:

https://wolfram.com/xid/0ftyv7y-iu5


https://wolfram.com/xid/0ftyv7y-j7q

Variance is a scaled squared Norm of deviations from the Mean:

https://wolfram.com/xid/0ftyv7y-lp8ujb

https://wolfram.com/xid/0ftyv7y-dt87yu


https://wolfram.com/xid/0ftyv7y-k1qqbw

Variance is a scaled CentralMoment:

https://wolfram.com/xid/0ftyv7y-bps8zf

https://wolfram.com/xid/0ftyv7y-fess9s


https://wolfram.com/xid/0ftyv7y-ct1qwp

The square root of Variance is a scaled RootMeanSquare of the deviations:

https://wolfram.com/xid/0ftyv7y-hqtrtd

https://wolfram.com/xid/0ftyv7y-cyyyvo


https://wolfram.com/xid/0ftyv7y-efwiiv

Variance is a scaled Mean of squared deviations from the Mean:

https://wolfram.com/xid/0ftyv7y-brtwin

https://wolfram.com/xid/0ftyv7y-hmk853


https://wolfram.com/xid/0ftyv7y-cibwnc

Variance is a scaled SquaredEuclideanDistance from the Mean:

https://wolfram.com/xid/0ftyv7y-cqnxdq

https://wolfram.com/xid/0ftyv7y-kigjh4


https://wolfram.com/xid/0ftyv7y-dnccw


https://wolfram.com/xid/0ftyv7y-enaymy


https://wolfram.com/xid/0ftyv7y-u9svr

Variance is less than MeanDeviation if all absolute deviations are less than 1:

https://wolfram.com/xid/0ftyv7y-gqobe7

https://wolfram.com/xid/0ftyv7y-e1pum5


https://wolfram.com/xid/0ftyv7y-g876u6

Variance is greater than MeanDeviation if all absolute deviations are greater than 1:

https://wolfram.com/xid/0ftyv7y-h25qvy

https://wolfram.com/xid/0ftyv7y-b1r9du


https://wolfram.com/xid/0ftyv7y-felohq

Variance of a random variable as an Expectation:

https://wolfram.com/xid/0ftyv7y-c5emif

https://wolfram.com/xid/0ftyv7y-cl5rpb


https://wolfram.com/xid/0ftyv7y-ekl2fe

Variance gives an unbiased sample estimate:

https://wolfram.com/xid/0ftyv7y-fdwqgp

Unbiased means that the expected value of the sample variance with respect to the population distribution equals the variance of the underlying distribution:

https://wolfram.com/xid/0ftyv7y-e5xxe6


https://wolfram.com/xid/0ftyv7y-cg6nq9

Variance gives an unbiased weighted sample estimate:

https://wolfram.com/xid/0ftyv7y-6kl30


https://wolfram.com/xid/0ftyv7y-ith2bq

Unbiased means that the expected value of the sample variance with respect to the population distribution equals the variance of the underlying distribution:

https://wolfram.com/xid/0ftyv7y-dd9yts


https://wolfram.com/xid/0ftyv7y-h81hib

Neat Examples (1)Surprising or curious use cases
The distribution of Variance estimates for 20, 100, and 300 samples:

https://wolfram.com/xid/0ftyv7y-fh2wz


https://wolfram.com/xid/0ftyv7y-8raem

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