1. The Bridge from Sample to Population
In statistical inference, we never observe the full theoretical population $\mathcal{P}$. Instead, we gather a finite sample $\mathcal{S} = {x_1, x_2, \dots, x_n}$.
Every statistic we compute from data (such as the sample mean $\bar{x}$ or sample variance $s^2$) is itself a random variable. If we repeated the experiment 1,000 times, we would obtain 1,000 different sample means.
The probability distribution of a statistic over repeated random sampling is its Sampling Distribution.
text
2. Standard Error of the Mean (SE) vs. Standard Deviation (SD)
A ubiquitous mistake in engineering reports is confusing Standard Deviation ($\sigma$ or $s$) with Standard Error ($\text{SE}$):
- Standard Deviation ($s$): Measures the natural variability of individual data points in the population. It does NOT shrink as sample size $n$ increases.
- Standard Error ($\text{SE}$): Measures the precision of the estimated sample mean $\bar{x}$. It shrinks inversely with $\sqrt{n}$.
The Standard Error Formula
$$\text{SE}(\bar{x}) = \frac{\sigma}{\sqrt{n}} \approx \frac{s}{\sqrt{n}}$$
text
To cut uncertainty in half, you must quadruple the sample size ($4n$).
3. Bessel's Correction: Why Divide by $(n - 1)$?
When computing sample variance, the naive formula $\frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2$ systematically underestimates the true population variance $\sigma^2$. To make the estimator unbiased, we divide by $n - 1$.
Formal Mathematical Proof:
Let $x_1, \dots, x_n$ be i.i.d. random variables with true mean $\mu$ and true variance $\sigma^2$.
Let $S_{\text{naive}}^2 = \frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2$.
- Rewrite the deviation using the true mean $\mu$: $$x_i - \bar{x} = (x_i - \mu) - (\bar{x} - \mu)$$
- Square both sides: $$(x_i - \bar{x})^2 = (x_i - \mu)^2 - 2(x_i - \mu)(\bar{x} - \mu) + (\bar{x} - \mu)^2$$
- Sum over all $i = 1, \dots, n$: $$\sum_{i=1}^n (x_i - \bar{x})^2 = \sum_{i=1}^n (x_i - \mu)^2 - 2(\bar{x} - \mu) \sum_{i=1}^n (x_i - \mu) + n(\bar{x} - \mu)^2$$ Since $\sum_{i=1}^n (x_i - \mu) = n(\bar{x} - \mu)$: $$\sum_{i=1}^n (x_i - \bar{x})^2 = \sum_{i=1}^n (x_i - \mu)^2 - 2n(\bar{x} - \mu)^2 + n(\bar{x} - \mu)^2 = \sum_{i=1}^n (x_i - \mu)^2 - n(\bar{x} - \mu)^2$$
- Take expectations of both sides: $$E\left[ \sum_{i=1}^n (x_i - \bar{x})^2 \right] = \sum_{i=1}^n E[(x_i - \mu)^2] - n E[(\bar{x} - \mu)^2]$$ Notice that $E[(x_i - \mu)^2] = \sigma^2$, and $E[(\bar{x} - \mu)^2] = \text{Var}(\bar{x}) = \frac{\sigma^2}{n}$: $$E\left[ \sum_{i=1}^n (x_i - \bar{x})^2 \right] = n\sigma^2 - n\left(\frac{\sigma^2}{n}\right) = n\sigma^2 - \sigma^2 = (n - 1)\sigma^2$$
- Divide by $n$: $$E[S_{\text{naive}}^2] = \frac{n - 1}{n} \sigma^2 \neq \sigma^2 \quad (\text{Biased by factor } \frac{n-1}{n}!)$$
- Therefore, the unbiased sample variance estimator is: $$s^2 = \frac{1}{n - 1} \sum_{i=1}^n (x_i - \bar{x})^2 \implies E[s^2] = \frac{1}{n-1} (n - 1)\sigma^2 = \sigma^2 \quad \blacksquare$$
Degrees of Freedom: We lose 1 degree of freedom because the residuals $(x_i - \bar{x})$ must sum to 0 ($\sum (x_i - \bar{x}) = 0$). Once $n - 1$ residuals are known, the last residual is fixed.
4. Fundamental Sampling Distributions
4.1 Chi-Square Distribution ($\chi^2_\nu$)
Let $Z_1, Z_2, \dots, Z_\nu \sim \mathcal{N}(0, 1)$ be independent standard normal random variables. The sum of their squares follows a Chi-Square distribution with $\nu$ degrees of freedom:
$$V = \sum_{i=1}^\nu Z_i^2 \sim \chi^2_\nu$$
- Mean: $E[V] = \nu$
- Variance: $\text{Var}(V) = 2\nu$
- Sampling Theorem: If $x_1, \dots, x_n \sim \mathcal{N}(\mu, \sigma^2)$, then: $$\frac{(n - 1)s^2}{\sigma^2} \sim \chi^2_{n - 1}$$
4.2 Student's $t$-Distribution ($t_\nu$)
When the true population standard deviation $\sigma$ is unknown, we substitute the sample standard deviation $s$.
The standardized quantity no longer follows a Normal distribution! It follows Student's $t$-distribution:
$$T = \frac{\bar{x} - \mu}{s / \sqrt{n}} \sim t_{n - 1}$$
Mathematically, a $t$-distribution is defined as the ratio of an independent standard normal variable to the square root of a scaled chi-square variable:
$$T = \frac{Z}{\sqrt{V / \nu}}, \quad Z \sim \mathcal{N}(0, 1), \quad V \sim \chi^2_\nu$$
text
4.3 Snedecor's $F$-Distribution ($F_{\nu_1, \nu_2}$)
The ratio of two independent, scaled Chi-Square random variables:
$$F = \frac{V_1 / \nu_1}{V_2 / \nu_2} \sim F_{\nu_1, \nu_2}, \quad V_1 \sim \chi^2_{\nu_1}, \quad V_2 \sim \chi^2_{\nu_2}$$
- Core Use Case: Comparing the ratio of two sample variances ($s_1^2 / s_2^2$) in ANOVA and regression $F$-tests.
5. Python Implementation: Verifying Bessel's Correction & Sampling
python
6. Key Takeaways
- SD vs SE: Standard deviation describes data spread; standard error describes estimator precision ($\sigma / \sqrt{n}$).
- Bessel's Correction: Dividing by $n - 1$ compensates for centering around the sample mean $\bar{x}$ instead of the true mean $\mu$.
- Student's $t$ for Finite Samples: Whenever sample size is moderate ($n < 30$) and $\sigma$ is estimated via $s$, use Student's $t$ to account for heavier tails.