V.3 · Statistics
Does a larger sample repair selection?
Draw repeatable samples from a known finite population and compare uniform selection with a rule that excludes its lower half.
Sample from a fixed finite population
Estimate values · frequency counts · dashed marker is the fixed population mean
Fixed population: 0, 1, 2, 3, 6, 7, 8, 9. Sampling is with replacement.
| Run | Observations | Mean | Estimate |
|---|---|---|---|
| 1 | 2, 0, 6, 1 | 2.25 | 2.25 |
| 2 | 3, 0, 3, 0 | 1.5 | 1.5 |
| 3 | 8, 9, 8, 3 | 7 | 7 |
| 4 | 7, 8, 6, 0 | 5.25 | 5.25 |
| 5 | 1, 9, 9, 9 | 7 | 7 |
| 6 | 6, 1, 6, 2 | 3.75 | 3.75 |
| 7 | 9, 8, 1, 8 | 6.5 | 6.5 |
| 8 | 3, 0, 0, 6 | 2.25 | 2.25 |
| 9 | 8, 8, 7, 3 | 6.5 | 6.5 |
| 10 | 6, 7, 7, 7 | 6.75 | 6.75 |
| 11 | 9, 3, 0, 1 | 3.25 | 3.25 |
| 12 | 3, 1, 8, 6 | 4.5 | 4.5 |
| 13 | 8, 3, 1, 2 | 3.5 | 3.5 |
| 14 | 0, 2, 2, 9 | 3.25 | 3.25 |
| 15 | 9, 1, 8, 6 | 6 | 6 |
| 16 | 2, 2, 1, 9 | 3.5 | 3.5 |
| 17 | 0, 9, 8, 3 | 5 | 5 |
| 18 | 7, 2, 0, 6 | 3.75 | 3.75 |
| 19 | 0, 1, 6, 7 | 3.5 | 3.5 |
| 20 | 3, 1, 1, 7 | 3 | 3 |
| 21 | 9, 8, 7, 8 | 8 | 8 |
| 22 | 3, 1, 1, 6 | 2.75 | 2.75 |
| 23 | 7, 9, 3, 7 | 6.5 | 6.5 |
| 24 | 3, 0, 0, 8 | 2.75 | 2.75 |
Population: 0, 1, 2, 3, 6, 7, 8, 9. Sample one: 2, 0, 6, 1. Every displayed estimate uses its actual sample. Fixed population mean = 4.5. Uniform sampling with replacement: samples vary without selection bias. Theoretical estimator bias = 0; finite-run bias = 0.
- Fixed population mean
- 4.5
- Theoretical estimator bias
- 0
- Theoretical sampling variance
- 2.5625
- Finite-run mean of estimates
- 4.5
- Finite-run signed bias
- 0
- Finite-run variance (divide by R)
- 637/1923.317708…
- Finite-run MSE
- 637/1923.317708…
= exact finite-data/model quantity · ≈ binary64 approximation; empirical results describe this run
from 0 to 4294967295, whole numbers only
from 1 to 32, whole numbers only
from 1 to 64, whole numbers only
Fixed population mean = 4.5. Uniform sampling with replacement: samples vary without selection bias. Theoretical estimator bias = 0; finite-run bias = 0.
Fix the target and selection rule
Fixed population mean = 4.5. Uniform sampling with replacement: samples vary without selection bias. Theoretical estimator bias = 0; finite-run bias = 0.
Intuition
A statistic changes when a new sample arrives even though the population stays fixed. Random variation concerns which eligible members happen to be selected. Selection bias changes eligibility itself. Repeating a biased procedure can make its wrong center increasingly stable.
Definition
The population is the fixed multiset , with mean and variance . Uniform sampling here means iid draws with replacement, each member having probability . The biased rule draws uniformly only from , whose mean is .
Mechanics
Choose the selection rule, sample size, repetition count and uint32 seed. Every table row shows the actual drawn observations and their computed mean. The frequency plot counts those actual estimates, while its target marker is derived independently from all eight population values. Replay regenerates exactly the same run.
Derivation
Under uniform iid selection, and . Under the biased rule, , so bias relative to the population mean is 3 at every sample size. Its selected-source variance is , giving mean variance .
Worked examples
Seed 42 with four uniform draws produces , whose mean is . This estimate differs from the true finite-population mean without implying selection bias. A sample consisting only of upper-half values instead comes from a procedure with theoretical center .
Worked example: Sample from a fixed finite population
Estimate values · frequency counts · dashed marker is the fixed population mean
Fixed population: 0, 1, 2, 3, 6, 7, 8, 9. Sampling is with replacement.
| Run | Observations | Mean | Estimate |
|---|---|---|---|
| 1 | 2, 0, 6, 1 | 2.25 | 2.25 |
| 2 | 3, 0, 3, 0 | 1.5 | 1.5 |
| 3 | 8, 9, 8, 3 | 7 | 7 |
| 4 | 7, 8, 6, 0 | 5.25 | 5.25 |
| 5 | 1, 9, 9, 9 | 7 | 7 |
| 6 | 6, 1, 6, 2 | 3.75 | 3.75 |
| 7 | 9, 8, 1, 8 | 6.5 | 6.5 |
| 8 | 3, 0, 0, 6 | 2.25 | 2.25 |
| 9 | 8, 8, 7, 3 | 6.5 | 6.5 |
| 10 | 6, 7, 7, 7 | 6.75 | 6.75 |
| 11 | 9, 3, 0, 1 | 3.25 | 3.25 |
| 12 | 3, 1, 8, 6 | 4.5 | 4.5 |
| 13 | 8, 3, 1, 2 | 3.5 | 3.5 |
| 14 | 0, 2, 2, 9 | 3.25 | 3.25 |
| 15 | 9, 1, 8, 6 | 6 | 6 |
| 16 | 2, 2, 1, 9 | 3.5 | 3.5 |
| 17 | 0, 9, 8, 3 | 5 | 5 |
| 18 | 7, 2, 0, 6 | 3.75 | 3.75 |
| 19 | 0, 1, 6, 7 | 3.5 | 3.5 |
| 20 | 3, 1, 1, 7 | 3 | 3 |
| 21 | 9, 8, 7, 8 | 8 | 8 |
| 22 | 3, 1, 1, 6 | 2.75 | 2.75 |
| 23 | 7, 9, 3, 7 | 6.5 | 6.5 |
| 24 | 3, 0, 0, 8 | 2.75 | 2.75 |
Population: 0, 1, 2, 3, 6, 7, 8, 9. Sample one: 2, 0, 6, 1. Every displayed estimate uses its actual sample. Fixed population mean = 4.5. Uniform sampling with replacement: samples vary without selection bias. Theoretical estimator bias = 0; finite-run bias = 0.
- Fixed population mean
- 4.5
- Theoretical estimator bias
- 0
- Theoretical sampling variance
- 2.5625
- Finite-run mean of estimates
- 4.5
- Finite-run signed bias
- 0
- Finite-run variance (divide by R)
- 637/1923.317708…
- Finite-run MSE
- 637/1923.317708…
= exact finite-data/model quantity · ≈ binary64 approximation; empirical results describe this run
from 0 to 4294967295, whole numbers only
from 1 to 32, whole numbers only
from 1 to 64, whole numbers only
Fixed population mean = 4.5. Uniform sampling with replacement: samples vary without selection bias. Theoretical estimator bias = 0; finite-run bias = 0.
Fix the target and selection rule
Fixed population mean = 4.5. Uniform sampling with replacement: samples vary without selection bias. Theoretical estimator bias = 0; finite-run bias = 0.
Executable reference code
Run both files. The pedagogical program exposes the arithmetic; the NumPy companion uses array operations. Literal assertions check the worked example rather than testing a simulation against a desired statistical outcome.
"""Runnable sampling reference; exact mechanics / NumPy companion."""
from fractions import Fraction as F
state=42
population=[0,1,2,3,6,7,8,9]
sample=[]
for _ in range(4):
state=(1664525*state+1013904223)%2**32
sample.append(population[state*len(population)//2**32])
assert sample==[2,0,6,1]
assert F(sum(sample),len(sample))==F(9,4)
print(sample,F(sum(sample),len(sample)))"""Runnable sampling reference; exact mechanics / NumPy companion."""
import numpy as np
state=42
population=np.array([0,1,2,3,6,7,8,9])
indices=[]
for _ in range(4):
state=(1664525*state+1013904223)%2**32
indices.append(state*len(population)//2**32)
sample=population[indices]
assert sample.tolist()==[2,0,6,1] and sample.mean()==2.25
print(sample,sample.mean())Explore
Replay a seed, change it and compare the actual rows. Hold a seed while increasing repetitions: earlier rows remain a shared prefix. Increase sample size under each selection rule and explain the difference between tighter concentration and a better target.
Common mistakes and counterexamples
An unlucky representative procedure can produce an unrepresentative realized sample. A very large biased sample can still miss a whole subgroup. Sample size alone does not repair exclusion, missingness or dependence. Sampling without replacement has a finite-population correction; this iid explorer does not silently apply that different model.
Numerical considerations
The bounded LCG uses exact uint32 transitions; integer indexing selects population members without floating accumulation. Sizes are 1–32 and repetitions 1–64. Sample means and empirical summaries are exact fractions. Seeded pseudo-randomness supports reproducibility; it is not evidence that a real collection procedure meets iid assumptions.
Engineering and ML connections
A monitoring dashboard that records only successful requests misses failures; collecting more successes cannot repair that exclusion. A training dataset assembled from one customer segment can concentrate around a segment-specific distribution. Evaluate the sampling frame as carefully as the number of rows.
Exercises
Predict, calculate and explain before checking the corrective feedback. Each solution states the relevant rule and its conditions.
Summary and checkpoints
Separate the known target, actual sample and sampling rule. Explain random variation, calculate an actual mean, and identify why the upper-half rule remains biased as sample size grows.