WOLFRAM

Variance[data]

gives the variance estimate of the elements in data.

Variance[dist]

gives the variance of the distribution dist.

Details

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Variance of a list of numbers:

Out[1]=1

Variance of elements in each column:

Out[1]=1

Variance of a list of dates:

Out[1]=1

Variance of a parametric distribution:

Out[1]=1

Scope  (22)Survey of the scope of standard use cases

Basic Uses  (7)

Exact input yields exact output:

Out[1]=1
Out[2]=2

Approximate input yields approximate output:

Out[1]=1
Out[2]=2

Find the variance of WeightedData:

Out[1]=1
Out[3]=3

Find the variance of EventData:

Out[2]=2

Find the variance of TemporalData:

Out[3]=3

Find the variance of a TimeSeries:

Out[2]=2

The variance depends only on the values:

Out[3]=3

Find the variance of data involving quantities:

Out[1]=1
Out[2]=2

Array Data  (5)

Variance for a matrix gives columnwise variances:

Out[1]=1

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

Out[5]=5

Works with large arrays:

Out[1]=1
Out[2]=2

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

Out[1]=1
Out[2]=2

SparseArray data can be used just like dense arrays:

Out[1]=1
Out[2]=2

Find the variance of a QuantityArray:

Out[1]=1
Out[2]=2

Image and Audio Data  (2)

Channelwise variance of an RGB image:

Out[1]=1

Variance of a grayscale image:

Out[2]=2

On audio objects, Variance works channelwise:

Out[1]=1
Out[2]=2
Out[3]=3

Date and Time  (5)

Compute variance of dates:

Out[2]=2
Out[3]=3
Out[4]=4

Compute the weighted variance of dates:

Out[1]=1
Out[3]=3

Compute the variance of dates given in different calendars:

Out[1]=1
Out[2]=2
Out[3]=3

Compute the variance of times:

Out[1]=1
Out[2]=2

Compute the variance of times with different time zone specifications:

Out[1]=1
Out[2]=2

Distributions and Processes  (3)

Find the variance for univariate distributions:

Out[1]=1
Out[2]=2

Multivariate distributions:

Out[3]=3
Out[4]=4

Variance for derived distributions:

Out[1]=1
Out[2]=2

Data distribution:

Out[4]=4

Variance function for a random process:

Out[1]=1
Out[2]=2

Applications  (5)Sample problems that can be solved with this function

Variance is a measure of dispersion:

Out[2]=2
Out[3]=3

Compute a moving variance for samples of three random processes:

Out[2]=2

Compare data volatility by smoothing with moving variance:

Out[4]=4

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

Out[1]=1
Out[2]=2
Out[3]=3

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

Out[4]=4

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

Out[5]=5

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

Out[2]=2
Out[3]=3

Properties & Relations  (11)Properties of the function, and connections to other functions

The square root of Variance is StandardDeviation:

Out[1]=1
Out[2]=2

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

Out[2]=2
Out[3]=3

Variance is a scaled CentralMoment:

Out[2]=2
Out[3]=3

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

Out[2]=2
Out[3]=3

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

Out[2]=2
Out[3]=3

Variance is a scaled SquaredEuclideanDistance from the Mean:

Out[2]=2
Out[3]=3
Out[4]=4
Out[5]=5

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

Out[2]=2
Out[3]=3

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

Out[2]=2
Out[3]=3

Variance of a random variable as an Expectation:

Out[2]=2
Out[3]=3

Variance gives an unbiased sample estimate:

Out[1]=1

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

Out[2]=2
Out[3]=3

Variance gives an unbiased weighted sample estimate:

Out[1]=1

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

Out[3]=3
Out[4]=4

Neat Examples  (1)Surprising or curious use cases

The distribution of Variance estimates for 20, 100, and 300 samples:

Out[1]=1
Out[2]=2
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).

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 ]}

@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 ]}

@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 ]}