📌 Hypothesis TestingS2 · Null & alternative hypothesis · Critical region · One- & two-tailed tests · Type I & Type II errors
Hypotheses
H_0H0 (null hypothesis): assumed true. H_1H1 (alternative): what we test for. One-tailed or two-tailed test.
Test Statistic
\(Z=\dfrac{\bar{X}-\mu_0}{\sigma/\sqrt{n}}\sim N(0,1)\) under \(H_0\). Compare with critical value \(z_\alpha\).
Critical Region
Range of test statistic that leads to rejection of \(H_0\). For two-tailed 5%: \(|Z|\gt 1.96\). One-tailed 5%: \(Z\gt 1.645\) or \(Z\lt -1.645\).
p-value
Probability of observing a result as extreme as the sample, assuming \(H_0\). Reject \(H_0\) if \(p\text{-value}\lt\alpha\).
Type I and II Errors
Type I: reject \(H_0\) when true (probability = significance level \(\alpha\)). Type II: fail to reject \(H_0\) when false (probability \(\beta\)).
Testing Poisson/Binomial
Find \(P(X\geq x_0)\) (or \(P(X\leq x_0)\)) under \(H_0\). If \(\lt\alpha\), reject \(H_0\). State conclusion in context.
▲ Hypothesis Testing — Reference
Steps: (1) State \(H_0\) and \(H_1\). (2) Specify significance level \(\alpha\). (3) Identify test statistic and its distribution under \(H_0\). (4) Find the critical region or \(p\)-value. (5) Compare and conclude in context.
One-tailed: \(H_1:\mu\gt\mu_0\) or \(\mu\lt\mu_0\). Two-tailed: \(H_1:\mu\neq\mu_0\) (split \(\alpha\) equally).
Type I error: reject \(H_0\) when it is true (probability \(=\alpha\)). Type II error: fail to reject \(H_0\) when it is false.
● الحدس المفاهيمي العميق — Hypothesis Testing
Probabilistic Normalization & Moment Structure: Every probability model is governed by total probability conservation: \(\sum_x P(X=x) = 1\) for discrete random variables and \(\int_{-\infty}^{\infty} f(x)\,dx = 1\) (with \(f(x) \ge 0\)) for continuous density functions. Expected value \(\mathbb{E}[X]\) acts as a linear operator (\(\mathbb{E}[aX + bY] = a\mathbb{E}[X] + b\mathbb{E}[Y]\)), whereas variance scales quadratically and adds for independent variables: \(\operatorname{Var}(aX \pm bY) = a^2\operatorname{Var}(X) + b^2\operatorname{Var}(Y)\).
منحنى التوزيع الطبيعي المعياري والمساحة المظللة تحت المنحنى في اختبارات الفروض الإحصائية. \(N(0, 1)\) ، \(P(Z \ge 1.28) \approx 0.1003\)
⊙ المختبر التفاعلي · اختبار الفرضيات: منطقة الرفض وقيمة \(p\)
تفاعلي
جدول عددي حي لـ اختبار الفرضيات: المنطقة الحرجة & قيمة \(p\) مُصوِّر
Because independence implies \(\operatorname{Cov}(X, W) = 0\), the cross term vanishes and \((-b)^2 = +b^2\), proving \(\operatorname{Var}(aX - bW) = a^2\operatorname{Var}(X) + b^2\operatorname{Var}(W)\). Uncertainty compounds whether random variables are added or subtracted.
مثال محلول 1 — One-tailed test for \(\mu\)
المسألة. Bags of flour are labelled 500 g. A sample of 25 bags gives \(\bar{x}=497\) g. Population SD is 8 g. Test at 5% whether there is evidence that bags are underweight.
▸ عرض خطوات الحل بالتفصيل
\(H_0:\mu=500\), \(H_1:\mu\lt 500\) (one-tailed). \(Z=\dfrac{497-500}{8/5}=\dfrac{-3}{1.6}=-1.875\). Critical value: \(-1.645\). Since \(-1.875\lt -1.645\), reject \(H_0\). There is significant evidence at 5% that bags are underweight.
مثال محلول 2 — Poisson اختبار الفرضيات
المسألة. Road accidents used to occur at a rate of 4 per week. After safety measures, only 1 accident is observed in one week. Test at 5% whether the rate has decreased.
▸ عرض خطوات الحل بالتفصيل
\(H_0:\lambda=4\), \(H_1:\lambda\lt 4\). \(P(X\leq 1)=e^{-4}(1+4)=5e^{-4}\approx 0.0916\). Since \(0.0916\gt 0.05\), do not reject \(H_0\). Insufficient evidence that the rate has decreased.
Worked Example \(C\) — Hypothesis Testing (Medium Application)
المسألة. The length, \(X\text{ mm}\), of components manufactured by an industrial process is normally distributed with mean \(\mu\text{ mm}\) and standard deviation \(\sigma\text{ mm}\). A quality assurance engineer tests the null hypothesis \(H_0: \mu = 20.0\) against the alternative hypothesis \(H_1: \mu > 20.0\) at the \(5\%\) significance level using an initial random sample of size \(n = 25\).
The critical region for the sample mean \(\bar{X}\) is found to be \(\bar{X} \ge 20.658\).
Using the standard normal critical value \(z_{0.05} = 1.645\):
1. Find the value of \(\sigma\).
2. Hence, determine the minimum sample size, \(m\), required so that in a subsequent test of \(H_0: \mu = 20.0\) against \(H_1: \mu > 20.0\) at the same \(5\%\) significance level, the probability of committing a Type II error when the true mean is \(\mu = 21.0\) is at most \(0.05\).
▸ عرض خطوات الحل بالتفصيل
We solve the problem in two stages:
**Step 1: Determine \(\sigma\)**
Under \(H_0\), the distribution of the sample mean is \(\bar{X} \sim N\left(20.0, \frac{\sigma^2}{25}\right)\).
The critical value for a upper one-tailed test at the \(5\%\) level corresponds to \(z = 1.645\):
\[
\frac{20.658 - 20.0}{\frac{\sigma}{\sqrt{25}}} = 1.645
\]
\[
\frac{0.658}{\frac{\sigma}{5}} = 1.645 \implies \frac{3.29}{\sigma} = 1.645 \implies \sigma = \frac{3.29}{1.645} = 2.0\text{ mm}
\]
**Step 2: Determine the minimum sample size \(m\)**
For a new sample of size \(m\), the rejection rule at the \(5\%\) level requires rejecting \(H_0\) if \(\bar{X} \ge c\), where:
\[
c = 20.0 + 1.645 \left(\frac{2.0}{\sqrt{m}}\right) = 20.0 + \frac{3.29}{\sqrt{m}}
\]
A Type II error occurs when \(H_0\) is not rejected (i.e. \(\bar{X} < c\)) given that the true mean is \(\mu = 21.0\).
We require:
\[
P(\bar{X} < c \mid \mu = 21.0) \le 0.05
\]
Standardising under \(\mu = 21.0\):
\[
\frac{c - 21.0}{\frac{2.0}{\sqrt{m}}} \le -1.645 \implies c \le 21.0 - 1.645 \left(\frac{2.0}{\sqrt{m}}\right) = 21.0 - \frac{3.29}{\sqrt{m}}
\]
Equating both conditions for \(c\):
\[
20.0 + \frac{3.29}{\sqrt{m}} \le 21.0 - \frac{3.29}{\sqrt{m}}
\]
\[
\frac{6.58}{\sqrt{m}} \le 1.0 \implies \sqrt{m} \ge 6.58
\]
\[
m \ge 6.58^2 = 43.2964
\]
Since \(m\) must be an integer, the minimum sample size is \(m = 44\).
Worked Example \(D\) — Hypothesis Testing (Hard Application)
المسألة. A quality control protocol uses a two-stage hypothesis test to monitor the rate of flaws, \(\lambda\) per metre, in the production of high-grade optical fibre. The number of flaws in a length of fibre follows a Poisson distribution. The manufacturer tests:
\[ H_0: \lambda = 1 \quad \text{against} \quad H_1: \lambda > 1. \]
The two-stage procedure operates as follows:
- **Stage 1:** A \(1\text{-metre}\) sample is inspected, and the number of flaws \(X_1\) is recorded. If \(X_1 \ge 3\), \(H_0\) is rejected immediately. If \(X_1 = 0\), \(H_0\) is accepted immediately. If \(X_1 \in \{1, 2\}\), the test proceeds to Stage 2.
- **Stage 2:** A second, independent \(1\text{-metre}\) sample is inspected, and the number of flaws \(X_2\) is recorded. If \(X_1 + X_2 \ge 4\), \(H_0\) is rejected; otherwise, \(H_0\) is accepted.
Given that the true flaw rate is \(\lambda = 2\) per metre, find the probability that a Type II error is committed.
▸ عرض خطوات الحل بالتفصيل
A Type II error occurs when \(H_0\) is accepted despite the true parameter value being \(\lambda = 2\) (i.e. \(H_1\) is true).
Under \(\lambda = 2\), the independent counts \(X_1, X_2 \sim \mathrm{Po}(2)\). The probability mass function is:
\[ P(X = k) = \frac{2^k \mathrm{e}^{-2}}{k!} \]
Specifically:
\[ P(X = 0) = \mathrm{e}^{-2}, \quad P(X = 1) = 2\mathrm{e}^{-2}, \quad P(X = 2) = 2\mathrm{e}^{-2} \]
\(H_0\) can be accepted in two mutually exclusive ways:
1. **In Stage 1:**
\(H_0\) is accepted immediately if \(X_1 = 0\):
\[ P(\text{Accept in Stage 1}) = P(X_1 = 0) = \mathrm{e}^{-2} \]
2. **In Stage 2:**
The test enters Stage 2 if \(X_1 \in \{1, 2\}\). \(H_0\) is then accepted if \(X_1 + X_2 \le 3\):
- If \(X_1 = 1\), \(H_0\) is accepted if \(X_2 \le 2\):
\[ P(X_2 \le 2) = P(X_2 = 0) + P(X_2 = 1) + P(X_2 = 2) = \mathrm{e}^{-2} + 2\mathrm{e}^{-2} + 2\mathrm{e}^{-2} = 5\mathrm{e}^{-2} \]
\[ P(X_1 = 1 \cap X_2 \le 2) = (2\mathrm{e}^{-2})(5\mathrm{e}^{-2}) = 10\mathrm{e}^{-4} \]
- If \(X_1 = 2\), \(H_0\) is accepted if \(X_2 \le 1\):
\[ P(X_2 \le 1) = P(X_2 = 0) + P(X_2 = 1) = \mathrm{e}^{-2} + 2\mathrm{e}^{-2} = 3\mathrm{e}^{-2} \]
\[ P(X_1 = 2 \cap X_2 \le 1) = (2\mathrm{e}^{-2})(3\mathrm{e}^{-2}) = 6\mathrm{e}^{-4} \]
Combining these cases:
\[ P(\text{Accept in Stage 2}) = 10\mathrm{e}^{-4} + 6\mathrm{e}^{-4} = 16\mathrm{e}^{-4} \]
Therefore, the overall probability of a Type II error is:
\[ P(\text{Type II error}) = \mathrm{e}^{-2} + 16\mathrm{e}^{-4} \approx 0.135335 + 0.293050 = 0.428385 \approx 0.428 \]
Error Diagnosis — Common Student Traps vs. Exam-Board Method (Hypothesis Testing)
Using \(\sigma / n\) instead of \(\sigma / \sqrt{n}\) for \(\bar{X}\) (اختبارات الفروض الإحصائية)
Confuses the variance of the sample mean \(\sigma^2/n\) with its standard error.
Take the square root: \(\text{SE}(\bar{X}) = \sigma / \sqrt{n}\).
Accepting \(H_0\) with certainty when \(p > \alpha\)
Absence of sufficient evidence against \(H_0\) does not prove \(H_0\) is true.
Write in context: "There is insufficient evidence at the \(\alpha\) level to reject \(H_0\)."
▲ استراتيجية إدارة الوقت والتحقق في الاختبار — Hypothesis Testing
Exam Marking Tip (Cambridge International A Level (9709 Paper 3 / Paper 6)): Always state the distribution parameters explicitly (e.g., \(X \sim \operatorname{N}(\mu, \sigma^2)\) or \(\bar{X} \sim \operatorname{N}(\mu, \sigma^2/n)\)) and sketch a quick shaded bell curve before standardizing to \(z = \dfrac{x - \mu}{\sigma}\). This secures the method mark even if a rounding slip occurs later.
A manufacturer claims that the mean breaking strength of cables is at least 80 kN. A sample of 16 cables gives \(\bar{x}=77.5\) kN with population SD 5 kN. Test this claim at 1% significance.
💡 Hint 1 of 3
ابدأ بكتابة العلاقة الأساسية: \(H_0:\mu=80\)، \(H_1:\mu\lt 80\).
💡 Hint 2 of 3
Evaluate the test statistic \(Z=\dfrac{77.5-80}{5/4}=-2\) and compare it with the 1% critical value \(-2.326\).
💡 Hint 3 of 3
Insufficient evidence at 1% that mean breaking strength is below 80 kN.
\(H_0:\mu=80\), \(H_1:\mu\lt 80\). \(Z=\dfrac{77.5-80}{5/4}=-\dfrac{2.5}{1.25}=-2\). Critical value at 1%: \(-2.326\). Since \(-2\gt -2.326\), do not reject \(H_0\). Insufficient evidence at 1% that mean breaking strength is below 80 kN.
منحنى التوزيع الطبيعي المعياري والمساحة المظللة تحت المنحنى في اختبارات الفروض الإحصائية. \(H_{0}\) ، \(z = -1.96\) (2.5, 5)
Deciding Tail Direction: The alternative hypothesis \(H_1\) must be determined strictly from the context before looking at sample numbers. Neutral words like 'has changed' or 'is different' require a two-tailed test (\(H_1: \mu \neq \mu_0\)), splitting \(\alpha\) into \(\alpha/2\) in each tail (e.g. \(z = \pm 1.96\) at 5%). Directional words like 'has decreased' require a one-tailed test (\(z = -1.645\) at 5%).
Contextual Conclusion: Cambridge requires two parts in any hypothesis test conclusion: (1) A statistical decision: 'Reject \(H_0\)' or 'Do not reject \(H_0\)'. (2) An in-context non-assertive summary: 'There is sufficient evidence at the 5% level to conclude that the mean weight has changed.' Never write 'proved that \(H_0\) is true'.
A random variable \(X\) has distribution \(\text{Po}(\lambda)\). A single observation of \(X\) is taken to test \(H_0: \lambda = 6\) against \(H_1: \lambda < 6\) at the 5% level.
(a) Find the critical region.
(b) State the actual significance level.
(c) Find the probability of a Type II error if the true value of \(\lambda\) is 3.
[Practice 3 · Easy] A machine produces metal rods whose lengths are normally distributed with unknown mean \( \mu \text{ cm} \) and known standard deviation \( \sigma = 0.8\text{ cm} \). A quality control manager tests the hypotheses
\[ H_0: \mu = 25.0 \quad \text{against} \quad H_1: \mu < 25.0 \]
at the \( 5\% \) level of significance. A random sample of \( 16 \) rods yields a sample mean length of \( \bar{x} = 24.6\text{ cm} \).
Given that the critical value for this test is \( z_{\text{crit}} = -1.645 \), which of the following gives the correct test statistic \( z \) and the corresponding conclusion?
تلميح للحل: استخدم العلاقة \(5\%\) ، \(z_{\text{crit}} = -1.645\) ، \(z < -1.645\) لتبسيط الخطوة.
💡 Hint 3 of 3
Because \(z = -2.0 < -1.645\), the test statistic falls in the critical region. Therefore, we reject \(H_0\).
1. Under the null hypothesis \( H_0: \mu = 25.0 \), the sample mean \( \bar{X} \) of a random sample of size \( n = 16 \) from \( \mathrm{N}(\mu, \sigma^2) \) has standard error:
\[ \sigma_{\bar{X}} = \frac{\sigma}{\sqrt{n}} = \frac{0.8}{\sqrt{16}} = \frac{0.8}{4} = 0.2 \]
2. The standardized test statistic \( z \) is:
\[ z = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}} = \frac{24.6 - 25.0}{0.2} = \frac{-0.4}{0.2} = -2.0 \]
3. Since this is a lower-tail test at the \( 5\% \) level with critical value \( z_{\text{crit}} = -1.645 \), the critical (rejection) region is \( z < -1.645 \).
4. Because \( z = -2.0 < -1.645 \), the test statistic falls in the critical region. Therefore, we reject \( H_0 \).
[Practice 4 · Medium] A geometric sequence has first term \( a=-1 \) and common ratio \( r=-3 \). Find the sum of the first 4 terms.
💡 Hint 1 of 3
انطلق من العلاقة الرياضية: \(S_n=\dfrac{a(r^n-1)}{r-1}\).
The length, \(X\text{ mm}\), of components manufactured by an industrial process is normally distributed with mean \(\mu\text{ mm}\) and standard deviation \(\sigma\text{ mm}\). A quality assurance engineer tests the null hypothesis \(H_0: \mu = 20.0\) against the alternative hypothesis \(H_1: \mu > 20.0\) at the \(5\%\) significance level using an initial random sample of size \(n = 25\).
The critical region for the sample mean \(\bar{X}\) is found to be \(\bar{X} \ge 20.658\).
Using the standard normal critical value \(z_{0.05} = 1.645\):
1. Find the value of \(\sigma\).
2. Hence, determine the minimum sample size, \(m\), required so that in a subsequent test of \(H_0: \mu = 20.0\) against \(H_1: \mu > 20.0\) at the same \(5\%\) significance level, the probability of committing a Type II error when the true mean is \(\mu = 21.0\) is at most \(0.05\).
💡 Hint 1 of 3
We solve the problem in two stages: Step 1: Determine \(\sigma\)
تلميح للحل: استخدم العلاقة \(m\) ، \(m\) لتبسيط الخطوة.
We solve the problem in two stages:
**Step 1: Determine \(\sigma\)**
Under \(H_0\), the distribution of the sample mean is \(\bar{X} \sim N\left(20.0, \frac{\sigma^2}{25}\right)\).
The critical value for a upper one-tailed test at the \(5\%\) level corresponds to \(z = 1.645\):
\[
\frac{20.658 - 20.0}{\frac{\sigma}{\sqrt{25}}} = 1.645
\]
\[
\frac{0.658}{\frac{\sigma}{5}} = 1.645 \implies \frac{3.29}{\sigma} = 1.645 \implies \sigma = \frac{3.29}{1.645} = 2.0\text{ mm}
\]
**Step 2: Determine the minimum sample size \(m\)**
For a new sample of size \(m\), the rejection rule at the \(5\%\) level requires rejecting \(H_0\) if \(\bar{X} \ge c\), where:
\[
c = 20.0 + 1.645 \left(\frac{2.0}{\sqrt{m}}\right) = 20.0 + \frac{3.29}{\sqrt{m}}
\]
A Type II error occurs when \(H_0\) is not rejected (i.e. \(\bar{X} < c\)) given that the true mean is \(\mu = 21.0\).
We require:
\[
P(\bar{X} < c \mid \mu = 21.0) \le 0.05
\]
Standardising under \(\mu = 21.0\):
\[
\frac{c - 21.0}{\frac{2.0}{\sqrt{m}}} \le -1.645 \implies c \le 21.0 - 1.645 \left(\frac{2.0}{\sqrt{m}}\right) = 21.0 - \frac{3.29}{\sqrt{m}}
\]
Equating both conditions for \(c\):
\[
20.0 + \frac{3.29}{\sqrt{m}} \le 21.0 - \frac{3.29}{\sqrt{m}}
\]
\[
\frac{6.58}{\sqrt{m}} \le 1.0 \implies \sqrt{m} \ge 6.58
\]
\[
m \ge 6.58^2 = 43.2964
\]
Since \(m\) must be an integer, the minimum sample size is \(m = 44\).