Reason about chance, samples, and uncertainty when data is incomplete.

Probability, sampling, and uncertainty

Learning objectives

  • Describe outcomes and events.
  • Estimate a probability from repeated trials.
  • Distinguish a sample from a population.
  • Recognize sampling bias.

Simulate repeated trials

import random

random.seed(7)
successes = 0
trials = 100

for _ in range(trials):
    if random.random() < 0.6:
        successes += 1

estimated_probability = successes / trials
print(successes)
print(round(estimated_probability, 2))

The estimate will usually be near 0.6, but it will not always equal 0.6. More trials generally reduce random variation, but they do not fix a biased experiment.

Sample versus population

A population is the full group we want to understand. A sample is the smaller group we actually measure. If we ask only students already attending a robotics club whether robotics is interesting, the sample may not represent every student in the school.

Practice

Run the simulation with 10, 100, and 10,000 trials. Record how close each estimate is to 0.6. Repeat with a different seed and explain why the result changes.

Checkpoint

Give an example of a sample that is too narrow to support a broad conclusion. Name one change that would make the sampling process more representative.

Responsible data note

Uncertainty is not a failure. Report sample size, how data was collected, and limitations alongside a result.