Variance
Variance [data]
gives the variance estimate of the elements in data.
Variance [dist]
gives the variance of the distribution dist.
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 »
- 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)
Variance of a list of numbers:
Variance of elements in each column:
Variance of a list of dates:
Variance of a parametric distribution:
Scope (22)
Basic Uses (7)
Exact input yields exact output:
Approximate input yields approximate output:
Find the variance of WeightedData :
Find the variance of EventData :
Find the variance of TemporalData :
Find the variance of a TimeSeries :
The variance depends only on the values:
Find the variance of data involving quantities:
Array Data (5)
Variance for a matrix gives columnwise variances:
Variance for a tensor gives columnwise variances at the first level:
Works with large arrays:
When the input is an Association , Variance works on its values:
SparseArray data can be used just like dense arrays:
Find the variance of a QuantityArray :
Image and Audio Data (2)
Channelwise variance of an RGB image:
Variance of a grayscale image:
On audio objects, Variance works channelwise:
Date and Time (5)
Compute variance of dates:
Compute the weighted variance of dates:
Compute the variance of dates given in different calendars:
Compute the variance of times:
Compute the variance of times with different time zone specifications:
Distributions and Processes (3)
Find the variance for univariate distributions:
Multivariate distributions:
Variance for derived distributions:
Data distribution:
Variance function for a random process:
Applications (5)
Variance is a measure of dispersion:
Compute a moving variance for samples of three random processes:
Compare data volatility by smoothing with moving variance:
Find the mean and variance for the number of great inventions and scientific discoveries in each year from 1860 to 1959:
Investigate weak stationarity of the process data by analyzing variance of slices:
Use a larger plot range to see how relatively small the variations are:
Find the variance of the heights for the children in a class:
Properties & Relations (11)
The square root of Variance is StandardDeviation :
Variance is a scaled squared Norm of deviations from the Mean :
Variance is a scaled CentralMoment :
The square root of Variance is a scaled RootMeanSquare of the deviations:
Variance is a scaled Mean of squared deviations from the Mean :
Variance is a scaled SquaredEuclideanDistance from the Mean :
Variance is less than MeanDeviation if all absolute deviations are less than 1:
Variance is greater than MeanDeviation if all absolute deviations are greater than 1:
Variance of a random variable as an Expectation :
Variance gives an unbiased sample estimate:
Unbiased means that the expected value of the sample variance with respect to the population distribution equals the variance of the underlying distribution:
Variance gives an unbiased weighted sample estimate:
Unbiased means that the expected value of the sample variance with respect to the population distribution equals the variance of the underlying distribution:
Neat Examples (1)
The distribution of Variance estimates for 20, 100, and 300 samples:
See Also
StandardDeviation Covariance Correlation TrimmedVariance WinsorizedVariance BiweightMidvariance QnDispersion SnDispersion Mean MeanDeviation MedianDeviation Kurtosis CentralMoment Expectation
Function Repository: PopulationVariance VarianceAround VarianceRatioCI PooledVariance GeneralizedVariance HedgesG
Tech Notes
Related Guides
-
▪
- Descriptive Statistics ▪
- Statistical Data Analysis ▪
- GPU Computing ▪
- Math & Counting Operations on Lists ▪
- Time Series Processing ▪
- Statistical Moments and Generating Functions ▪
- Numerical Data ▪
- Scientific Data Analysis ▪
- Precollege Education ▪
- Image Processing & Analysis ▪
- Finite Mathematics ▪
- Probability & Statistics ▪
- GPU Computing with Apple ▪
- GPU Computing with NVIDIA ▪
- Date & Time ▪
- Signal Visualization & Analysis ▪
- Audio Processing ▪
- Symbolic Vectors, Matrices and Arrays
History
Introduced in 2003 (5.0) | Updated in 2007 (6.0) ▪ 2023 (13.3) ▪ 2024 (14.1)
Text
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.
APA
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: 14-April-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: 14-April-2025 ]}