The variance of a random variable indicates the expected value of squared deviations from the mean. Mathematically, for a random variable X with mean µ, the variance, σ2, is:
Given a set of n returns, R0, R1, R2, …, Rn-1, the variance of the returns could be estimated as follows:
where is the estimate of the mean of the returns.
In practice, a decay factor is often used to place more weight on more recent data points. Given a decay factor, δ, the estimated variance would be:
where is the estimate of the mean based on the same decay factor, and A and B are defined as: