7D

Relative frequency and simulations

Estimating probability from data with relative frequency, why more trials give a better estimate, comparing experimental and theoretical probability, and designing simple simulations with coins, dice and spreadsheets.

Counting equally likely outcomes only works when the outcomes really are equally likely. What is the chance a drawing pin lands point up? A drawing pin isn't symmetrical, so there is nothing to count. What is the chance your bus is late, or that a new phone is faulty? For questions like these, the only honest way to get a probability is to collect data. That data-based estimate is called relative frequency.

Relative frequency

Relative frequency
$$\text{relative frequency} = \frac{\text{number of times the event happened}}{\text{total number of trials}}$$

Relative frequency is the fraction of trials in which the event happened. If you use it as a probability, it is called an experimental or empirical probability. A probability from counting equally likely outcomes is called a theoretical probability.

Example 1●

A drawing pin is dropped 250 times and lands point up 158 times. Estimate the probability that it lands point up next time.

$\text{relative frequency} = \frac{158}{250}$
The event is 'point up', which happened 158 times in 250 trials.
$= 0.632$
Convert to a decimal, which is easier to compare and use.
$P(\text{point up}) \approx 0.63$
Say what it means. It is an estimate, because a different 250 drops would give a slightly different result.
Example 2●●

A quality-control team tests 1200 phone chargers from a factory and finds 18 faulty. Estimate the probability that a charger is faulty, and the number of faulty chargers in a shipment of 50{,}000.

$\frac{18}{1200} = 0.015$
Relative frequency of faulty chargers in the sample.
$50{,}000 \times 0.015 = 750$
Assume the shipment behaves like the sample, so the same fraction is faulty.
About $750$ faulty chargers.
Round sensibly and make it clear this is an estimate.

Why more trials are better

Toss a coin 10 times and getting 7 heads isn't surprising. Toss it 10{,}000 times and getting $70\%$ heads would be very strange. With only a few trials, one lucky or unlucky result shifts the relative frequency a lot. With many trials, each new result barely moves it, so the relative frequency settles down close to the true probability. This is sometimes called the law of large numbers.

InteractiveWatch the long run settle
Try this

Choose an object. Its true chance is hidden. Make a guess, then add trials in small and big batches and watch the orange line.

After 10 trials, write down the relative frequency. Then run 1000. How far apart are your two estimates? Press Reset and repeat. Is the 10-trial estimate the same each time? Is the 1000-trial one? Only reveal the true chance at the end.

Simulations

A simulation uses something simple and random, such as a coin, a die or a random number generator, to stand in for a real situation. Running it many times gives a relative frequency you can use as an estimate. It is handy when the real experiment is slow, expensive or hard to calculate.

To design one, match each real outcome to an outcome of your simulator with the same probability. A coin can model anything with chance $\frac{1}{2}$. A die can model chance $\frac{1}{6}$, or $\frac{1}{3}$ using two faces. In a spreadsheet, =RANDBETWEEN(1,6) rolls a virtual die, and =RAND() gives a random decimal from 0 to 1, so =IF(RAND()<0.3,"Rain","Dry") simulates a day with a $30\%$ chance of rain.

Example 3●●

A student guesses every answer on a 5-question true/false quiz. To estimate the chance of getting at least 3 right, a class tosses 5 coins (head = correct) and records the number of heads. They do this 40 times.

Number correct012345
Frequency16121362
Each coin toss models one guessed question.
A coin works because a guessed true/false answer is right with probability 1/2, the same as a head.
$13 + 6 + 2 = 21$ of the $40$ trials
At least 3 means 3, 4 or 5 correct. Add those frequencies.
$\text{relative frequency} = \frac{21}{40} = 0.525$
Divide by the total number of trials.
$P(\text{at least 3 right}) \approx 0.53$
The theoretical answer turns out to be exactly 0.5, so the simulation is close. More trials would bring it closer, on average.

Your turn

Over one term, a student notes that 342 of 600 bus trips to school in Blacktown arrived within 5 minutes of the timetable. Estimate the probability that a trip is on time, and how many of the 1500 trips next year should be on time.

Show the answer

$\frac{342}{600} = 0.57$. Next year, expect about $1500 \times 0.57 = 855$ on-time trips, assuming the service doesn't change.

Flashcards
Relative frequency
Number of times the event happened ÷ total number of trials.
How to make a relative frequency more reliable
Increase the number of trials.
Simulation
Use a coin, die or random numbers with the same probabilities as the real situation, and repeat many times.
Practice
  1. A survey of 120 Year 12 students found 27 catch the train to school. Find the relative frequency of catching the train.

  2. Using the survey above, estimate how many of the 2000 students at a large college catch the train.

  3. A spinner is spun 20 times and lands on red 9 times. Then it is spun 2000 times and lands on red 668 times. Which is the better estimate of $P(\text{red})$?

  4. A fair coin is tossed 10 times and lands heads 7 times. Which statement is correct?

  5. Which of these could be used to simulate an event with probability $\frac{1}{3}$?

  6. Of 400 people who bought a raffle ticket at a footy club last season, 132 also bought a meat tray ticket. Find the relative frequency, as a decimal.

  7. In a spreadsheet, which formula simulates an event that happens with probability $0.3$?

  8. A factory tested 400 light globes and 6 were faulty. Estimate how many globes would be faulty in a batch of 12{,}000.

  9. Exam style: Ella rolls a die 30 times and gets six 4s. She says, "The probability of a 4 is $\frac{6}{30} = \frac{1}{5}$, not $\frac{1}{6}$, so the die is unfair." Which is the best response?

  10. Exam style: A netballer's shooting record shows 84 goals from 140 attempts. Find, as a decimal, the relative frequency of a missed shot.

Formula sheet