Descriptive statistics formulas
Notation: n is the number of values in a sample and N the size of a whole population; x̄ is the sample mean and μ the population mean; Σ means sum over all values.
| Statistic | Formula | Notes |
|---|---|---|
| Mean (sample) | x̄ = Σx ÷ n | Population mean μ = Σx ÷ N |
| Median | Middle value of the sorted data | Average of the two middle values when n is even |
| Mode | Most frequent value | A data set may have several modes or none |
| Range | max − min | Sensitive to outliers |
| Population variance | σ² = Σ(x − μ)² ÷ N | Every member of the population is measured |
| Sample variance | s² = Σ(x − x̄)² ÷ (n − 1) | n − 1 (Bessel's correction) makes s² unbiased |
| Standard deviation | σ = √σ², s = √s² | Same units as the data |
| Standard error of the mean | SE = s ÷ √n | Spread of the sample mean |
| z-score | z = (x − μ) ÷ σ | Standard deviations above (+) or below (−) the mean |
| Coefficient of variation | CV = s ÷ x̄ × 100% | Only meaningful for ratio-scale data |
| Interquartile range | IQR = Q₃ − Q₁ | Quartile methods differ slightly between textbooks and software |
| Skewness (moment coefficient) | g₁ = [Σ(x − x̄)³ ÷ n] ÷ [Σ(x − x̄)² ÷ n]^(3/2) | 0 for symmetric data; positive means a longer right tail |
Sources: NIST/SEMATECH: e-Handbook of Statistical Methods §1.3.5.1 Measures of Location; NIST/SEMATECH: e-Handbook of Statistical Methods §1.3.5.6 Measures of Scale; OpenStax: Introductory Statistics 2e §2.7 Measures of the Spread of the Data
Expected value and variance of a random variable
For a discrete random variable X that takes value x with probability P(x), the expected value (expectation) is the probability-weighted average of its outcomes, and the variance measures spread around it.
- Expectation: E[X] = μ = Σ x·P(x)
- Variance: Var(X) = σ² = Σ (x − μ)²·P(x) = E[X²] − (E[X])²
- Linearity: E[aX + b] = a·E[X] + b and Var(aX + b) = a²·Var(X)
- Sum of variables: E[X + Y] = E[X] + E[Y]; Var(X + Y) = Var(X) + Var(Y) when X and Y are independent
Sources: OpenStax: Introductory Statistics 2e §4.2 Mean or Expected Value and Standard Deviation
Worked example
For the data 2, 4, 4, 4, 5, 5, 7, 9 (n = 8), the values below are computed by the Calxy statistics engine. The population and sample standard deviations differ only in the divisor, N versus n − 1.
| Statistic | Value |
|---|---|
| Sum Σx | 40 |
| Mean x̄ | 5.0000 |
| Median | 4.5000 |
| Mode | 4 |
| Q₁ / Q₃ (linear interpolation) | 4.0000 / 5.5000 |
| Population variance σ² | 4.0000 |
| Population SD σ | 2.0000 |
| Sample variance s² | 4.5714 |
| Sample SD s | 2.1381 |
| z-score of 9 (population) | 2.0000 |