FAD1015 Hypothesis Testing Cookbook

Source: FAD1015 L23-L24 — Hypothesis Testing About the Mean. For exam application — follow the recipe.


What the Numbers Mean

Before the recipes, understand what you're actually doing:

Symbol Name What it means
$H_0$ Null hypothesis The "nothing happened" claim (e.g., mean = 25)
$H_1$ Alternative hypothesis What you're trying to prove (e.g., mean > 25)
$\alpha$ Significance level How much false-alarm risk you'll accept (0.05 = 5%)
$z$ or $t$ Test statistic How many SEs your sample mean is from the claimed mean
Critical value The cutoff How far is "too far" — if your $z$ exceeds this, reject $H_0$

Intuition for your example:

$$z = \frac{28 - 25}{9 / \sqrt{36}} = \frac{3}{1.5} = 2.0$$

  • The claimed mean is 25. Your sample got 28. That's 3 units away.
  • The standard error is 1.5. So your sample is 2 standard errors above the claimed mean.
  • The critical value (cutoff for "too far") at $\alpha = 0.05$ one-tailed is 1.645.
  • Since $2.0 > 1.645$, your sample is unusually far from 25 — so you reject $H_0$ and conclude the mean is likely greater than 25.

The 6-Step Recipe (Source: §4)

graph LR
    S1["Step 1<br/>State H0, H1"] --> S2["Step 2<br/>Pick alpha"]
    S2 --> S3["Step 3<br/>Pick Z or t"]
    S3 --> S4["Step 4<br/>Find rejection region"]
    S4 --> S5["Step 5<br/>Compute & decide"]
    S5 --> S6["Step 6<br/>Conclusion in plain English"]

Step 1 — Write the Hypotheses

Situation $H_0$ $H_1$ Tail
"Is the mean different from 25?" $\mu = 25$ $\mu \neq 25$ Two-tailed
"Is the mean greater than 25?" $\mu \leq 25$ $\mu > 25$ Right-tailed
"Is the mean less than 25?" $\mu \geq 25$ $\mu < 25$ Left-tailed

Step 2 — Pick $\alpha$

$\alpha$ Confidence Common uses
0.10 90% Loose / exploratory
0.05 95% Standard / default
0.01 99% Strict (medical, safety)

Step 3 — Pick Z or t

graph TD
    Q["Is sigma known?"] -->|"Yes"| Z1["Z-test<br/>z = (xbar - mu0) / (sigma/sqrt(n))"]
    Q -->|"No"| N["What is n?"]
    N -->|"n >= 30"| Z2["Z-test (CLT)<br/>z = (xbar - mu0) / (s/sqrt(n))"]
    N -->|"n < 30"| T["t-test, df = n-1<br/>t = (xbar - mu0) / (s/sqrt(n))"]

Step 4 — Find Rejection Region

Z-test critical values:

$\alpha$ One-tailed ($>$ or $<$) Two-tailed ($\neq$)
0.10 $\pm 1.282$ $\pm 1.645$
0.05 $\pm 1.645$ $\pm 1.960$
0.01 $\pm 2.326$ $\pm 2.576$

t-test: Look up $t_{\alpha,,df}$ (one-tailed) or $t_{\alpha/2,,df}$ (two-tailed) from the $t$-table.

Rejection rules:

Test type Reject $H_0$ if...
Right-tailed ($H_1: \mu > \mu_0$) $z > z_\alpha$ (or $t > t_{\alpha,,df}$)
Left-tailed ($H_1: \mu < \mu_0$) $z < -z_\alpha$ (or $t < -t_{\alpha,,df}$)
Two-tailed ($H_1: \mu \neq \mu_0$) $|z| > z_{\alpha/2}$ (or $|t| > t_{\alpha/2,,df}$)

Step 5 — Compute Test Statistic & Decide

Z-test:

$$z = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}} \quad \text{or} \quad z = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}$$

t-test:

$$t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}, \quad df = n - 1$$

Decision: Compare to the critical value(s) from Step 4.

Step 6 — Write the Conclusion

Outcome Wording
Reject $H_0$ "At the $\alpha$ significance level, there is sufficient evidence to conclude that [restate $H_1$ in context]."
Do not reject $H_0$ "At the $\alpha$ significance level, there is not enough evidence to conclude that [restate $H_1$ in context]."

Recipe 1: Z-Test, Right-Tailed ($H_1: \mu > \mu_0$)

Worked — Your Problem

A sample of 36 has $\bar{x} = 28$, $\sigma = 9$. Test if the mean is greater than 25 at $\alpha = 0.05$.

Step Action Result
1 Hypotheses $H_0: \mu \leq 25$, $H_1: \mu > 25$
2 $\alpha$ 0.05
3 Test statistic $z$, since $\sigma$ known
4 Critical value $z_{0.05} = 1.645$ (right-tailed)
5 Compute $z$ $z = \frac{28 - 25}{9/\sqrt{36}} = \frac{3}{1.5} = 2.0$
5 Compare $2.0 > 1.645$ → in rejection region
5 Decision Reject $H_0$
6 Conclusion At $\alpha = 0.05$, there is sufficient evidence the mean is greater than 25.

Recipe 2: Z-Test, Two-Tailed ($H_1: \mu \neq \mu_0$)

Worked — Ketchup Bottles (Source: §6, Example 1)

$n = 36$, $\bar{x} = 16.12$, $s = 0.5$. Test if mean differs from 16 at $\alpha = 0.05$.

Step Action Result
1 Hypotheses $H_0: \mu = 16$, $H_1: \mu \neq 16$
2 $\alpha$ 0.05
3 Test statistic $z$, $n \ge 30$, $\sigma$ unknown → use $s$
4 Critical value $\pm z_{0.025} = \pm 1.96$ (two-tailed)
5 Compute $z$ $z = \frac{16.12 - 16}{0.5/\sqrt{36}} = \frac{0.12}{0.0833} = 1.44$
5 Compare $|1.44| < 1.96$ → not in rejection region
5 Decision Do not reject $H_0$
6 Conclusion Not enough evidence the mean differs from 16 ounces.

Recipe 3: Z-Test, Left-Tailed ($H_1: \mu < \mu_0$)

Worked — Light Bulbs (Source: §6, Example 3)

$n = 100$, $\bar{x} = 470$, $\sigma = 25$. Test if mean is less than 480 at $\alpha = 0.05$.

Step Action Result
1 Hypotheses $H_0: \mu = 480$, $H_1: \mu < 480$
2 $\alpha$ 0.05
3 Test statistic $z$, $\sigma$ known
4 Critical value $-z_{0.05} = -1.645$ (left-tailed)
5 Compute $z$ $z = \frac{470 - 480}{25/\sqrt{100}} = \frac{-10}{2.5} = -4.0$
5 Compare $-4.0 < -1.645$ → in rejection region
5 Decision Reject $H_0$
6 Conclusion Sufficient evidence the mean lifetime is less than 480 hours.

Recipe 4: t-Test, Two-Tailed ($H_1: \mu \neq \mu_0$)

Worked — Hotel Rooms (Source: §6, Example 4)

$n = 25$, $\bar{x} = 172.50$, $s = 15.40$. Test if mean differs from 168 at $\alpha = 0.05$.

Step Action Result
1 Hypotheses $H_0: \mu = 168$, $H_1: \mu \neq 168$
2 $\alpha$ 0.05
3 Test statistic $t$, $n < 30$, $\sigma$ unknown
4 Critical value $t_{0.025,,24} = 2.064$ (two-tailed, $df = 24$)
5 Compute $t$ $t = \frac{172.50 - 168}{15.40/\sqrt{25}} = \frac{4.50}{3.08} = 1.46$
5 Compare $|1.46| < 2.064$ → not in rejection region
5 Decision Do not reject $H_0$
6 Conclusion Not enough evidence the mean hotel cost differs from RM168.

Alternative: P-Value Method (Source: §5.2)

Instead of comparing to a critical value, compute how unlikely your result is:

$$p\text{-value} = P(\text{getting a test statistic this extreme} \mid H_0 \text{ is true})$$

Test type P-value formula
Right-tailed ($z > 0$) $P(Z > z)$
Left-tailed ($z < 0$) $P(Z < z)$
Two-tailed $2 \times P(Z > |z|)$

Decision: If $p\text{-value} \le \alpha$, reject $H_0$.

Worked — Phone Bills (Source: §6, Example 5)

$n = 64$, $\bar{x} = 53.1$, $s = 10$, $H_1: \mu > 52$, $\alpha = 0.10$. $z = 0.88$, $p = P(Z > 0.88) = 1 - 0.8106 = 0.1894$. $0.1894 > 0.10$ → do not reject $H_0$.


Alternative: Confidence Interval Method (Source: §5.3)

Construct a $(1 - \alpha)$ CI for $\mu$. If $\mu_0$ lies outside, reject $H_0$.

Worked — Same Hotel Data

95% CI for $\mu$: $172.50 \pm 2.064 \times \frac{15.40}{\sqrt{25}} = 172.50 \pm 6.36 = (166.14,; 178.86)$

$\mu_0 = 168$ is inside $(166.14,; 178.86)$ → do not reject $H_0$.


Quick Pick — Which Recipe?

graph TD
    Q["What is the claim?"] --> TAIL{"H1 contains..."}
    TAIL -->|"not equal"| TWO["Two-tailed<br/>Critical values: both sides"]
    TAIL -->|"greater than"| RIGHT["Right-tailed<br/>Critical value: positive"]
    TAIL -->|"less than"| LEFT["Left-tailed<br/>Critical value: negative"]

    TWO --> STAT{"sigma known?"}
    RIGHT --> STAT
    LEFT --> STAT
    STAT -->|"Yes, or n>=30 with s"| Z["Z-test"]
    STAT -->|"No, n<30"| T["t-test, df=n-1"]

Common Exam Traps

Trap Fix
Using $z$ when $n < 30$ and $\sigma$ unknown Must use $t$ — $z$ gives too narrow a rejection region
Wrong tail for critical value "Greater than" → right tail. "Less than" → left tail. "Different" → both tails.
Confusing $z_{\alpha}$ vs $z_{\alpha/2}$ One-tailed: $z_\alpha$. Two-tailed: $z_{\alpha/2}$ on each side.
Saying "accept $H_0$" Never. Say "do not reject $H_0$" — we just lack evidence against it.
Forgetting $n-1$ for $df$ $df = n - 1$, always.
Confusing test statistic and critical value Test statistic = what you compute from data. Critical value = the cutoff from the table.

Critical Values Cheat Sheet

Z-Test

$\alpha$ One-tailed Two-tailed
0.10 1.282 1.645
0.05 1.645 1.960
0.01 2.326 2.576

t-Test (95% confidence / $\alpha = 0.05$)

$df$ One-tailed $t_{0.05}$ Two-tailed $t_{0.025}$
5 2.015 2.571
9 1.833 2.262
14 1.761 2.145
19 1.729 2.093
24 1.711 2.064
29 1.699 2.045
40 1.684 2.021
60 1.671 2.000
$\infty$ 1.645 1.960

Related