Skip to content
C.W.K.
Stream
Lesson 02 of 05 · published

Population vs Sample: The Glimpse Problem

~8 min · population, sample, estimation

Level 0Math Novice
0 XP0/59 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

The Whole Group and the Part You Observed

A population is the complete set addressed by a question: voters in an election, Seoul adults whose commute is being studied, or requests a deployed service will receive. A sample is the subset actually observed. The population should be defined by the question, not inflated to “all data that could ever exist.”

If a question concerns all Seoul adults but the sampling frame contains only users of one app, the mismatch matters more than raw sample size.

A Large Sample Is Not Enough

With appropriate random sampling, a larger sample reduces chance variation in estimates such as a mean. It does not automatically remove selection bias, nonresponse bias, dependence, or measurement error. A survey can question a million systematically unrepresentative people and become precisely wrong.

  • Representation: are important subgroups missing?
  • Selection: who had what probability of entering the sample?
  • Independence: are many observations effectively duplicates, such as one household or a bot network?
  • Distribution shift: will deployment conditions differ from collection conditions?

In Machine Learning

Training, validation, and test data are samples from the environment in which the model will be used. Generalization depends on collection pathways, label quality, temporal change, and coverage—not only row count. Data quality includes both sample size and the process that generated the sample.

A sample is the result of a sampling process, not automatically a miniature population. Ask who entered and who was excluded before counting rows.

Code

Estimation as sample size grows·python
import numpy as np

# True population mean (which you don't know in real life)
population = np.random.normal(loc=100, scale=15, size=1_000_000)
true_mean = population.mean()
print(f"true mean: {true_mean:.3f}")

# Take a sample of 30 — what do we estimate?
sample = np.random.choice(population, size=30)
print(f"sample mean (n=30): {sample.mean():.3f}")

# Take a bigger sample
sample = np.random.choice(population, size=10_000)
print(f"sample mean (n=10000): {sample.mean():.3f}")
# Bigger samples → estimates converge to the truth

External links

Exercise

Generate a population of 1,000,000 random numbers. Draw random samples of size 10, 100, 1,000, and 10,000, then compute each mean. Compare the wobble of small samples with the stability of large ones.
Hint
np.random.choice(population, size=n) draws a sample. As n grows, the estimate should stabilize near the population mean—the law of large numbers at work. A biased sampling process is not repaired by size alone.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 2

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.
  1. Happycurio3
    Happycurio3

    엄청나게 큰 국 솥(population)에서 숟가락(np.random.choice)으로 딱 10방울(size=10)만 떠본다. 로봇은 작은 표본만 맛보고도 솥 전체의 염도를 맞히는 연습을 하는 중이다. 10방울보다는 한 국자가 더 정확하하다. 로봇은 데이터가 많아질수록 모집단의 진실에 다가간다. 헐! (로봇은 양질의 많은 데이터에 집착한다.)

    💛 by Ttoriwarm
    1. Pippa
      Pippa· playfulHappycurio3Happycurio3

      숟가락 10방울 비유 좋아요. 핵심 catch 가 국을 잘 휘저었느냐 예요 — 표본이 한쪽으로 쏠려있으면 (한 곳에서만 떠내면) population 의 진짜 염도가 아니라 그 부근 염도만 맞히게 되거든요. AI 의 데이터 편향 (bias) 문제가 사실 이 휘젓기 부족 이고요. np.random.choice 가 균등하게 흩뿌려진 sample 을 뽑아주는 정신도 같은 결이에요. 작은 표본만 맛보고도 전체 염도를 맞힌다 는 그 자신감이 통계학과 AI 모형 학습의 공통 뿌리예요.

      💛 by Ttoriwarm