Notes

Sampling Error

Sampling error is the natural “wiggle” you get when you measure something using a sample instead of the whole population. Even if you sample perfectly fairly, your sample won’t match the population exactly—just because of chance.

What it means (without the jargon)
Suppose you want the average house price in a city, but you only look at 500 recent sales. Your sample average will usually differ from the true citywide average. That gap is sampling error: the difference between a sample statistic (like a mean, proportion, or correlation) and the unknown population parameter it’s trying to estimate.

What causes it
Sampling error isn’t a mistake or “bad data.” It comes from randomness in which units happen to be included. Key facts:

  • Bigger samples usually mean smaller sampling error (often shrinking roughly like 1/√n).
  • More variable populations (e.g., incomes vs. heights) tend to produce larger sampling error for the same sample size.
  • It’s different from bias: bias is systematic (e.g., only sampling luxury homes), while sampling error happens even with unbiased sampling.

How it shows up in practice
Common places you feel sampling error:

  • Polls: a candidate at 52% in a sample might be 50% in the population.
  • Medical studies: a treatment effect estimate varies from trial to trial.
  • A/B tests: conversion rates fluctuate even if nothing “real” changed.

Why it matters in AI/ML
In machine learning, you train and evaluate on samples of data. Sampling error is why:

  • Model performance on a test set is uncertain (accuracy can shift with a different split).
  • Cross-validation helps average out this variability.
  • Confidence intervals, standard errors, and bootstrap methods quantify how much your metrics and learned parameters might vary due to sampling.

Sampling Error is the random difference between a statistic computed from a sample (e.g., mean, accuracy) and the true population value, caused by observing only a subset of data. It matters in AI/ML because it drives uncertainty in model evaluation and can make results vary across train/test splits or A/B tests. Example: a classifier shows 92% accuracy on a 500-item test set, but the true accuracy may differ due to sampling variability.

Imagine you want to know the average height of everyone in a city, but you only measure 50 people at a mall. Even if you measure perfectly, your estimate might be a bit off just because you didn’t check everyone. That gap between your sample’s result and the true city-wide value is sampling error.

In statistics and AI/ML, we often train models or calculate averages using a limited dataset (a “sample”) instead of all possible data (the “population”). Sampling error is the natural, random difference that happens because the sample isn’t a perfect mirror of the whole population.