4.9.21 · D4Probability Theory & Statistics

Exercises — z-test, t-test, chi-squared goodness of fit, F-test

2,115 words10 min readBack to topic

Quick symbol refresher (nothing new is assumed):

Rejection rule everywhere: compute a test statistic, compare its size to a critical value from a table. Bigger than critical ⇒ ==reject ; smaller ⇒ fail to reject==. See Hypothesis Testing and p-value.

Figure — z-test, t-test, chi-squared goodness of fit, F-test

The picture above is the whole game: the bell/hump is "what luck alone does under "; the shaded ends are the critical region. If your statistic lands in the shade, luck-alone becomes implausible.


Level 1 — Recognition

L1·Q1 — Pick the test

For each situation, name z, t, χ², or F. (a) Testing if a coin's true mean bias equals 0.5, with the population standard deviation known and . (b) Testing if a mean fill volume is 250 ml from bottles, unknown. (c) Testing whether the tally of eye colours in a class matches a claimed ratio. (d) Testing whether two machines produce parts with equal variance.

Recall Solution

(a) known, large z-test. (b) unknown, small , a mean ⇒ t-test. (c) Comparing observed counts in categories to expected ⇒ chi-squared goodness of fit. (d) A ratio of two variancesF-test. Mnemonic from the parent: Z Sure, T Tries, Chi Counts, F Fights.

L1·Q2 — Read the critical value

At , two-sided, state the critical cutoff for: (a) a z-test, (b) a t-test with , (c) a χ² GOF with (one-sided upper).

Recall Solution

(a) . (b) (fatter tails than z because adds uncertainty — Student's t-distribution). (c) (χ² is one-tailed on the upper end because "surprise" only accumulates as a positive sum — Chi-squared Distribution).


Level 2 — Application

L2·Q1 — One-sample z

A factory claims wire breaks at N. Known N. Sample , . Test at , two-sided.

Recall Solution

WHAT: compute the standardized distance from the claim. . Why ? averaging 25 values shrinks the wobble by . . Compare: ⇒ ==reject ==. The wire is significantly weaker than claimed.

L2·Q2 — One-sample t

. Data: (), unknown. Test at , two-sided.

Recall Solution

Mean: . Deviations from : . Squares: , sum . Variance (Bessel's ): , so . Why ? deviations are from , which sits closest to its own data, so we lose 1 d.f. to the constraint — see Bessel's Correction. SE: . Statistic: , . Compare: fail to reject. No evidence the mean differs from 100.

L2·Q3 — χ² goodness of fit

A bag should hold red:blue:green in ratio . Sample of gives . Test the ratio at .

Recall Solution

Expected counts from the claimed ratio (total parts): , , . Each cell's surprise : red ; blue ; green . Sum: . d.f.: categories, no parameters estimated (), so . Critical . Compare: fail to reject. Data are consistent with .


Level 3 — Analysis

L3·Q1 — Why does the same data reject with z but not t?

A sample of gives , , testing (this is L2·Q2). Suppose a colleague wrongly treats as a known and runs a z-test. Show the two conclusions and explain the mechanism.

Recall Solution

Wrong (z) path: . Same number as the statistic — because the arithmetic is identical! The difference is the yardstick, not the statistic.

  • z uses cutoff : ⇒ fail to reject here too. Let's make it bite: raise to . Then .
  • t (correct): cutoff ; ⇒ fail to reject.
  • z (wrong): cutoff ; ⇒ reject. Mechanism: with small the estimate is itself noisy. Sometimes happens to come out small, making the ratio look large by luck. The distribution's fatter tails widen the cutoff to absorb exactly this extra luck. Using ignores it and manufactures a false "significant" result. As , and the two cutoffs merge.

L3·Q2 — Degrees of freedom bookkeeping

You fit a Poisson model to counts in bins, but you estimated the Poisson rate from the same data. You get . Test the fit at .

Recall Solution

d.f. accounting: start with cells. Subtract 1 for the fixed total (). Subtract 1 more because was estimated from the data (). Critical . Compare: (just barely) ⇒ reject the fit. Why it matters: had you forgotten the estimated parameter and used , the cutoff would be , and would wrongly say "fits fine." Every parameter you steal from the data to build costs one degree of freedom, tightening the cutoff.


Level 4 — Synthesis

L4·Q1 — The F-test as a gatekeeper

Machine A: , . Machine B: , . First decide whether their variances are equal (, two-sided). Then say what test you'd use next to compare their means.

Recall Solution

Step 1 — F-test. Put the larger variance on top so and we use one upper tail: Two-sided at uses . fail to reject equality of variances. Why an F? Each is (up to scale) a , and the ratio of two such is by definition — see F-distribution and Chi-squared Distribution. Step 2 — next test. Since we could not reject equal variances, a two-sample t-test with pooled variance (equal-variance assumption satisfied) is the appropriate follow-up for the means. Had F rejected, we'd use the unequal-variance (Welch) t-test instead. This chaining is exactly the logic behind ANOVA: F-ratios decide whether group spreads/means differ.

L4·Q2 — From p-value to decision, carefully

A two-sided z-test gives . (a) Is it significant at ? (b) At ? (c) A student concludes "the p-value is large-ish, so is true." Correct them.

Recall Solution

(a) Cutoff . fail to reject at . (b) Cutoff . reject at . The very same data flips conclusion when changes — significance is a chosen threshold, not a fact of nature. (c) Failing to reject means we found insufficient evidence against , not proof of it. Absence of evidence ≠ evidence of absence. A larger sample might well have crossed the line. See p-value and Type I and Type II Errors.


Level 5 — Mastery

L5·Q1 — Design and catch the trap

You have measurements of a quantity claimed to be , with unknown. A colleague reports a z-test giving "reject at 5% since ." Reproduce their number, then correct the analysis.

Recall Solution

Reproduce (their flawed path). . Deviations ; squares , sum . , . . Statistic . (The colleague likely mis-divided by not : with , , SE , stat — or simply rounded to "2.5." Either way the arithmetic is not the crime.) The real error: with unknown and , this is a t-test, , cutoff . Correct comparison: statistic ⇒ ==reject == — but only just, and using the honest, wider cutoff rather than the dishonest . The z cutoff would have rejected on far weaker evidence. Mastery point: the same data can be genuinely significant, yet the reason the colleague is wrong is that they under-stated the uncertainty. Right conclusion for the wrong reason is still a methodological error — with slightly weaker data (, statistic ) the flawed z-test rejects while the correct t-test does not.

L5·Q2 — Full χ² with estimated proportion

A quality line records defects per shift in severity classes: , total . A geometric-type model with one estimated parameter predicts . Test the fit at .

Recall Solution

Cell surprises : ; ; ; ; . Sum: . d.f.: , total-count constraint , one estimated parameter , so . Critical . Compare: fail to reject. The model fits comfortably. Check the size rule: every (smallest is ), so the χ² approximation is valid — no pooling needed.


Recall One-line self-check

Every test here is (signal) ÷ (noise), compared to "what luck does" ::: yes — z/t standardize a mean, χ² sums standardized squared count-errors, F ratios two variance estimates; each has its own reference distribution and its own degrees-of-freedom bookkeeping.