How Surprising Is 496 Grams?

A machine should fill cereal boxes with 500 g on average. A sample of 25 boxes averages 496 g. Is that evidence the machine short-fills, or just chance? One short R simulation helps you decide.

Assumes: the sampling distribution of the sample mean, the standard error SE = σ ÷ √n, and pressing Run on R code. There is one short R edit.

The facts

  • The machine is set to fill boxes with 500 g on average.
  • Single boxes vary: from years of records, their SD is σ = 10 g.
  • A consumer group weighs a random sample of n = 25 boxes. Their average: x̄ = 496 g.

Two explanations

  • Null hypothesis, H₀: μ = 500 g. The machine is fine; this sample came out low by chance.
  • Alternative hypothesis, HA: μ < 500 g. The machine short-fills.

μ is the machine's true average fill, which nobody knows. HA says "less than" because the group suspected short-filling before weighing anything.

1. Is the machine short-filling?

A hypothesis test starts by assuming H₀ is true and asks: would a sample like ours be surprising then?

If the machine really averages 500 g, how often would a random sample of 25 boxes average 496 g or less?

Rarely: in fewer than 5% of samples
Often: in 5% of samples or more

Locked in. In step 2 you'll simulate a machine that really averages 500 g, and count how often its samples average 496 g or less.

Assumptions

Left out: the z formula and pnorm() for the p-value, t-tests with an unknown σ, tests for proportions, effect size and practical significance.