Sampling without confusion
A frequent breakdown in everyday data collection occurs when analysts conflate drawing a series of independent random values with extracting a representative sample from a finite population. The governing mechanics differ fundamentally depending on whether the drawn observation is returned to the pool before the subsequent draw.
Sampling With Replacement (Independent Draws)
In sampling with replacement, an item or number is observed, recorded, and immediately returned to the population. Consequently, the population size and individual probabilities remain static across every draw:
- Each trial is statistically independent: P(A ∩ B) = P(A) × P(B).
- Identical values can appear multiple times in the resulting batch.
- The total number of possible ordered sequences of length n from a pool of size N is Nn.
This is the model used by rolling standard dice, spinning roulette cylinders, or drawing integers where repetition is permissible.
Sampling Without Replacement (Combinations and Permutations)
When an observation cannot be selected more than once, each draw reduces the denominator of remaining possibilities and alters conditional odds for all remaining members:
P(2nd item is X | 1st item was Y) = 1 / (N - 1)
This dynamic underpins card dealing, raffle lotteries, audit testing, and stratified polling. If an analyst treats a non-replacement sample as independent, their estimate of variance will be erroneously inflated.
Key Differences at a Glance
| Property | With Replacement | Without Replacement |
|---|---|---|
| Independence | Strictly independent | Conditionally dependent |
| Governing Model | Binomial distribution | Hypergeometric distribution |
| Duplicate Values | Natural and expected | Strictly impossible |
| Finite Population Correction | Not required | Mandatory when n/N > 0.05 |
The Fisher-Yates Modern Shuffle
When generating a sample without replacement in code, amateur implementations often draw repeated random integers and reject duplicates in an ad-hoc loop. This approach degrades exponentially as the sample size approaches the population size.
The canonical, optimal algorithm is the Fisher-Yates (Knuth) Shuffle. It traverses an array of N elements in O(N) linear time, swapping each element with a randomly chosen predecessor. Because each of the N! possible permutations has an identical 1 / N! likelihood, the resulting sub-slice guarantees an unbiased non-replacement sample without redundant loop thrashing.
Avoiding Selection and Survivorship Bias
Even an ideal generator cannot correct for a sample drawn from an unrepresentative frame. If voluntary participation determines who enters the data pool, the output reflects behavioral motivation rather than population attributes. Tools provide numerical randomness; researchers must enforce sampling integrity.
Proceed to Describing a dataset to learn how summary statistics condense your sample observations.