Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 37 ยท Probability Basics

Relative Frequency and Experiments

Estimate probabilities from experiments with relative frequency, compare them with theory, and see the law of large numbers in simulations you can run.

Sometimes you cannot list equally likely outcomes. What is the probability that a drawing pin lands point up? That a bus arrives late? That a new product is faulty? No simple counting argument exists, so you experiment and use what happened. This lesson connects experimental results to probability.

Experimental probability

Repeat an experiment many times and record how often the event occurs. The relative frequency is

relative frequency = (number of times the event occurred) / (total number of trials)

It is also called experimental probability, and it serves as an estimate of the true probability.

Example: a drawing pin is dropped 200 times and lands point up 124 times. The estimate is 124 / 200 = 0.62. If you drop it another 200 times you will probably get a slightly different value.

Theoretical and experimental probability

Theoretical probability Experimental probability
Based on Counting equally likely outcomes Results of real trials
Example P(heads) = 1/2 53 heads in 100 tosses = 0.53
Changes with repeats? No Yes

The two rarely match exactly in a finite number of trials. That is normal. A fair coin tossed 10 times does not always give exactly 5 heads.

Python Simulate coin tosses

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Run it a few times, then change the seed. The relative frequencies wander for small numbers of trials and settle near 0.5 for large numbers.

The law of large numbers

The law of large numbers says that as the number of trials increases, the relative frequency of an event tends to get closer to its true probability. This does not mean the counts even out. After a long run of heads, tails is not "due". Each toss is independent of the previous ones; it is the proportion that settles, because the early results get diluted by many later ones.

Python Watch the relative frequency settle

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Estimating a hard probability

Suppose a factory tests 500 phone chargers and finds 9 faulty. The estimated probability of a faulty charger is 9 / 500 = 0.018, or 1.8%. For a batch of 10,000, you would expect about 10,000 ร— 0.018 = 180 faulty chargers.

Python Estimate and predict

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The word expected matters: the actual number in one batch might be 160 or 205. It is also an estimate built from one test of 500, so you would trust it more if the test had 5,000 chargers.

Fair or not? Comparing with theory

Is a die fair? Roll it 600 times. If it is fair, each face should appear about 100 times. Counts near 100 (say 85 to 115) are not alarming, because chance causes variation. A count of 160 for one face would be suspicious. The inference chapters will give a precise way to judge this.

Python Check a die against expectation

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Experimental results depend on good trials. The trials must be done the same way each time, and be independent of each other. A biased procedure (for example, flicking a coin carelessly) gives a biased estimate however many trials you do.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A spinner lands on blue 18 times in 60 spins. What is the relative frequency of blue?

    18 / 60 = 0.3.
  2. 2. What does the law of large numbers say?

    It is the proportion that stabilizes. Past results do not influence the next independent trial.
  3. 3. The estimated probability that a seed germinates is 0.85. About how many of 400 seeds are expected to germinate?

    400 ร— 0.85 = 340.
  4. 4. Which gives the more reliable estimate of a probability?

    More trials reduce the variation, so the relative frequency is usually closer to the true value.

Summary

  • Relative frequency = times the event happened รท number of trials; it estimates probability.
  • Theoretical probability comes from counting; experimental probability comes from data and varies.
  • The law of large numbers: relative frequency settles near the true probability as trials grow.
  • Expected counts are n ร— p, not guarantees.

Next: Complements and Mutually Exclusive Events