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? You'll find out in R.

Assumes: the sampling distribution of the sample mean, the standard error SE = σ ÷ √n, z-scores and pnorm(), and pressing Run on R code. Each R task is one short 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 steps 2 and 3 you'll simulate a machine that really averages 500 g, and count how often its samples average 496 g or less.

Assumptions

Left out: t-tests with an unknown σ (mentioned in step 4), tests for proportions, effect size and practical significance, and how tests relate to confidence intervals.