Tests for Normal Means (z-test and t-test)
Context: FIT2086_MOC Β· the case selection layer of Hypothesis Testing β one sample or two, known or estimated Β· same four-way split as Confidence Intervals, because each test statistic is the CIβs pivot re-centred on the null Β· critical values from Student-t Distribution
Quick Revision
- π― Objective: identify (samples, status, ) β pick the statistic β read the tail of or β grade the evidence.
- π¦ Core Components: known β | unknown & normal β | unknown & β approximate | two samples β variances add.
- β‘ Key Constraint: every statistic is β the only thing that changes across cases is which standard error and which reference distribution.
π Core
- Universal shape β ; the case table below is entirely a table of standard errors and reference distributions.
- Unknown variance costs a distribution β substituting the unbiased makes the denominator random too, so the statistic follows , not .
- Large buys back normality β for from any distribution the CLT makes approximately normal and nearly exact, so the form returns as an approximation.
- Two samples, one difference β is restated as , so the estimate under test is with null mean zero.
- Independence makes variances add β under the null; the minus sign never reaches the variance.
- Direction is a relabelling β testing is identical to testing , so only one one-sided formula is needed.
- Exact two-sample procedures exist β more precise but more complicated methods handle unknown, unequal variances;
t.test()implements several β R Toolkit (Cheatsheet).
βοΈ Case Selection Matrix
| Case | Assumptions | Test statistic | Null distribution | |
|---|---|---|---|---|
| 1. One sample, known | normal population (any ), or from any distribution; independent | exact | ||
| 2. One sample, unknown, | normal population; independent | exact | ||
| 3. One sample, unknown, | any distribution; independent | approximate | ||
| 4. Two samples, known | both normal (any ), or ; independent | exact | ||
| 5. Two samples, unknown, large | , any distribution; independent | approximate |
-value from any of the above β substitute the statistic and its reference RV ( or ) into the three-way rule of Hypothesis Testing: two-sided Β· upper Β· lower .
When It Flips: Case 1 becomes Case 2 the instant is computed from the same data, and always βΉ the honest is the larger one. Case 2 relaxes into Case 3 around , where makes the choice immaterial.
π Beyond the lecture (flagged βoptional extraβ on the slides β small- two-sample )
- Equal variances assumed β pool them: , then .
- Unequal variances (Welch) β with the WelchβSatterthwaite .
π Worked Example Bank
| Scenario | vs | Inputs | Statistic | -value | Verdict |
|---|---|---|---|---|---|
| Ohmβs law β measured voltage | vs | , , | in by chance β weak evidence; data not incompatible with Ohm | ||
| βSchmidtβs lawβ β same data, | vs | , , | very strong evidence against | ||
| Bear weights (Case 1, one-sided lower) | vs | , , | do not reject β mean weight not shown to be lb | ||
| Algebra scores (Case 1, one-sided upper) | vs | , , | moderate evidence β new system improves scores | ||
| -test (i) (Case 2, two-sided) | vs | , , | , | insufficient evidence to reject | |
| -test (ii) (same data, one-sided) | vs | as above | , | moderate evidence β reject in favour of | |
| Graduate salaries (Case 4, one-sided) | vs | ; ; | reject β menβs mean salary higher | ||
| Repair costs (Case 5, two-sided) | vs | ; ; | strong evidence β mean repair costs differ | ||
| Blood pressure (Case 2, two-sided; Studio 5) | vs | , , | , | very strong β sample does not come from an βat riskβ (β mmHg) population | |
| Blood pressure (same data, one-sided lower) | vs | as above | , | (exactly half) | very strong β the stronger claim: the population is healthy, not merely βnot at riskβ |
Final extracted output: the same produces (weak) two-sided and (moderate) one-sided β the alternative, not the data, moved the verdict across the conventional threshold. This is why must be fixed before the sample is seen.
Derivation trace β the -test example by hand
Final extracted output: and bracket , so the one-sided lies between and β consistent with the tabulated and enough to place the evidence as moderate without a computer.
Three routes to one difference β S&P 500 pre/post-Lehman (Studio 5)
, , ; , , ; .
| Route | Statistic | -value | CI for |
|---|---|---|---|
| Approximate (Case 5, by hand) | β narrowest | ||
Welch (var.equal = FALSE, the default) | |||
Pooled (var.equal = TRUE) | β widest |
Final extracted output: all three reach the same verdict β the difference of dwarfs its standard error of , so the observed gap is essentially impossible under βthe bank collapse and the economy are unassociatedβ. The intervals are what separate the routes: the approximate is narrowest because it treats as if they were known, so it is slightly overconfident; pooling is widest here because the two variances are in fact quite different ( vs ), so forcing a common variance is the wrong assumption. Do not compare the raw magnitudes across routes β has far thinner tails than , so the route reports an absurdly smaller number for the same evidence.
β οΈ Common Mistakes
- π‘ Using after estimating at small β the reference distribution is , whose tails are heavier, so the tail understates and manufactures evidence β the same error that makes a interval undercover.
- π‘ Feeding (divisor ) into the -statistic β the result is derived for the unbiased with divisor (Estimator Quality (Bias, Variance, MSE)); the ML version shrinks and inflates .
- π‘ instead of β one degree of freedom is spent estimating inside ; at that is .
- π‘ Adding standard deviations for a difference β overstates ; add the variances, then take one square root.
- π‘ Dividing the two-sample difference by a single β each sample contributes its own ; the sample sizes need not be equal.
π§ Active Recall
A question gives , , and states " is known to be ". Why is this a -test and not a -test, and would the answer change if had been estimated?
Answer
- Short answer: is supplied externally, so the denominator is a constant and the standardised statistic is exactly β Case 1. Had it been estimated, the statistic would be ; but with , , so the numerical would barely move.
- Why: Randomness in the denominator is what creates β as (Student-t Distribution), so the distinction is only material at small ; the exam trap is applying at small , not at large.
Both salary and repair-cost examples compare two means, yet one uses and the other . Which is exact, and why is the other still allowed to use ?
Answer
- Short answer: the salary test (Case 4) has known population standard deviations, so is exactly normal and is exact. The repair-cost test (Case 5) substitutes estimates, which is only justified because and are large enough for the CLT to make the substitution approximately harmless.
- Why: Plug-in standard errors are a large-sample licence β as grows, so the substituted statistic is approximately ; at small this licence expires and the pooled or Welch procedures are needed.
Under , why is the null variance rather than a difference of variances?
Answer
- Short answer: the two samples are independent, so β the sign is squared away and the uncertainties accumulate.
- Why: Subtracting estimates adds noise, never cancels it β each estimate carries its own sampling error, so the difference is less precise than either mean; only the null mean becomes zero, never the null variance.