Tests of Means & Proportions ($t$ and $Z$)
The definitive master guide covering one-sample and two-sample means testing, Student's $t$ with pooled variance, paired sample differences, and single/two-proportion $Z$-tests with confidence intervals.
01. Master Test Selection Matrix: "Which Test Do I Use?"
Selecting the correct test statistic earns the first 2-3 marks on every hypothesis testing question. Match your problem data against this decision matrix:
| Target Parameter | Sample Size & Conditions | Chosen Test | Test Statistic Formula | Degrees of Freedom |
|---|---|---|---|---|
| One Mean ($\mu$) | $\sigma$ known OR $n \ge 30$ | 1-Sample Z-Test | $Z = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}$ | N/A (Standard Normal) |
| One Mean ($\mu$) | $\sigma$ unknown AND $n < 30$ (Normal pop) | 1-Sample t-Test | $t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}$ | $df = n - 1$ |
| Two Independent Means ($\mu_1 - \mu_2$) | $\sigma_1 = \sigma_2$ unknown, $n_1, n_2 < 30$ | Pooled Two-Sample t-Test | $t = \frac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}$ | $df = n_1 + n_2 - 2$ |
| Paired Means (Before vs After) | Same subjects measured twice ($d_i = x_{1i} - x_{2i}$) | Paired t-Test | $t = \frac{\bar{d}}{s_d / \sqrt{n}}$ | $df = n - 1$ |
| One Proportion ($P$) | Single sample, $np_0 \ge 5, nq_0 \ge 5$ | 1-Proportion Z-Test | $Z = \frac{p - P_0}{\sqrt{\frac{P_0(1-P_0)}{n}}}$ | N/A (Standard Normal) |
| Two Proportions ($P_1 - P_2$) | Two independent samples | 2-Proportion Z-Test | $Z = \frac{p_1 - p_2}{\sqrt{\bar{p}\bar{q}\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}$ | $\bar{p} = \frac{x_1 + x_2}{n_1 + n_2}$ |
02. Formulas & Standard Error Architecture
Pooled Variance ($s_p^2$)
When assuming equal variances ($\sigma_1^2 = \sigma_2^2$), pool the sample variances:
$$\begin{aligned} s_p^2 = \frac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2} \end{aligned}$$Pooled Proportion ($\bar{p}$)
Under $H_0: P_1 = P_2$, combine successes across both samples:
$$\begin{aligned} \bar{p} = \frac{x_1 + x_2}{n_1 + n_2}, \quad \bar{q} = 1 - \bar{p} \end{aligned}$$Paired Differences Formulation
Convert paired observations $(X_{1i}, X_{2i})$ into a single sample of differences $d_i = X_{1i} - X_{2i}$:
$$\begin{aligned} \bar{d} &= \frac{\sum d_i}{n}, \quad s_d = \sqrt{\frac{\sum (d_i - \bar{d})^2}{n - 1}} \\[6pt] t_{\text{calc}} &= \frac{\bar{d} - 0}{s_d / \sqrt{n}}, \quad df = n - 1 \end{aligned}$$03. The Standard 5-Step Hypothesis Testing Workflow
State Null ($H_0$) and Alternative ($H_1$) Hypotheses
State $H_0: \mu = \mu_0$ (or $P = P_0$). Determine tail direction from keywords: "is different" $\implies \ne$ (two-tailed); "is greater / has increased" $\implies >$ (right-tailed); "is less / reduced" $\implies <$ (left-tailed).
Fix Significance Level ($\alpha$) & Critical Value
State $\alpha$ (e.g. $0.05$ or $0.01$). Look up $Z_{\text{crit}}$ or $t_{\text{crit}}(df)$.
Select & Calculate Test Statistic
Write formula with parameters, substitute sample statistics, and evaluate $Z_{\text{calc}}$ or $t_{\text{calc}}$.
Apply Decision Rule
If $|Z_{\text{calc}}| > Z_{\text{crit}}$ (two-tailed) or falls in rejection region, **Reject $H_0$**; otherwise **Fail to Reject $H_0$**.
Write Contextual Conclusion
State the conclusion in the plain language of the problem (e.g., "The fitness program resulted in statistically significant weight loss.").
04. 6 Deadly Exam Traps & Common Student Mistakes
Using $\hat{p}$ instead of $P_0$ in the test statistic
In a hypothesis test, evaluate under $H_0$: $\text{SE} = \sqrt{\frac{P_0(1-P_0)}{n}}$. Use sample $\hat{p}$ ONLY for Confidence Intervals: $\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}$!
Failing to calculate pooled $\bar{p}$
Under $H_0: P_1 = P_2$, you MUST pool: $\bar{p} = \frac{x_1 + x_2}{n_1 + n_2}$. Using separate sample variances in the test denominator loses 2 marks.
Using independent $t$-test on Before/After data
If the same individuals are tested twice (Before vs After), the observations are correlated! You MUST compute differences $d_i$ and run a Paired $t$-test.
Using $df = n - 2$ on a paired test
Paired $t$-test has $df = n_{\text{pairs}} - 1$. Independent two-sample $t$-test has $df = n_1 + n_2 - 2$. Do not confuse them.
Using $\pm 1.96$ for a directional claim
For a right-tailed test at $\alpha = 0.05$ (e.g. "greater than 4 kg"), the critical value is $+1.645$, NOT $+1.96$!
Inverting $d_i = \text{After} - \text{Before}$
If weight decreased, $d = \text{Before} - \text{After} > 0$ represents weight loss. Consistently define $d_i$ before writing $H_1$.
05. The Complete University Question Bank (All Problems Solved)
Every test of means and proportions from past semester exams (Dec 2024, Nov 2025) and core assignment archetypes:
Question 1: Quality Proportion Test & 95% Confidence Interval (12 Marks)
Question Statement (Verbatim):
"A random sample of 500 pineapples was taken from a large consignment and 120 were found to be of top quality. Test the hypothesis that the consignment had 20% of top quality pineapples at $\alpha = 0.05$. Also find the 95% confidence limits for the proportion of top quality pineapples in the consignment. (12 Marks)"
View Complete Step-by-Step Solution & CI Derivation
Part 1: Hypothesis Test for Population Proportion (6 Marks)
- Sample size: $n = 500$; Top-quality count: $x = 120$
- Sample proportion: $p = \frac{120}{500} = \mathbf{0.24}$
- Hypothesized proportion: $P_0 = 0.20 \implies Q_0 = 1 - 0.20 = 0.80$
- Hypotheses: $H_0: P = 0.20$ versus $H_1: P \neq 0.20$ (Two-tailed test, $\alpha = 0.05$)
Standard Error under $H_0$:
$$\begin{aligned} \text{SE}_{P_0} &= \sqrt{\frac{P_0 Q_0}{n}} = \sqrt{\frac{0.20 \times 0.80}{500}} \\[4pt] &= \sqrt{\frac{0.16}{500}} = \sqrt{0.00032} \approx \mathbf{0.017889} \end{aligned}$$Test Statistic:
$$\begin{aligned} Z_{\text{calc}} &= \frac{p - P_0}{\text{SE}_{P_0}} = \frac{0.24 - 0.20}{0.017889} = \frac{0.04}{0.017889} \approx \mathbf{+2.236} \end{aligned}$$Decision: Critical value for two-tailed test at $\alpha = 0.05$ is $Z_{\text{crit}} = \mathbf{\pm 1.96}$.
Since $|Z_{\text{calc}}| = 2.236 > 1.96$, we **reject $H_0$** ($p = 0.0254 < 0.05$). The true proportion of top-quality pineapples differs significantly from 20%.
Part 2: 95% Confidence Interval for True Proportion (6 Marks)
Using the sample proportion $p = 0.24$:
$$\begin{aligned} \text{SE}_p &= \sqrt{\frac{p(1 - p)}{n}} = \sqrt{\frac{0.24 \times 0.76}{500}} = \sqrt{\frac{0.1824}{500}} \approx \mathbf{0.01910} \\[6pt] \text{Margin of Error} &= 1.96 \times 0.01910 = \mathbf{0.0374} \\[6pt] \text{95% CI} &= p \pm 1.96 \cdot \text{SE}_p = 0.24 \pm 0.0374 \\[4pt] &= [\mathbf{0.2026, \ 0.2774}] \quad (\mathbf{20.26\% \text{ to } 27.74\%}) \end{aligned}$$Question 2: Conduct & Interpretation of One-Sample Student's t-Test (8 Marks)
Question Statement (Verbatim):
"Explain how to conduct a one sample t-test. Provide an example scenario and interpret the results of the test. (8 Marks)"
View Complete Theory & Worked Numerical Scenario
1. Theoretical Foundations:
- Purpose: Tests whether a sample mean $\bar{x}$ differs significantly from a hypothesized population mean $\mu_0$ when population standard deviation $\sigma$ is **unknown** and sample size is small ($n < 30$).
- Underlying Assumption: The underlying parent population is normally distributed.
- Test Statistic: $$\begin{aligned} t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}, \quad df = n - 1 \end{aligned}$$ where $s = \sqrt{\frac{\sum (x - \bar{x})^2}{n - 1}}$ is the sample standard deviation (Bessel's correction).
2. Worked Example Scenario (Fitness Weight Loss Program):
A fitness coach claims participants lose an average of at least 4 kg in a month ($H_0: \mu = 4$ vs $H_1: \mu > 4$). A sample of $n = 12$ participants yields $\bar{x} = 5.5\text{ kg}$ and $s = 1.5\text{ kg}$. Test at $\alpha = 0.05$.
$$\begin{aligned} t_{\text{calc}} &= \frac{\bar{x} - \mu_0}{s / \sqrt{n}} = \frac{5.5 - 4.0}{1.5 / \sqrt{12}} = \frac{1.5}{0.4330} \approx \mathbf{+3.464} \\[6pt] df &= 12 - 1 = \mathbf{11} \end{aligned}$$From the $t$-distribution table for right-tailed test at $\alpha = 0.05$ with $df = 11$:
$$\begin{aligned} t_{0.05, 11} = \mathbf{+1.796} \end{aligned}$$Question 3: Two-Sample Proportion Z-Test (Smokers in City A vs City B)
Question Statement:
"A survey in City A finds 80 smokers out of 200 residents. In City B, 50 smokers are found out of 250 residents. At $\alpha = 0.05$, test whether the proportion of smokers in City A is significantly higher than in City B."
View Complete Step-by-Step Solution & Pooled Proportion
1. Sample Proportions:
$$\begin{aligned} p_1 &= \frac{80}{200} = \mathbf{0.40}, \quad p_2 = \frac{50}{250} = \mathbf{0.20} \end{aligned}$$2. Pooled Proportion ($\bar{p}$):
$$\begin{aligned} \bar{p} &= \frac{x_1 + x_2}{n_1 + n_2} = \frac{80 + 50}{200 + 250} = \frac{130}{450} \approx \mathbf{0.2889} \\[4pt] \bar{q} &= 1 - \bar{p} = 1 - 0.2889 = \mathbf{0.7111} \end{aligned}$$3. Standard Error of Difference:
$$\begin{aligned} \text{SE} &= \sqrt{\bar{p}\bar{q}\left(\frac{1}{n_1} + \frac{1}{n_2}\right)} = \sqrt{(0.2889)(0.7111)\left(\frac{1}{200} + \frac{1}{250}\right)} \\[4pt] &= \sqrt{0.20543 \times 0.009} = \sqrt{0.0018489} \approx \mathbf{0.0430} \end{aligned}$$4. Test Statistic:
$$\begin{aligned} Z_{\text{calc}} &= \frac{p_1 - p_2}{\text{SE}} = \frac{0.40 - 0.20}{0.0430} = \frac{0.20}{0.0430} \approx \mathbf{+4.65} \end{aligned}$$Since $Z_{\text{calc}} = +4.65 \gg +1.645$, we **reject $H_0$** ($p < 0.0001$). The smoking rate in City A is significantly higher than in City B.
Question 4: Paired Sample t-Test (Before vs After Weight Loss Intervention)
Question Statement:
"A medical clinic tests a lifestyle program on 10 individuals. Weight (kg) was recorded Before and After the program. Test at $\alpha = 0.05$ whether the program resulted in significant weight loss."
| Subject | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Before | 78 | 85 | 92 | 80 | 88 | 79 | 95 | 84 | 90 | 82 |
| After | 75 | 82 | 87 | 78 | 83 | 76 | 91 | 80 | 85 | 79 |
| Diff ($d_i$) | 3 | 3 | 5 | 2 | 5 | 3 | 4 | 4 | 5 | 3 |
View Complete Step-by-Step Solution
1. Calculate Mean Difference & Sample Standard Deviation:
$$\begin{aligned} \sum d_i &= 3+3+5+2+5+3+4+4+5+3 = \mathbf{37} \\[4pt] \bar{d} &= \frac{37}{10} = \mathbf{3.70 \text{ kg}} \end{aligned}$$ $$\begin{aligned} \sum (d_i - \bar{d})^2 &= 0.49 + 0.49 + 1.69 + 2.89 + 1.69 + 0.49 + 0.09 + 0.09 + 1.69 + 0.49 = \mathbf{10.10} \\[4pt] s_d &= \sqrt{\frac{10.10}{10 - 1}} = \sqrt{\frac{10.10}{9}} \approx \mathbf{1.0593 \text{ kg}} \end{aligned}$$2. Test Statistic & Degrees of Freedom:
$$\begin{aligned} \text{SE}_{\bar{d}} &= \frac{s_d}{\sqrt{n}} = \frac{1.0593}{\sqrt{10}} = \frac{1.0593}{3.1623} \approx \mathbf{0.3350} \\[6pt] t_{\text{calc}} &= \frac{\bar{d} - 0}{\text{SE}_{\bar{d}}} = \frac{3.70}{0.3350} \approx \mathbf{+11.045} \\[4pt] df &= 10 - 1 = \mathbf{9} \end{aligned}$$Since $t_{\text{calc}} = 11.045 \gg 1.833$, we **reject $H_0$** ($p < 0.0001$). The program produces highly significant weight loss.
Question 5: Two-Sample Independent t-Test with Pooled Variance
Question Statement:
"Two independent groups of students were tested under two teaching methods: Group 1 ($n_1 = 5, \bar{x}_1 = 20, s_1 = 5$) and Group 2 ($n_2 = 5, \bar{x}_2 = 15, s_2 = 2.5$). Assuming equal population variances, test at $\alpha = 0.05$ whether Method 1 yields significantly higher test scores."
View Complete Step-by-Step Solution
1. Calculate Pooled Variance ($s_p^2$):
$$\begin{aligned} s_p^2 &= \frac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2} \\[6pt] &= \frac{(4)(5^2) + (4)(2.5^2)}{5 + 5 - 2} = \frac{4(25) + 4(6.25)}{8} = \frac{100 + 25}{8} = \frac{125}{8} = \mathbf{15.625} \\[6pt] s_p &= \sqrt{15.625} \approx \mathbf{3.9528} \end{aligned}$$2. Standard Error of Difference:
$$\begin{aligned} \text{SE} &= s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}} = 3.9528 \sqrt{\frac{1}{5} + \frac{1}{5}} = 3.9528 \sqrt{0.40} \\[4pt] &= 3.9528 \times 0.632456 = \mathbf{2.5000} \end{aligned}$$3. Test Statistic & Degrees of Freedom:
$$\begin{aligned} t_{\text{calc}} &= \frac{\bar{x}_1 - \bar{x}_2}{\text{SE}} = \frac{20 - 15}{2.5000} = \frac{5}{2.5} = \mathbf{+2.000} \\[4pt] df &= 5 + 5 - 2 = \mathbf{8} \end{aligned}$$Since $t_{\text{calc}} = 2.000 > 1.860$, we **reject $H_0$**. Teaching Method 1 yields significantly higher scores.
Question 6: Two-Tailed Large Sample Z-Test for Mean ($n \ge 30$)
Question Statement:
"A manufacturer claims that the average fuel mileage of a car model is 20.0 km/L. A consumer agency tests a random sample of 45 cars, finding an average of 19.2 km/L with a standard deviation of 1.8 km/L. Test at $\alpha = 0.05$ whether the manufacturer's claim holds."
View Complete Step-by-Step Solution
1. Parameters: $n = 45 \ge 30$ (Large sample $\implies Z$-test by CLT), $\mu_0 = 20.0, \bar{x} = 19.2, s = 1.8$.
2. Standard Error of the Mean:
$$\begin{aligned} \text{SE} = \frac{s}{\sqrt{n}} = \frac{1.8}{\sqrt{45}} = \frac{1.8}{6.7082} \approx \mathbf{0.2683} \end{aligned}$$3. Test Statistic:
$$\begin{aligned} Z_{\text{calc}} = \frac{\bar{x} - \mu_0}{\text{SE}} = \frac{19.2 - 20.0}{0.2683} = \frac{-0.80}{0.2683} \approx \mathbf{-2.98} \end{aligned}$$Since $|Z_{\text{calc}}| = 2.98 > 1.96$, we **reject $H_0$** ($p = 0.0028$). The true average mileage is significantly lower than claimed.
Dynamic One-Sample Test Statistic Solver (Z or t)
Compute test statistics, standard errors, and evaluate decisions offline:
06. Interactive Self-Test Quiz (Active Recall)
Test your test-selection, standard errors, and rejection rules before concluding your exam prep. Attempt all 4 questions:
When testing $H_0: P = 0.20$ versus $H_1: P \ne 0.20$ using a sample of $n = 500$ with sample proportion $p = 0.24$, what standard error formula MUST be used in the test denominator?
In hypothesis testing, all calculations assume the null hypothesis is true, so the standard error uses the hypothesized value $P_0$. The sample proportion $p$ is only used when constructing Confidence Intervals.
An independent two-sample $t$-test is conducted with $n_1 = 12$ and $n_2 = 14$ participants. What are the degrees of freedom for the pooled $t$-test?
A clinic records blood pressure for 15 patients before and after taking a drug. What test is appropriate?
Because measurements come from the same individuals, the pairs are correlated. Convert to differences $d_i$ and test with $df = 15 - 1 = 14$.
In a test comparing two proportions, Sample 1 has 40 successes out of 100, and Sample 2 has 60 successes out of 100. What is the pooled proportion $\bar{p}$?
Self-Test Progress
07. Exam Hall Answer Sheet Presentation Checklist
When solving any hypothesis testing problem in the semester exam, follow this exact structure to guarantee maximum marks:
- State the Hypotheses: Explicitly write $H_0$ and $H_1$, defining parameters ($\mu, P$). State whether one-tailed or two-tailed.
- Identify Test & Conditions: State why the test is valid (e.g. "Since $n = 500 \ge 30$, Z-test is applicable by CLT" or "$\sigma$ unknown and $n < 30 \implies$ Student's t-test with $df = n-1$").
- State the Standard Error Formula: Write out the SE formula before substituting values.
- Compute the Test Statistic: Show the fraction, intermediate decimals, and final calculated $Z$ or $t$.
- State the Critical Value: State $Z_{\text{crit}}$ or $t_{\alpha, df}$ with its sign ($\pm$ for two-tailed).
- Statistical Decision: State clearly whether the test statistic falls in the rejection region ($|Z_{\text{calc}}| > Z_{\text{crit}} \implies$ Reject $H_0$).
- Plain English Conclusion: Answer the specific real-world question posed by the examiner.