= Variance = '''Variance''' is a measure of dispersion or spread. It is the [[Analysis/Moment#Second_Moment|second central moment]]. <> ---- == Description == Variance is measure of how much observations vary from the [[Analysis/ExpectedValue|expected value]]. If the expected value is expressed in 'units', then variance is expressed in 'units squared'. This can pose challenges to interpretation, so a closely related statistic is the '''standard deviation''': the square root of variance. For a random variable ''X'', the variance is usually notated as ''Var(X)'' or ''Var[X]''. In contexts where the distribution in question is understood, especially [[Analysis/Error|error]] when analyzing a model, more common notations are ''σ^2^'' for population variance or ''s^2^'' for sample variance. (This enables notation like ''s,,i,,^2^'', for the variance of errors for observation ''i''.) ---- == Formulation == Formally, the second central moment (implicitly taking the [[Analysis/ExpectedValue|expected value]] as the center) of a continuous quantitative (numeric) random variable is: {{attachment:cont2central.svg}} where ''Ω'' is the sample space and ''f'' is the probability density function for that distribution. And for a discrete quantitative random variable: {{attachment:dis2central.svg}} where ''Ω'' is the set of possible values and ''f'' is the probability mass function for that distribution (although the distributions of discrete random variables are commonly given as tables, rather than mathematical functions). But when working with a set of observations ''X'', where for each observation ''i'' there is an observed value ''x,,i,,'', the most common formulas for variance are: {{attachment:var.svg}} To get from the first to the second, the derivation for discrete variables is: * ''Σ (x - μ)^2^ P(x=X)'' * ''Σ (x^2^ - 2μx + μ^2^) P(x=X)'' * ''Σ [x^2^ P(x=X)] - 2μ Σ [x P(x=X)] + μ^2^ Σ [P(x=X)]'' * ''[E[X^2^]] - 2μ [μ] + μ^2^ [1]'' * ''E[X^2^] - 2μ^2^ + μ^2^'' * ''E[X^2^] - μ^2^'' * ''E[X^2^] - (E[X])^2^'' The derivation for continuous variables is: * ''∫ (x - μ)^2^ f(x) dx'' * ''∫ (x^2^ - 2μx + μ^2^) f(x) dx'' * ''∫ [x^2^ f(x) dx] - 2μ ∫ [x f(x) dx] + μ^2^ ∫ [f(x) dx]'' * ''[E[X^2^]] - 2μ [μ] + μ^2^ [1]'' * ''E[X^2^] - 2μ^2^ + μ^2^'' * ''E[X^2^] - μ^2^'' * ''E[X^2^] - (E[X])^2^'' (Recall that definitionally, ''1 = ∫ f(x) dx'' for any probability density function.) It should also be clear that you can pick out the formulation as ''Var(X) = Σ(X^2^)/n - (E[X])^2^'', which can be useful in certain situations. ---- == Variance as a Function == If the variance of a random variable ''X'' is known, adding a constant to ''X'' does not change the variance. Multiplying ''X'' by a constant factor scales the known variance by the square of the factor. Succinctly: ''Var(aX + b) = a^2^ Var(X)'' The variance of a ratio, i.e. ''Var(X/Y)'' where both ''X'' and ''Y'' are variable, is nonlinear. ---- CategoryRicottone