viewof testId = {
const params = new URLSearchParams(window.location.search)
const initial = testById.has(params.get("test")) ? params.get("test") : "t-one"
const select = Inputs.select(tests.map(t => t.id), {
label: "Test",
value: initial,
format: id => testById.get(id).name
})
select.classList.add("ojs-fill")
select.dataset.field = "test"
// Inputs.select has no option groups, so wrap its options in <optgroup>s
// by test family. Moving an <option> keeps its value (Inputs reads the
// option's index into the data, which doesn't change) and its order.
const native = select.querySelector("select")
let group = null
for (const option of [...native.options]) {
const t = testById.get(tests[Number(option.value)]?.id)
if (!t) continue
if (!group || group.label !== t.group) {
group = document.createElement("optgroup")
group.label = t.group
native.append(group)
}
group.append(option)
}
return select
}Hypothesis Tests
Probability
See where a test statistic falls and what its p-value means.
Choose a test from the app’s Test menu to see when to use it, what it assumes and how it decides.
One-sample z-test
Is the mean \(\mu\) of a population equal to a claimed value \(\mu_0\), when the population standard deviation \(\sigma\) is known?
Hypotheses
\(H_0\colon\ \mu = \mu_0\)
\(H_1\colon\) one of
- \(\mu \ne \mu_0\) two-sided
- \(\mu > \mu_0\) right-tailed
- \(\mu < \mu_0\) left-tailed
Assumptions
- A simple random sample of size \(n\)
- \(\sigma\) is known
- The population is normal, or \(n\) is large (about 30 or more)
Test statistic
\[z = \frac{\bar x - \mu_0}{\sigma / \sqrt{n}}\]
Null distribution
\[z \sim N(0, 1)\]
the standard normal.
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(\mu \ne \mu_0\) | \(\lvert z\rvert \ge z_{\alpha/2}\) | \(2\,P(Z \ge \lvert z\rvert)\) |
| \(\mu > \mu_0\) | \(z \ge z_{\alpha}\) | \(P(Z \ge z)\) |
| \(\mu < \mu_0\) | \(z \le -z_{\alpha}\) | \(P(Z \le z)\) |
† \(z_a\) is the point with area \(a\) to its right under \(N(0, 1)\).
NoteIn practice
\(\sigma\) is rarely known. When it isn’t, estimate it by the sample standard deviation \(s\) and use the one-sample t-test instead.
TipWorked example
A machine is set to fill bags with 500 g, and its fill weights are known to have a standard deviation of \(\sigma = 4\) g. A sample of \(n = 25\) bags averages \(\bar x = 498.2\) g. Is the machine off target?
- Hypotheses. \(H_0\colon \mu = 500\) against the two-sided \(H_1\colon \mu \ne 500\), since a fill that is too high or too low both count as off target.
- Test statistic. With \(\sigma\) known, \[z = \frac{498.2 - 500}{4/\sqrt{25}} = \frac{-1.8}{0.8} = -2.25.\]
- p-value. Both tails count, so \(p = 2\,P(Z \ge 2.25) = 0.0244\).
- Decision. Since \(p = 0.0244 < \alpha = 0.05\) (equivalently, \(\lvert z\rvert = 2.25\) is beyond the critical value \(z_{0.025} = 1.960\)), we reject \(H_0\). The machine is off target.
One-proportion z-test
Is the proportion \(p\) of a population with some property equal to a claimed value \(p_0\)?
Hypotheses
\(H_0\colon\ p = p_0\)
\(H_1\colon\) one of
- \(p \ne p_0\) two-sided
- \(p > p_0\) right-tailed
- \(p < p_0\) left-tailed
Assumptions
- A simple random sample of \(n\) independent yes/no trials
- Large enough: \(np_0 \ge 10\) and \(n(1 - p_0) \ge 10\) (some texts use 5)
Test statistic
\[z = \frac{\hat p - p_0}{\sqrt{p_0(1 - p_0)/n}}, \qquad \hat p = \frac{x}{n}\]
Null distribution
\[z \approx N(0, 1)\]
by the normal approximation to the binomial.
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(p \ne p_0\) | \(\lvert z\rvert \ge z_{\alpha/2}\) | \(2\,P(Z \ge \lvert z\rvert)\) |
| \(p > p_0\) | \(z \ge z_{\alpha}\) | \(P(Z \ge z)\) |
| \(p < p_0\) | \(z \le -z_{\alpha}\) | \(P(Z \le z)\) |
† \(z_a\) is the point with area \(a\) to its right under \(N(0, 1)\).
NoteWhy p₀ in the denominator?
The standard error is computed assuming \(H_0\) is true, so it uses \(p_0\), not \(\hat p\). (A confidence interval for \(p\) uses \(\hat p\) instead.)
TipWorked example
A coin is flipped \(n = 100\) times and lands heads \(x = 61\) times. Is it fair?
- Hypotheses. \(H_0\colon p = 0.5\) against the two-sided \(H_1\colon p \ne 0.5\).
- Test statistic. The sample proportion is \(\hat p = 61/100 = 0.61\), so \[z = \frac{0.61 - 0.5}{\sqrt{0.5 \cdot 0.5 / 100}} = \frac{0.11}{0.05} = 2.20.\]
- p-value. Both tails count, so \(p = 2\,P(Z \ge 2.20) = 0.0278\).
- Decision. Since \(p = 0.0278 < 0.05\), we reject \(H_0\). The coin looks biased toward heads.
Two-proportion z-test
Do two populations have the same proportion, \(p_1 = p_2\)?
Hypotheses
\(H_0\colon\ p_1 = p_2\)
\(H_1\colon\) one of
- \(p_1 \ne p_2\) two-sided
- \(p_1 > p_2\) right-tailed
- \(p_1 < p_2\) left-tailed
Assumptions
- Two independent simple random samples
- Large enough: at least 10 successes and 10 failures in each group, using the pooled \(\hat p\)
Test statistic
\[z = \frac{\hat p_1 - \hat p_2}{\sqrt{\hat p(1 - \hat p)\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}\]
with the pooled proportion \(\hat p = \dfrac{x_1 + x_2}{n_1 + n_2}\).
Null distribution
\[z \approx N(0, 1)\]
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(p_1 \ne p_2\) | \(\lvert z\rvert \ge z_{\alpha/2}\) | \(2\,P(Z \ge \lvert z\rvert)\) |
| \(p_1 > p_2\) | \(z \ge z_{\alpha}\) | \(P(Z \ge z)\) |
| \(p_1 < p_2\) | \(z \le -z_{\alpha}\) | \(P(Z \le z)\) |
† \(z_a\) is the point with area \(a\) to its right under \(N(0, 1)\).
NoteWhy pool?
Under \(H_0\) the two groups share one proportion, so the best estimate of it combines both samples.
TipWorked example
Ad A is shown to 400 people and 120 of them click; ad B is shown to 400 people and 90 click. Does ad A get more clicks?
- Hypotheses. \(H_0\colon p_1 = p_2\) against the right-tailed \(H_1\colon p_1 > p_2\), since the question is whether A is better.
- Test statistic. The sample proportions are \(\hat p_1 = 0.30\) and \(\hat p_2 = 0.225\), and the pooled proportion is \(\hat p = 210/800 = 0.2625\), so \[z = \frac{0.30 - 0.225}{\sqrt{0.2625 \cdot 0.7375 \cdot \left(\frac{1}{400} + \frac{1}{400}\right)}} = \frac{0.075}{0.0311} = 2.41.\]
- p-value. Only the right tail counts, so \(p = P(Z \ge 2.41) = 0.0080\).
- Decision. Since \(p = 0.0080 < 0.05\) (equivalently, \(z = 2.41 \ge z_{0.05} = 1.645\)), we reject \(H_0\). Ad A’s click rate is higher.
One-sample t-test
Is the mean \(\mu\) of a population equal to a claimed value \(\mu_0\), when \(\sigma\) is unknown?
Hypotheses
\(H_0\colon\ \mu = \mu_0\)
\(H_1\colon\) one of
- \(\mu \ne \mu_0\) two-sided
- \(\mu > \mu_0\) right-tailed
- \(\mu < \mu_0\) left-tailed
Assumptions
- A simple random sample of size \(n\)
- The population is roughly normal; for \(n\) around 30 or more, mild skew is fine
- No extreme outliers
Test statistic
\[t = \frac{\bar x - \mu_0}{s / \sqrt{n}}\]
\(s\) is the sample standard deviation.
Null distribution
\[t \sim t_{n-1}\]
Student’s t with \(\nu = n - 1\) degrees of freedom.
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(\mu \ne \mu_0\) | \(\lvert t\rvert \ge t_{\alpha/2,\,n-1}\) | \(2\,P(T \ge \lvert t\rvert)\) |
| \(\mu > \mu_0\) | \(t \ge t_{\alpha,\,n-1}\) | \(P(T \ge t)\) |
| \(\mu < \mu_0\) | \(t \le -t_{\alpha,\,n-1}\) | \(P(T \le t)\) |
† \(t_{a,\,n-1}\) is the point with area \(a\) to its right under \(t_{n-1}\).
NoteWhy t and not z?
Estimating \(\sigma\) by \(s\) adds uncertainty, so the t distribution has heavier tails than the normal. As \(n\) grows, \(s\) gets more accurate and \(t_{n-1}\) approaches \(N(0,1)\), drawn dashed behind the t curve: lower the sample size in the app to see the tails fatten, raise it to watch the two curves merge and the critical value shrink toward \(z_{\alpha}\).
TipWorked example
A survey claims that students sleep 8 hours a night on average. A sample of \(n = 16\) students averages \(\bar x = 7.4\) hours, with sample standard deviation \(s = 1.2\). Do students sleep less than claimed?
- Hypotheses. \(H_0\colon \mu = 8\) against the left-tailed \(H_1\colon \mu < 8\).
- Test statistic. With \(\sigma\) unknown and estimated by \(s\), \[t = \frac{7.4 - 8}{1.2/\sqrt{16}} = \frac{-0.6}{0.3} = -2.00,\] with \(\nu = n - 1 = 15\) degrees of freedom.
- p-value. Only the left tail counts, so \(p = P(T_{15} \le -2.00) = 0.032\).
- Decision. Since \(p = 0.032 < 0.05\) (equivalently, \(t = -2.00 \le -t_{0.05,15} = -1.753\)), we reject \(H_0\). Students sleep less than the survey claims.
Paired t-test
Two measurements on the same subjects (before and after, left and right, twin A and twin B): is the mean difference \(\mu_d\) zero?
Hypotheses
\(H_0\colon\ \mu_d = 0\)
\(H_1\colon\) one of
- \(\mu_d \ne 0\) two-sided
- \(\mu_d > 0\) right-tailed
- \(\mu_d < 0\) left-tailed
Assumptions
- The pairs are a random sample, independent of one another
- The differences \(d_i\) are roughly normal (the raw measurements needn’t be)
Test statistic
\[t = \frac{\bar d}{s_d / \sqrt{n}}\]
\(d_i\) = difference in pair \(i\); \(\bar d\), \(s_d\) their mean and standard deviation; \(n\) = number of pairs.
Null distribution
\[t \sim t_{n-1}\]
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(\mu_d \ne 0\) | \(\lvert t\rvert \ge t_{\alpha/2,\,n-1}\) | \(2\,P(T \ge \lvert t\rvert)\) |
| \(\mu_d > 0\) | \(t \ge t_{\alpha,\,n-1}\) | \(P(T \ge t)\) |
| \(\mu_d < 0\) | \(t \le -t_{\alpha,\,n-1}\) | \(P(T \le t)\) |
† \(t_{a,\,n-1}\) is the point with area \(a\) to its right under \(t_{n-1}\).
NoteIt’s a one-sample t-test in disguise
Subtract within each pair and run a one-sample t-test on the differences with \(\mu_0 = 0\). Pairing removes the subject-to-subject variation, which is why it is more powerful than treating the two columns as independent groups. Don’t use the two-sample test on paired data.
TipWorked example
Eight patients have their systolic blood pressure measured before and after a month on a new diet. Did the diet lower it?
| Patient | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Before | 142 | 138 | 150 | 145 | 160 | 155 | 148 | 152 |
| After | 138 | 140 | 141 | 143 | 155 | 154 | 151 | 145 |
| \(d\) = before − after | 4 | −2 | 9 | 2 | 5 | 1 | −3 | 7 |
- Hypotheses. \(H_0\colon \mu_d = 0\) against the right-tailed \(H_1\colon \mu_d > 0\), where a positive difference means the pressure went down.
- Test statistic. The differences have mean \(\bar d = 2.875\) and standard deviation \(s_d = 4.19\), so \[t = \frac{2.875}{4.19/\sqrt{8}} = 1.94,\] with \(\nu = n - 1 = 7\) degrees of freedom.
- p-value. Only the right tail counts, so \(p = P(T_7 \ge 1.94) = 0.047\).
- Decision. Since \(p = 0.047 < 0.05\) (the statistic is just past \(t_{0.05,7} = 1.895\)), we reject \(H_0\) at \(\alpha = 0.05\): the diet lowered blood pressure. At \(\alpha = 0.01\) we would not reject; slide \(\alpha\) down and watch the decision flip.
Two-sample t-test (pooled)
Do two independent groups have the same mean, \(\mu_1 = \mu_2\), assuming they have the same variance?
Hypotheses
\(H_0\colon\ \mu_1 = \mu_2\)
\(H_1\colon\) one of
- \(\mu_1 \ne \mu_2\) two-sided
- \(\mu_1 > \mu_2\) right-tailed
- \(\mu_1 < \mu_2\) left-tailed
Assumptions
- Two independent simple random samples
- Each population roughly normal
- Equal variances \(\sigma_1^2 = \sigma_2^2\) (rule of thumb: the larger \(s\) is less than twice the smaller)
Test statistic
\[t = \frac{\bar x_1 - \bar x_2}{s_p\sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}\]
with the pooled variance \[s_p^2 = \frac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2}\]
Null distribution
\[t \sim t_{n_1 + n_2 - 2}\]
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(\mu_1 \ne \mu_2\) | \(\lvert t\rvert \ge t_{\alpha/2,\,\nu}\) | \(2\,P(T \ge \lvert t\rvert)\) |
| \(\mu_1 > \mu_2\) | \(t \ge t_{\alpha,\,\nu}\) | \(P(T \ge t)\) |
| \(\mu_1 < \mu_2\) | \(t \le -t_{\alpha,\,\nu}\) | \(P(T \le t)\) |
† \(\nu = n_1 + n_2 - 2\); \(t_{a,\,\nu}\) is the point with area \(a\) to its right under \(t_\nu\).
NoteUnequal variances: Welch’s t-test
If the variances may differ, don’t pool. Welch’s t-test uses \[t = \frac{\bar x_1 - \bar x_2}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}\] with a non-integer degrees of freedom from the Welch–Satterthwaite formula. Many statisticians recommend it as the default, and most software uses it unless told otherwise.
TipWorked example
Two teaching methods are compared. The \(n_1 = 12\) students taught by method 1 average \(\bar x_1 = 78\) with \(s_1 = 8\); the \(n_2 = 10\) students taught by method 2 average \(\bar x_2 = 71\) with \(s_2 = 9\). Do the methods differ?
- Hypotheses. \(H_0\colon \mu_1 = \mu_2\) against the two-sided \(H_1\colon \mu_1 \ne \mu_2\).
- Test statistic. The standard deviations are close, so pooling is reasonable: \[s_p^2 = \frac{11 \cdot 64 + 9 \cdot 81}{20} = 71.65, \qquad s_p = 8.46,\] \[t = \frac{78 - 71}{8.46\sqrt{\frac{1}{12} + \frac{1}{10}}} = 1.93,\] with \(\nu = n_1 + n_2 - 2 = 20\) degrees of freedom.
- p-value. Both tails count, so \(p = 2\,P(T_{20} \ge 1.93) = 0.068\).
- Decision. Since \(p = 0.068 > 0.05\) (equivalently, \(\lvert t\rvert = 1.93 < t_{0.025,20} = 2.086\)), we fail to reject \(H_0\). A 7-point gap isn’t convincing with samples this small; try raising the sample sizes in the app.
χ² goodness-of-fit test
Do the counts in \(k\) categories match a claimed distribution \(p_1, \dots, p_k\)?
Hypotheses
\(H_0\): the category probabilities are \(p_1, \dots, p_k\)
\(H_1\): at least one differs
Assumptions
- A random sample of \(n\) independent observations, each in exactly one category
- Every expected count \(E_i = np_i\) is at least 5
Test statistic
\[\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}\]
\(O_i\) observed, \(E_i = np_i\) expected count.
Null distribution
\[\chi^2 \approx \chi^2_{k-1}\]
Subtract one more degree of freedom for each parameter estimated from the data.
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| Counts don’t fit | \(\chi^2 \ge \chi^2_{\alpha,\,k-1}\) | \(P(\chi^2_{k-1} \ge \chi^2)\) |
† \(\chi^2_{a,\,k-1}\) is the point with area \(a\) to its right under \(\chi^2_{k-1}\).
NoteWhy only the right tail?
Any departure from \(H_0\), in any direction, makes \((O_i - E_i)^2\) bigger. So only large values of \(\chi^2\) are evidence against \(H_0\), and the test is always right-tailed.
TipWorked example
A die is rolled 120 times. Is it fair?
| Face | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Observed \(O\) | 15 | 25 | 18 | 22 | 12 | 28 |
| Expected \(E\) | 20 | 20 | 20 | 20 | 20 | 20 |
- Hypotheses. \(H_0\): each face has probability \(1/6\); \(H_1\): at least one doesn’t. A fair die is expected to show each face \(120/6 = 20\) times.
- Test statistic. The squared deviations \((O - E)^2\) are 25, 25, 4, 4, 64 and 64, so \[\chi^2 = \frac{25 + 25 + 4 + 4 + 64 + 64}{20} = 9.30,\] with \(\nu = k - 1 = 5\) degrees of freedom.
- p-value. \(p = P(\chi^2_5 \ge 9.30) = 0.098\).
- Decision. Since \(p = 0.098 > 0.05\) (equivalently, \(\chi^2 = 9.30 < \chi^2_{0.05,5} = 11.07\)), we fail to reject \(H_0\). The counts are within what a fair die produces.
χ² test of independence
In an \(r \times c\) table of counts, are the row variable and the column variable independent?
Hypotheses
\(H_0\): the two variables are independent
\(H_1\): they are associated
Assumptions
- A random sample, each subject counted in exactly one cell
- Every expected count is at least 5
Test statistic
\[\chi^2 = \sum_{\text{cells}} \frac{(O_{ij} - E_{ij})^2}{E_{ij}}\]
\[E_{ij} = \frac{(\text{row } i \text{ total})(\text{column } j \text{ total})}{n}\]
Null distribution
\[\chi^2 \approx \chi^2_{(r-1)(c-1)}\]
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| Variables are related | \(\chi^2 \ge \chi^2_{\alpha,\,(r-1)(c-1)}\) | \(P(\chi^2_{\nu} \ge \chi^2)\) |
† \(\nu = (r-1)(c-1)\); \(\chi^2_{a,\,\nu}\) is the point with area \(a\) to its right under \(\chi^2_\nu\).
NoteWhere the degrees of freedom come from
Once the row and column totals are fixed, filling in \((r-1)(c-1)\) cells determines the rest of the table.
TipWorked example
120 people are classified by age group and preferred drink. Does drink preference depend on age?
| Coffee | Tea | Neither | Total | |
|---|---|---|---|---|
| Under 30 | 32 (25) | 13 (20) | 15 (15) | 60 |
| 30 and over | 18 (25) | 27 (20) | 15 (15) | 60 |
| Total | 50 | 40 | 30 | 120 |
- Hypotheses. \(H_0\): drink preference is independent of age group; \(H_1\): it isn’t.
- Test statistic. The expected counts, in parentheses above, come from the totals; for example, \(E_{11} = 60 \cdot 50 / 120 = 25\). Each row contributes the same amount, so \[\chi^2 = 2\left(\frac{7^2}{25} + \frac{7^2}{20} + 0\right) = 8.82,\] with \(\nu = (2-1)(3-1) = 2\) degrees of freedom.
- p-value. \(p = P(\chi^2_2 \ge 8.82) = 0.012\).
- Decision. Since \(p = 0.012 < 0.05\) (equivalently, \(\chi^2 = 8.82 \ge \chi^2_{0.05,2} = 5.99\)), we reject \(H_0\). Drink preference depends on age.
χ² test for one variance
Is the variance \(\sigma^2\) of a normal population equal to a claimed value \(\sigma_0^2\)?
Hypotheses
\(H_0\colon\ \sigma^2 = \sigma_0^2\)
\(H_1\colon\) one of
- \(\sigma^2 \ne \sigma_0^2\) two-sided
- \(\sigma^2 > \sigma_0^2\) right-tailed
- \(\sigma^2 < \sigma_0^2\) left-tailed
Assumptions
- A simple random sample of size \(n\)
- The population is normal (this test is not robust to non-normality, even for large \(n\))
Test statistic
\[\chi^2 = \frac{(n - 1)s^2}{\sigma_0^2}\]
Null distribution
\[\chi^2 \sim \chi^2_{n-1}\]
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(\sigma^2 \ne \sigma_0^2\) | \(\chi^2 \le \chi^2_{1-\alpha/2,\,n-1}\) or \(\chi^2 \ge \chi^2_{\alpha/2,\,n-1}\) | \(2\min\{P(X \le \chi^2), P(X \ge \chi^2)\}\) |
| \(\sigma^2 > \sigma_0^2\) | \(\chi^2 \ge \chi^2_{\alpha,\,n-1}\) | \(P(X \ge \chi^2)\) |
| \(\sigma^2 < \sigma_0^2\) | \(\chi^2 \le \chi^2_{1-\alpha,\,n-1}\) | \(P(X \le \chi^2)\) |
† \(\chi^2_{a,\,n-1}\) is the point with area \(a\) to its right under \(\chi^2_{n-1}\).
NoteA two-sided test on a lopsided distribution
\(\chi^2\) isn’t symmetric, so the two critical values aren’t mirror images: each tail gets area \(\alpha/2\), and the two-sided p-value doubles the smaller tail. Pick the two-sided alternative in the app to see the uneven cut-offs.
TipWorked example
Bolt diameters are supposed to have a standard deviation of \(\sigma_0 = 0.02\) mm. A sample of \(n = 20\) bolts has \(s = 0.026\) mm. Is the process too variable?
- Hypotheses. \(H_0\colon \sigma^2 = 0.02^2\) against the right-tailed \(H_1\colon \sigma^2 > 0.02^2\).
- Test statistic. \[\chi^2 = \frac{19 \cdot 0.026^2}{0.02^2} = 32.11,\] with \(\nu = n - 1 = 19\) degrees of freedom.
- p-value. Only the right tail counts, so \(p = P(\chi^2_{19} \ge 32.11) = 0.030\).
- Decision. Since \(p = 0.030 < 0.05\) (equivalently, \(\chi^2 = 32.11 \ge \chi^2_{0.05,19} = 30.14\)), we reject \(H_0\). The process is more variable than the specification allows.
F-test for two variances
Do two independent normal populations have the same variance, \(\sigma_1^2 = \sigma_2^2\)?
Hypotheses
\(H_0\colon\ \sigma_1^2 = \sigma_2^2\)
\(H_1\colon\) one of
- \(\sigma_1^2 \ne \sigma_2^2\) two-sided
- \(\sigma_1^2 > \sigma_2^2\) right-tailed
- \(\sigma_1^2 < \sigma_2^2\) left-tailed
Assumptions
- Two independent simple random samples
- Both populations normal (like the χ² variance test, very sensitive to this)
Test statistic
\[F = \frac{s_1^2}{s_2^2}\]
Null distribution
\[F \sim F_{n_1 - 1,\, n_2 - 1}\]
Numerator degrees of freedom first.
Decision rule
| \(H_1\) | Reject \(H_0\) when† | p-value† |
|---|---|---|
| \(\sigma_1^2 \ne \sigma_2^2\) | \(F \le F_{1-\alpha/2,\,\nu_1,\nu_2}\) or \(F \ge F_{\alpha/2,\,\nu_1,\nu_2}\) | \(2\min\{P(X \le F), P(X \ge F)\}\) |
| \(\sigma_1^2 > \sigma_2^2\) | \(F \ge F_{\alpha,\,\nu_1,\nu_2}\) | \(P(X \ge F)\) |
| \(\sigma_1^2 < \sigma_2^2\) | \(F \le F_{1-\alpha,\,\nu_1,\nu_2}\) | \(P(X \le F)\) |
† \(\nu_1 = n_1 - 1\), \(\nu_2 = n_2 - 1\); \(F_{a,\,\nu_1,\nu_2}\) is the point with area \(a\) to its right under \(F_{\nu_1,\nu_2}\).
NoteLower critical values from a table
F tables list only upper critical values. The lower one comes from swapping the degrees of freedom: \(F_{1-\alpha,\,\nu_1,\nu_2} = 1 / F_{\alpha,\,\nu_2,\nu_1}\). Many texts instead put the larger variance on top, so only the upper tail is needed.
The F distribution comes back in ANOVA, which compares the means of three or more groups by a ratio of variances.
TipWorked example
Two machines cut rods. A sample of \(n_1 = 13\) rods from machine 1 has \(s_1 = 5.2\); a sample of \(n_2 = 16\) rods from machine 2 has \(s_2 = 3.4\). Do the machines differ in variability?
- Hypotheses. \(H_0\colon \sigma_1^2 = \sigma_2^2\) against the two-sided \(H_1\colon \sigma_1^2 \ne \sigma_2^2\).
- Test statistic. \[F = \frac{5.2^2}{3.4^2} = \frac{27.04}{11.56} = 2.34,\] with \(\nu_1 = 12\) and \(\nu_2 = 15\) degrees of freedom.
- p-value. Both tails count, so \(p = 2\,P(F_{12,15} \ge 2.34) = 0.122\).
- Decision. Since \(p = 0.122 > 0.05\) (equivalently, \(F = 2.34\) lies between the critical values \(0.315\) and \(2.963\)), we fail to reject \(H_0\). The data don’t show a difference in variability.