Variance and standard deviation

The standard deviation is a measure of how spread out a set of numbers are. The standard deviation of a set of numbers is the square root of their variance. Variance is usually denoted by σ2 and the standard deviation by σ, and:

σ2 = 1/n Σ(xi - μ)2

where xi is one of n numbers and
μ is the arithmetic mean of n numbers x.

Population and sample variance

The definition of the variance given above is the population variance. The formula given assumes that the calculation is carried out with complete data rather than a sample. If a sample is used, then μ becomes an estimated rather than exact number, which biases the estimate of σ slightly upward. A simple modification of the formula corrects for this:

σ2 = 1/(n-1) Σ(xi - μ)2

Variance of returns

The most common use of the standard deviation in finance is to measure the risk of holding a security or portfolio, by calculating the variance of returns. This is used both directly, and as an intermediate step in calculating numbers such as beta. To calculate the variance of past actual returns we simply calculate returns (usually daily returns) for the period of interest (e.g. today's price divided by yesterday's price minus one), and calculate the variance of that.

The variance of past returns is often used (e.g. in valuation) as an estimate of the variance of future returns. Sometimes (given a suitable model) it may be possible to calculate this from expectations instead. We first need the expected price:

E[S] =ΣSip(Si)

where S is a price
and p(Si) is the probability that S will be the actual price.

Denoting the variance of S, Var(S):

Var(S) = Σ(Si - E[S])2p(Si)

Var(S) is a measure of volatility. Its square root (the standard deviation) is the most widely used measure of volatility.

To use continuous times and prices replace the sums above with integrals.