Variance

Variance measures the dispersion of a set of data points around their mean value. It is a quantitative expression of the variability or spread in a dataset. In finance it is the base measure of risk for a single asset or a portfolio. Mathematically, the variance (σ2, or Var⁡(X)) of a random variable X is defined as:

σ2 = Var⁡(X) = E[(X − μ)2] = Cov⁡(X,X)

where E is the expectation operator and μ = E[X] is the mean of X. In probability theory, the expected value E is a generalization of the weighted average. Informally, the expected value is the arithmetic mean of the possible values a random variable can take, weighted by the probability of those outcomes.

Expanding the square gives an equivalent form worth knowing because it is the one spreadsheets and one-pass algorithms actually compute — mean of the squares minus square of the mean, no second pass over the data required:

Var⁡(X) = E⁡ [(X − E⁡[X])2] = E⁡ [X2 − 2XE⁡[X] + E⁡[X]2] = E⁡ [X2] − 2E⁡[X]E⁡[X] + E⁡[X]2 = E⁡ [X2] − E⁡[X]2

If X is given as a set of samples (x1,x2,…xn), then mean (arithmetic average) is

μ = E[X] = X¯ = 1 n∑ i=1nx i, and σ2 = 1 n∑ i=1n(x i − μ)2

In many practical situations, the true variance of a population is not known a priori and must be computed somehow. When dealing with extremely large populations, it is not possible to count every object in the population, so the computation must be performed on a sample of the population. This is generally referred to as sample variance or empirical variance. Sample variance can also be applied to the estimation of the variance of a continuous distribution from a sample of that distribution. Correcting for this bias yields the unbiased sample variance, denoted S2.

S2 = 1 n − 1∑ i=1n (x i −X¯)2

In practical terms, a higher variance indicates that the data points are more spread out from the mean.

Standard deviation σ is a square root of variance.