Sample mean under simple random sampling (source code)

= Sample mean under simple random sampling
{title2=$\operatorname{Var}(\bar y_A)=(1-n/N)S^2/n$}

Fix $N>1$ real population values $y_1,\ldots,y_N$. Define the <finite population mean> and two normalizations of the <finite population variance> by
$$
\bar Y=\frac1N\sum_{i=1}^Ny_i,\qquad
S^2=\frac1{N-1}\sum_{i=1}^N(y_i-\bar Y)^2,\qquad
\sigma_N^2=\frac1N\sum_{i=1}^N(y_i-\bar Y)^2=\frac{N-1}{N}S^2.
$$
The values are fixed; only the selected <subset> $A$ is random. For its <sample mean> $\bar y_A=n^{-1}\sum_{i\in A}y_i$, the exact design <expectation> and <variance> are
$$
\mathbb E[\bar y_A]=\bar Y,\qquad
\operatorname{Var}(\bar y_A)=\left(1-\frac nN\right)\frac{S^2}{n}
=\frac{N-n}{N-1}\frac{\sigma_N^2}{n}.
$$
The <sample mean> is an <unbiased estimator> of the <finite population mean>. At $n=N$, every unit is observed and $\bar y_A=\bar Y$ exactly, so the <variance> is zero. The $N=1$ case is deterministic and is handled directly, since $S^2$ is undefined then.<Sampling Theory/Chapter 2: Simple Random Sampling>[Sampling Theory, Chapter 2, PDF pp. 2, 6–9: variance normalizations, unbiasedness, covariance derivation and finite population correction]{ref}

The <finite population correction> depends on the baseline. With the $N-1$ normalization it is $1-n/N$ multiplying $S^2/n$. With the $N$ normalization it is $(N-n)/(N-1)$ multiplying $\sigma_N^2/n$, the exact <variance> for independent uniform <sampling with replacement>. The <standard error> uses the square root of the relevant <variance> factor. Mixing the two normalizations gives a wrong answer even at $n=1$, when replacement cannot matter. For the six-value example, $\bar Y=7$, $\sum_i(y_i-7)^2=70$, $S^2=14$ and $\sigma_N^2=35/3$, reproducing $14/3$ without replacement and $35/6$ with replacement.

A short proof exposes the <statistical dependence>. Let $X_r$ be the value at position $r$ in uniform sequential <sampling without replacement>, so each $X_r$ has <expected value> $\bar Y$ and <variance> $\sigma_N^2$. Write $d_i=y_i-\bar Y$. Every ordered pair of distinct labels is equally likely, and $\sum_i d_i=0$, hence for $r\ne s$,
$$
\operatorname{Cov}(X_r,X_s)=\frac{\sum_{i\ne j}d_id_j}{N(N-1)}
=\frac{(\sum_i d_i)^2-\sum_i d_i^2}{N(N-1)}
=-\frac{\sigma_N^2}{N-1}=-\frac{S^2}{N}.
$$
<Linearity of expectation> proves unbiasedness without requiring <independence>. The <variance of a sum> includes all $n(n-1)$ ordered <covariance> terms, giving
$$
\operatorname{Var}\left(\frac1n\sum_{r=1}^nX_r\right)
=\frac{n\sigma_N^2-n(n-1)\sigma_N^2/(N-1)}{n^2}.
$$
For the original population, each pair of distinct draw positions has <covariance> $-7/3$. Drawing a high value leaves a lower <mean> among the remaining values, balancing subsequent draws. Equal marginal <probability distributions> therefore coexist with negative <covariance>.

When $2\leq n\leq N$, the <sample variance> $s_A^2=(n-1)^{-1}\sum_{i\in A}(y_i-\bar y_A)^2$ is an <unbiased estimator> of $S^2$. To check this independently, use $\sum_{i\in A}(y_i-\bar y_A)^2=\sum_{i\in A}(y_i-\bar Y)^2-n(\bar y_A-\bar Y)^2$: its <expected value> is $n\sigma_N^2-n\operatorname{Var}(\bar y_A)=(n-1)S^2$. Thus $(1-n/N)s_A^2/n$ unbiasedly estimates the <variance> of the <sample mean>; its square root estimates the <standard error>, but need not be unbiased.<Sampling Theory/Chapter 2: Simple Random Sampling>[Sampling Theory, Chapter 2, PDF pp. 10–12: sample-variance and standard-error estimation]{ref}

\Image[/simple-random-sampling-variance-and-population-coverage.png]
{title=Exact mean variance and expected distinct-unit coverage as sample size grows in the six-value population}

The diagram compares <variance> with the expected fraction of distinct population labels observed. Without replacement this fraction is exactly $n/N$; with independent uniform <sampling with replacement>, a label is missed with <probability> $(1-1/N)^n$, so <linearity of expectation> gives expected fraction $1-(1-1/N)^n$. At six draws, replacement covers only about $66.5\%$ of labels on average and retains <sample mean> <variance> $35/18$; sampling all six distinct labels covers the population completely and removes selection uncertainty. This population coverage is distinct from <confidence interval> <coverage probability>.

The correction matters when the <sampling fraction> is appreciable. It calibrates uncertainty about this fixed population under the specified selection mechanism. It does not correct unequal selection weights, missing observations or measurement errors; observing every label also does not eliminate uncertainty about a larger unobserved population. Moreover, an exact <variance> alone does not guarantee the <coverage probability> of a proposed <confidence interval>: a small discrete <sampling distribution> can make a <normal approximation> inaccurate.