Variance Calculator

Distribution Visualization

Bernoulli Distribution Variance

The variance of a Bernoulli random variable X with parameter p is Var(X) = p(1-p).

\[ Var(X) = p(1-p) \]

Properties:

  • The variance measures the spread of the random variable around its mean
  • For a Bernoulli distribution, Var(X) = p(1-p), which is maximized at p = 0.5
  • The standard deviation σ = √(p(1-p)) is in the same units as the random variable

Understanding Variance

Definition & Properties

The Variance of a random variable X, denoted by Var(X) or σ², is a measure of the dispersion or spread of the probability distribution. It quantifies how far the values of the random variable typically deviate from the mean.

General Formula:

\[ Var(X) = E[(X - \mu)^2] \]

where μ = E[X] is the mean (expected value) of X.

Discrete Random Variables:

\[ Var(X) = \sum_{i} (x_i - \mu)^2 \cdot P(X = x_i) \]

where xi are the possible values of X and P(X = xi) is the probability of each value.

Continuous Random Variables:

\[ Var(X) = \int_{-\infty}^{\infty} (x - \mu)^2 \cdot f(x) \, dx \]

where f(x) is the probability density function (PDF) of X.

Computational Formula:

\[ Var(X) = E[X^2] - (E[X])^2 \]

This alternative formula is often easier to compute.

Key Properties:

  • Non-negativity: Var(X) ≥ 0 for any random variable X
  • Variance of a constant: Var(c) = 0, for any constant c
  • Effect of scaling: Var(aX) = a²·Var(X), for any constant a
  • Effect of shifting: Var(X + b) = Var(X), for any constant b
  • Variance of sum: Var(X + Y) = Var(X) + Var(Y) + 2·Cov(X,Y), where Cov(X,Y) is the covariance
  • For independent variables: Var(X + Y) = Var(X) + Var(Y)

Standard Deviation & Interpretation

The Standard Deviation (σ) is the square root of the variance:

\[ \sigma = \sqrt{Var(X)} \]

The standard deviation has several important interpretations:

Measure of Dispersion:

The standard deviation measures the typical or average deviation of values from the mean. Unlike variance, it's expressed in the same units as the random variable, making it more directly interpretable.

Probability Rules for Normal Distributions:

For normally distributed variables, the standard deviation determines the probability of observations falling within specific ranges:

  • Approximately 68% of values lie within 1 standard deviation of the mean (μ ± σ)
  • Approximately 95% lie within 2 standard deviations (μ ± 2σ)
  • Approximately 99.7% lie within 3 standard deviations (μ ± 3σ)

This is known as the "empirical rule" or "68-95-99.7 rule."

Coefficient of Variation:

The coefficient of variation (CV) is the ratio of the standard deviation to the mean:

\[ CV = \frac{\sigma}{\mu} \]

It provides a dimensionless measure of relative variability, allowing for comparison of dispersion across different distributions with different units or scales.

Example: Variance in Practice

Consider a discrete random variable X with the following probability distribution:

P(X = 1) = 0.2, P(X = 2) = 0.5, P(X = 3) = 0.3

The mean is:

\[ E[X] = 1 \cdot 0.2 + 2 \cdot 0.5 + 3 \cdot 0.3 = 2.1 \]

The variance is:

\[ Var(X) = (1 - 2.1)^2 \cdot 0.2 + (2 - 2.1)^2 \cdot 0.5 + (3 - 2.1)^2 \cdot 0.3 = 0.49 \]

And the standard deviation is:

\[ \sigma = \sqrt{0.49} = 0.7 \]

Variances for Common Distributions

Distribution Parameters Variance Notes
Bernoulli p = probability of success \(Var(X) = p(1-p)\) Maximized at p = 0.5, where Var(X) = 0.25
Binomial n = number of trials
p = probability of success
\(Var(X) = np(1-p)\) Sum of n independent Bernoulli variances
Geometric p = probability of success \(Var(X) = \frac{1-p}{p^2}\) Increases rapidly as p approaches 0
Poisson λ = rate parameter \(Var(X) = \lambda\) Equal to the mean, a unique property
Uniform a = lower bound
b = upper bound
\(Var(X) = \frac{(b-a)^2}{12}\) Depends only on the range width
Normal μ = mean
σ = standard deviation
\(Var(X) = \sigma^2\) Variance is a parameter of the distribution
Exponential λ = rate parameter \(Var(X) = \frac{1}{\lambda^2}\) Standard deviation equals the mean

Applications of Variance

Finance & Risk Management

Variance is fundamental in portfolio theory as a measure of investment risk. The variance of returns quantifies investment volatility, helping investors balance risk and return. Modern Portfolio Theory uses variance to optimize asset allocation, while Value at Risk (VaR) calculations rely on variance to estimate potential losses.

Science & Research

In experimental sciences, variance measures the reliability and consistency of observations. Low variance suggests high precision in measurements. In statistical hypothesis testing, variance is used to assess whether differences between groups are statistically significant or merely due to random variation in the data.

Quality Control & Manufacturing

Variance is central to Six Sigma and other quality improvement methodologies. Process capability indices like Cp and Cpk compare the variance of a process to specification limits. Statistical Process Control uses variance to set control limits for detecting when a process is operating outside normal parameters.

Machine Learning & AI

In machine learning, variance has dual meanings: as a statistical measure and as a learning theory concept. High-variance models (like deep neural networks) can overfit training data, while variance is used in feature selection to identify informative variables. Principal Component Analysis uses variance to identify the most important dimensions in high-dimensional data.

Test Your Knowledge

Quick Quiz: Variance

1. What is the variance of a Bernoulli random variable with p = 0.5?

A. 0.5
B. 0.75
C. 0.25
D. 1.0

2. The variance of a binomial distribution with n = 10 and p = 0.3 is:

A. 2.1
B. 3.0
C. 1.45
D. 3.3