Lecture notes · Introduction to Mathematical Statistics · Chapter 9

Chapter 9. Two-Sample Inferences: Lecture Notes

Chapters 5 to 7 studied one sample. Most real questions compare two: a new treatment against an old one, one kind of subject against another. This chapter builds the standard toolkit for two independent samples. For means it gives the pooled t test, which is exactly the likelihood ratio test when the variances are equal, and Welch's approximate test when they are not; for variances the F test; for success probabilities the pooled z test (which is Pearson's chi-squared statistic in disguise); and a confidence interval for each difference. The closing section argues that how subjects are assigned to treatments matters even more than how many there are. The book states the results and proves some of them; these notes add the missing arguments (the independence behind the pooled t law, the one-sided likelihood ratio tests, when the pooled test survives unequal variances, the exact structure of the Behrens–Fisher problem, the likelihood ratio for two variances and why the F test is fragile, why the test pools proportions and the interval does not, why random assignment is unbiased, and power and sample size) and correct a few rounding slips of the printed text.

Course home Ch. 1 Introduction Ch. 2 Probability Ch. 3 Random variables Ch. 4 Special distributions Ch. 5 Estimation Ch. 6 Hypothesis testing Ch. 7 Normal-based inference Ch. 8 Types of data Ch. 9 Two-sample inference Ch. 10 Goodness of fit Ch. 11 Regression Ch. 12 Analysis of variance Ch. 13 Randomized blocks Ch. 14 Nonparametric statistics

How to use the gap boxes and selected questions

Each Filling the gap box completes a step or a proof the book leaves out, and each selected question asks you to apply the chapter. Try it yourself first. When you are stuck, open Hint 1; the next hint unlocks one minute after you open the previous one, so take one hint at a time and think about it before moving on: the key idea first, then the tools, then the steps, with intermediate results to aim for. The full proof or solution appears after the last hint and unlocks two minutes later: use it to check your own argument. If you use a generative AI assistant, use it the same way: ask for a hint or for the next step only, then check what it says against these notes (why I teach this way). Spotted a mistake? Use the Report an error link at the end of each box: confirmed errors are corrected and listed, with thanks, in the errata.

How to read these notes

They follow the book. Sections carry the book's numbers (9.1 to 9.6, with Appendix 9.A.1 placed inside Section 9.2 where its result is used) and numbered items keep theirs (Theorem 9.2.2, Case Study 9.4.1, Question 9.5.7). Everything is written in new words; the book is cited for each result, example and figure, and numbered equations keep their number, e.g. \((9.4.1)\).

Filling the gaps. Wherever the book says "it can be shown", gives a proof in a sentence, leaves an exercise to the reader, states a test without proof or defers to an appendix, an orange Filling the gap box gives the full argument. Proofs and derivations start hidden: open one with its bar, or use the button below. Each gap box and each selected question offers graded hints, one at a time, before the full solution.

Figures and demonstrations. Three figures of the chapter (9.2.1, 9.3.2 and 9.3.3) are reproduced; three own figures (x9.1 to x9.3) show how badly the pooled test, the F test and the interval for two proportions can behave outside their assumptions. The schematic of two machines and engineering limits (Figure 9.3.1) and the printout of a statistical package (Figure 9.6.1) are not redrawn. All are computed by the Python code. The ▶ Demo boxes open an interactive demonstration already set to the case being discussed: two are new for this chapter and three first-year or graduate demonstrations are reused.

Main reference

R. J. Larsen and M. L. Marx, An Introduction to Mathematical Statistics and Its Applications, 6th edition, Pearson (2018), Chapter 9, pages 450–482. Section, case-study, figure, equation and question numbers below refer to this book. Further reading is listed in the references.

The explanations, derivations, figures and code are my own; equations are cited by their numbers in the book.

Companion courses

Comparing two groups is also developed, at other levels and in other words, in the companion courses of this site. Where a proof there is complete, these notes give the statement and a short sketch and link to it rather than repeating it.

Earlier chapters of this course: the likelihood ratio and its use to build tests (Definition 6.5.1, Filling the gap 6.14 for a normal mean), tests and intervals as two views of one object (Filling the gap 6.3) and the power function (Filling the gap 6.7). The \(t\), \(\chi^2\) and \(F\) laws of Chapter 7 of the book (Theorem 7.3.1, the normal-sample Theorem 7.3.2, Definition 7.3.2 of \(F\) and Definition 7.3.3 of \(t\)) are used here as known results.

New here: the pooled \(t\) pivot and the unbiasedness of \(S_p^2\) (Filling the gap 9.1), the likelihood ratio test of Appendix 9.A.1 in full (9.2) and its one-sided versions (9.3), when the pooled test survives unequal variances and non-normal data (9.4), the exact structure of the Behrens–Fisher statistic and Welch's degrees of freedom (9.5, 9.6), the \(Z\) test for known variances (9.7), the \(F\) law and its reciprocal symmetry (9.8), the likelihood ratio for two variances and its exact cut-offs (9.9), the fragility of the \(F\) test and of "test the variances first" (9.10), \(-2\ln\lambda\) and Pearson's chi-squared for two proportions (9.11), why the test pools and the interval does not (9.12), the pivots behind the three intervals (9.13), the interval for \(p_X-p_Y\) and its coverage (9.14), why random assignment works (9.15), power and sample size (9.16) and the best split of a fixed budget (9.17).

The chapter at a glance

  • 9.1 Two designs: two treatments given to two independent groups, or one treatment given to two kinds of subjects. Inference mostly compares locations (\(\mu_X\) with \(\mu_Y\), or \(p_X\) with \(p_Y\)) and, less often, spreads (\(\sigma_X^2\) with \(\sigma_Y^2\)).
  • 9.2 Equal variances: the pooled ratio \(T=\dfrac{\bar X-\bar Y}{S_p\sqrt{1/n+1/m}}\) is exactly \(t_{n+m-2}\) and gives the likelihood ratio test (Theorem 9.2.1, 9.2.2, 9.1 to 9.3). Unequal variances: Welch's statistic is approximately \(t_\nu\) (Theorem 9.2.3, 9.5, 9.6); with equal sample sizes the two agree (9.4).
  • 9.3 To compare variances use \(F=S_Y^2/S_X^2\sim F_{m-1,n-1}\) when \(\sigma_X^2=\sigma_Y^2\) (Theorem 9.3.1, 9.8, 9.9). It is exact for normal data and unreliable otherwise (9.10).
  • 9.4 Two binomial samples: the pooled \(z\) test (Theorem 9.4.1), which is also Pearson's chi-squared test of the \(2\times2\) table (9.11, 9.12).
  • 9.5 Confidence intervals for \(\mu_X-\mu_Y\), \(\sigma_X^2/\sigma_Y^2\) and \(p_X-p_Y\) by inverting pivots (Theorems 9.5.1 to 9.5.3, 9.13, 9.14).
  • 9.6 Choosing samples: who is assigned to which treatment matters more than how many (9.15); the number needed for a given power comes from the non-central \(t\) law (9.16, 9.17).

Notation. The \(X\) sample is \(x_1,\dots,x_n\) and the \(Y\) sample \(y_1,\dots,y_m\), independent, with sample means \(\bar x,\bar y\) and sample variances \(s_X^2=\frac1{n-1}\sum(x_i-\bar x)^2\), \(s_Y^2\). The pooled variance is \(s_p^2=\frac{(n-1)s_X^2+(m-1)s_Y^2}{n+m-2}\). \(t_{\alpha,\nu}\) is the number with \(\P(T_\nu\ge t_{\alpha,\nu})=\alpha\); \(F_{p,\nu_1,\nu_2}\) is the number with area \(p\) to its left under the \(F_{\nu_1,\nu_2}\) density (the book's notation, so \(F_{.025,9,9}=0.248\) and \(F_{.975,9,9}=4.03\)). \(z_\alpha\) is the upper-\(\alpha\) point of \(\N(0,1)\). Results about a test also read as results about the matching interval (Filling the gap 6.3).

Prerequisites. Chapter 7 (Section 7.3) for the \(t\), \(\chi^2\) and \(F\) laws and the normal-sample theorem, Chapter 6 for the logic of tests and the generalized likelihood ratio, Chapter 4 for the normal law and sums of independent \(\chi^2\) variables (Theorem 4.6.4).

Derivations start hidden: click any bar to open one.

9.1 Introduction

pp. 450–451 One sample answers "what is this parameter?"; most experiments instead compare. The book distinguishes two shapes of two-sample study. In the first, two treatment levels are given to two independent sets of similar subjects (two germicides tried on two sets of Petri dishes). In the second, one treatment is applied to two kinds of subjects (the strontium-90 absorbed by the bones of sixty-year-old men and of sixty-year-old women). Either way the data are two independent samples, \(X_1,\dots,X_n\) and \(Y_1,\dots,Y_m\), and the questions are of three kinds:

Two-sample data lend themselves to testing because a meaningful null hypothesis always exists ("the treatments do not differ"), unlike many one-sample problems. The whole chapter assumes the two samples are independent. When each subject is measured twice (before and after), the observations are paired and one should analyse the differences with a one-sample method: that is a different design with a different, usually much more powerful, test (Theorem 8.2 of the first-year advanced notes; demo).

See also (companion courses): first-year course, comparing two groups; Section 8 of the advanced notes for pooled, Welch and paired tests and Section 9 for two proportions.

9.2 Testing \(H_0\colon\mu_X=\mu_Y\)

p. 451 Let \(X_1,\dots,X_n\) and \(Y_1,\dots,Y_m\) be independent samples from normal populations with means \(\mu_X,\mu_Y\). What test to use depends on the variances. If \(\sigma_X^2=\sigma_Y^2\) the generalized likelihood ratio test is a neat extension of Student's (1908) one-sample \(t\) test; if they differ, the problem is the Behrens–Fisher problem, which has no exact solution of this kind and is handled by an approximation. We start with the equal-variance case.

Theorem 9.2.1 (the pooled \(t\) ratio) pp. 451–452

Let \(X_1,\dots,X_n\) be a sample from \(\N(\mu_X,\sigma^2)\) and \(Y_1,\dots,Y_m\) an independent sample from \(\N(\mu_Y,\sigma^2)\) (the same \(\sigma\)). With the pooled variance \(S_p^2=\dfrac{(n-1)S_X^2+(m-1)S_Y^2}{n+m-2}\), \[ T_{n+m-2}=\frac{\bar X-\bar Y-(\mu_X-\mu_Y)}{S_p\sqrt{\frac1n+\frac1m}}\ \text{ has a Student } t \text{ distribution with } n+m-2 \text{ degrees of freedom.}\]

The book's proof writes \(T\) as a \(\N(0,1)\) variable divided by the square root of an independent chi-squared variable over its degrees of freedom, and cites Theorems 7.3.1, 7.3.2 and 4.6.4. The box below spells out each ingredient, including the step the book takes for granted, the independence of numerator and denominator.

Filling the gap 9.1: the pooled \(t\) ratio is exactly \(t_{n+m-2}\), and \(S_p^2\) is unbiased pp. 451–452

Three facts are used: \(S_p^2\) estimates \(\sigma^2\) without bias (Question 9.2.15), \((n+m-2)S_p^2/\sigma^2\) is chi-squared with \(n+m-2\) degrees of freedom, and \(\bar X-\bar Y\) is independent of \(S_p^2\). Together they give the \(t\) law of Theorem 9.2.1. The first-year advanced notes prove the same statement as Theorem 3.7; here is the argument in the notation of the book.

Hint 1 of 5: the key idea

A \(t\) variable is a standard normal over the root of an independent \(\chi^2_\nu/\nu\). Which statistic of the two samples is normal, which is chi-squared, and why can they be treated as independent?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Standardise \(\bar X-\bar Y\). Aim for: \(Z\sim\N(0,1)\) with variance \(\sigma^2(1/n+1/m)\) in the denominator.

Hint 4 of 5: step 2

Scale each sample variance by \(\sigma^2\) and add. Aim for: \((n+m-2)S_p^2/\sigma^2\sim\chi^2_{n+m-2}\), and so \(\E S_p^2=\sigma^2\).

Hint 5 of 5: step 3

List which of \(\bar X,S_X^2,\bar Y,S_Y^2\) are independent of which, then write \(T=Z/\sqrt{V/(n+m-2)}\). Where does the common \(\sigma\) have to be the same?

Proof

Numerator. \(\bar X-\bar Y\) is a linear combination of independent normal variables, so it is normal with mean \(\mu_X-\mu_Y\) and variance \(\sigma^2/n+\sigma^2/m\) (Theorem 4.3.3 and its corollary). Hence \(Z=\dfrac{\bar X-\bar Y-(\mu_X-\mu_Y)}{\sigma\sqrt{1/n+1/m}}\sim\N(0,1)\).

Denominator. By the normal-sample theorem (Theorem 7.3.2; Theorem 0.9 of the advanced notes) applied to each sample, \(U_X=(n-1)S_X^2/\sigma^2\sim\chi^2_{n-1}\) and \(U_Y=(m-1)S_Y^2/\sigma^2\sim\chi^2_{m-1}\), and they are independent because the samples are. The sum of independent chi-squared variables is chi-squared with the degrees of freedom added (Theorem 4.6.4), so \[ V=U_X+U_Y=\frac{(n+m-2)S_p^2}{\sigma^2}\sim\chi^2_{n+m-2}.\] Taking expectations, \(\E V=n+m-2\), that is \(\E S_p^2=\sigma^2\): the pooled variance is unbiased. (Directly: \(\E S_p^2=\frac{(n-1)\sigma^2+(m-1)\sigma^2}{n+m-2}=\sigma^2\).)

Independence. By the normal-sample theorem \(\bar X\) is independent of \(S_X^2\), and \(\bar Y\) of \(S_Y^2\); the \(X\) sample is independent of the \(Y\) sample. So the four variables \(\bar X,\bar Y,S_X^2,S_Y^2\) can be grouped as \((\bar X,S_X^2)\) and \((\bar Y,S_Y^2)\), two independent pairs, each pair having independent entries, and therefore the family is mutually independent. Hence \(Z\), a function of \((\bar X,\bar Y)\), is independent of \(V\), a function of \((S_X^2,S_Y^2)\).

Assembly. The unknown \(\sigma\) cancels, \[ T=\frac{\bar X-\bar Y-(\mu_X-\mu_Y)}{S_p\sqrt{1/n+1/m}}=\frac{Z}{\sqrt{V/(n+m-2)}},\] and a standard normal variable divided by the square root of an independent \(\chi^2_\nu\) over \(\nu\) is \(t_\nu\) by Definition 7.3.3, here with \(\nu=n+m-2\). The two estimated means cost two degrees of freedom. ∎

Where equal variances enter: the \(\sigma\) in \(Z\) and in \(V\) must be the same \(\sigma\) for it to cancel. If \(\sigma_X\ne\sigma_Y\), \(S_p^2\) estimates a weighted average of the two variances and the numerator's variance is a different weighted average, so the ratio is no longer \(t_{n+m-2}\) (Filling the gap 9.4).

Theorem 9.2.2 (the two-sample \(t\) test) p. 452

Under the assumptions of Theorem 9.2.1 let \(t=\dfrac{\bar x-\bar y}{s_p\sqrt{1/n+1/m}}\). At level \(\alpha\):

  1. to test \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X>\mu_Y\), reject if \(t\ge t_{\alpha,n+m-2}\);
  2. against \(H_1\colon\mu_X<\mu_Y\), reject if \(t\le-t_{\alpha,n+m-2}\);
  3. against \(H_1\colon\mu_X\ne\mu_Y\), reject if \(t\le-t_{\alpha/2,n+m-2}\) or \(t\ge t_{\alpha/2,n+m-2}\).

This test is a generalized likelihood ratio test.

The book proves the two-sided case in Appendix 9.A.1 (pp. 480–482) and leaves parts (a) and (b) unproved. Both are filled below: the first box carries out the appendix in full, the second shows that the one-sided tests are also likelihood ratio tests. Because the test is the likelihood ratio test, it inherits what Chapter 6 says about such tests; and by duality each part has a matching confidence interval, Theorem 9.5.1.

Filling the gap 9.2: Appendix 9.A.1 in full, the pooled \(t\) test is the likelihood ratio test pp. 480–482

The appendix maximises two likelihoods over three parameters, simplifies a ratio of sums of squares through an identity it states without proof, and recognises the result as a function of \(t^2\). Here is every step, with the identity proved.

Hint 1 of 6: the key idea

Both maximised likelihoods have the form \((2\pi e\hat\sigma^2)^{-N/2}\), so the ratio \(\lambda\) is a power of a ratio of two variance estimates. What is the difference between the two sums of squares?

Hint 2 of 6: tools you will need
  • For fixed \(\sigma\), maximising the normal likelihood in the means means minimising a sum of squares.
  • The sum of squares about any point equals the sum about the mean plus \(n\) times the squared distance.
  • The likelihood ratio (Definition 6.5.1); gap 6.14 for the one-sample case.
Hint 3 of 6: step 1

Find \(\hat\mu_X,\hat\mu_Y,\hat\sigma^2\) on \(\Omega\) and \(\hat\mu,\hat\sigma^2\) on \(\omega\). Aim for: the restricted mean is the grand mean \(w=(n\bar x+m\bar y)/N\).

Hint 4 of 6: step 2

Expand \(\sum(x_i-w)^2\) and \(\sum(y_j-w)^2\) using \(\bar x-w\) and \(\bar y-w\) in terms of \(d=\bar x-\bar y\). Aim for: the restricted sum of squares exceeds \(A+B\) by \(\frac{nm}{N}d^2\).

Hint 5 of 6: step 3

Write \(\lambda^{2/N}\) as a ratio and express it with \(t^2=d^2/(s_p^2(1/n+1/m))\). Aim for: \(\lambda^{2/N}=(N-2)/(N-2+t^2)\).

Hint 6 of 6: step 4

Argue that \(\lambda\le\lambda^*\) is the event \(|t|\ge t^*\), then fix \(t^*\) from the size under \(H_0\).

Proof

Write \(A=\sum_{i=1}^n(x_i-\bar x)^2\), \(B=\sum_{j=1}^m(y_j-\bar y)^2\), \(N=n+m\) and \(d=\bar x-\bar y\). The likelihood for the unrestricted parameters \((\mu_X,\mu_Y,\sigma)\) is \[ L=(2\pi\sigma^2)^{-N/2}\exp\Big\{-\frac{1}{2\sigma^2}\,SS(\mu_X,\mu_Y)\Big\},\qquad SS(\mu_X,\mu_Y)=\sum(x_i-\mu_X)^2+\sum(y_j-\mu_Y)^2.\] For fixed \(\sigma\) the likelihood is largest where \(SS\) is smallest; \(SS\) is a sum of two convex quadratics, minimised by the sample means. Then maximising over \(\sigma^2\) the function \(-\frac N2\ln\sigma^2-\frac{SS}{2\sigma^2}\) gives \(\hat\sigma^2=SS/N\), and the maximised likelihood is \((2\pi e\,\hat\sigma^2)^{-N/2}\).

Unrestricted (\(\Omega\), three free parameters): \(\hat\mu_X=\bar x\), \(\hat\mu_Y=\bar y\), \(\hat\sigma^2_\Omega=(A+B)/N\).

Restricted (\(\omega\): \(\mu_X=\mu_Y=\mu\)): \(SS(\mu,\mu)=\sum(x_i-\mu)^2+\sum(y_j-\mu)^2\) is minimised at the grand mean \(w=\frac{n\bar x+m\bar y}{N}\), and \(\hat\sigma^2_\omega=SS(w,w)/N\). To evaluate \(SS(w,w)\) use \(\sum(x_i-w)^2=A+n(\bar x-w)^2\) (the sum of squares about any point equals the sum about the mean plus \(n\) times the squared distance between the points) and \(\bar x-w=\frac{m}{N}d\), \(\bar y-w=-\frac nNd\): \[ SS(w,w)=A+B+n\frac{m^2}{N^2}d^2+m\frac{n^2}{N^2}d^2=A+B+\frac{nm}{N}d^2.\] This is the identity that the appendix quotes: \(\sum_i\big(x_i-\frac{n\bar x+m\bar y}{n+m}\big)^2=\sum_i(x_i-\bar x)^2+\frac{m^2n}{(n+m)^2}(\bar x-\bar y)^2\).

The ratio. Since both maximised likelihoods have the form \((2\pi e\hat\sigma^2)^{-N/2}\), \[ \lambda=\frac{L(\hat\omega)}{L(\hat\Omega)}=\Big(\frac{\hat\sigma^2_\Omega}{\hat\sigma^2_\omega}\Big)^{N/2},\qquad \lambda^{2/N}=\frac{A+B}{A+B+\frac{nm}{N}d^2}=\frac{1}{1+\dfrac{d^2}{(A+B)\big(\frac1n+\frac1m\big)}}.\] Because \(s_p^2=(A+B)/(N-2)\), we have \(t^2=\dfrac{d^2}{s_p^2(1/n+1/m)}=\dfrac{(N-2)\,d^2}{(A+B)(1/n+1/m)}\), so \[ \lambda^{2/N}=\frac{N-2}{N-2+t^2}\qquad\text{(equation 9.A.1.5).}\] This is a strictly decreasing function of \(t^2\). Hence \(\lambda\le\lambda^*\) (with \(0<\lambda^*<1\)) is the same event as \(t^2\ge t^{*2}\) for a constant \(t^*\), that is \(t\le-t^*\) or \(t\ge t^*\). Under \(H_0\) the ratio \(T\) is \(t_{N-2}\) (Filling the gap 9.1), so the size is \(\P(|T|\ge t^*)\), and size \(\alpha\) requires \(t^*=t_{\alpha/2,N-2}\). This is part (c). ∎

One more reading of (9.A.1.5): \(t^2/(N-2)\) equals the extra variation \(\frac{nm}{N}d^2\) explained by letting the two means differ, divided by the residual sum of squares \(A+B\). The test is the one-way analysis of variance \(F\) test for two groups, \(F=t^2\).

Filling the gap 9.3: the one-sided \(t\) tests (parts a and b) are likelihood ratio tests too p. 452

The theorem says "This test is a GLRT" for all three parts, but the appendix covers only the two-sided alternative. For a one-sided alternative the generalized likelihood ratio uses \(\Omega=\{\mu_X\ge\mu_Y\}\) (the null and the alternative together) against \(\omega=\{\mu_X=\mu_Y\}\), and the answer is a little different: a ratio that is exactly 1 on one side.

Hint 1 of 5: the key idea

For a one-sided alternative the parameter space is a half-plane. When the unconstrained maximiser falls outside it, where does the constrained maximiser sit?

Hint 2 of 5: tools you will need
  • Maximum likelihood over \(\Omega=\{\mu_X\ge\mu_Y\}\) means minimising the convex sum of squares \(SS(\mu_X,\mu_Y)\) over that half-plane.
  • A convex function minimised outside a convex set has its constrained minimum on the boundary.
  • The two-sided result of gap 9.2.
Hint 3 of 5: step 1

Case \(\bar x>\bar y\): is \((\bar x,\bar y)\) inside the half-plane? Aim for: \(\lambda\) is the same as in the two-sided case, with \(t>0\).

Hint 4 of 5: step 2

Case \(\bar x\le\bar y\): show the constrained minimiser lies on \(\mu_X=\mu_Y\). Aim for: \(\hat\Omega=\hat\omega\), so \(\lambda=1\).

Hint 5 of 5: step 3

For \(\lambda^*<1\), show \(\{\lambda\le\lambda^*\}=\{t\ge t^*\}\) with \(t^*>0\), and find \(t^*\) from \(\P(T\ge t^*)=\alpha\). Why is the critical value \(t_\alpha\) and not \(t_{\alpha/2}\)?

Proof

Take \(H_1\colon\mu_X>\mu_Y\), so \(\Omega=\{(\mu_X,\mu_Y,\sigma)\colon\mu_X\ge\mu_Y\}\). As in Filling the gap 9.2, maximising the likelihood over \((\mu_X,\mu_Y)\in\{\mu_X\ge\mu_Y\}\) is minimising the convex function \(SS(\mu_X,\mu_Y)\) over this half-plane, and then \(\hat\sigma^2=SS/N\).

Case \(\bar x>\bar y\). The unconstrained minimiser \((\bar x,\bar y)\) lies in the half-plane, so it is the constrained minimiser: \(L(\hat\Omega)\) is the same as before and \(\lambda^{2/N}=\frac{N-2}{N-2+t^2}\) with \(t>0\).

Case \(\bar x\le\bar y\). The unconstrained minimiser lies outside (or on the edge of) the half-plane. A convex function that is minimised outside a convex set attains its minimum over the set on the boundary (if an interior point were a constrained minimiser it would be a local, hence by convexity a global, minimiser). The boundary is \(\mu_X=\mu_Y\), which is \(\omega\). So \(\hat\Omega=\hat\omega\) and \(\lambda=1\): the data give no reason to reject.

Hence \(\lambda^{2/N}=1\) when \(t\le0\) and \(=\frac{N-2}{N-2+t^2}\) when \(t>0\). For \(\lambda^*<1\) the event \(\lambda\le\lambda^*\) is exactly \(t\ge t^*\) with \(t^*>0\) (the ratio is decreasing in \(t\) on \(t>0\)). Under \(H_0\), \(\P(T\ge t^*)=\alpha\) for \(t^*=t_{\alpha,N-2}\), which is part (a). Part (b) is the mirror image. ∎

Notice the contrast with the two-sided case: there \(\lambda<1\) whenever \(t\ne0\), and the rejection region has two tails; here a large negative \(t\) has \(\lambda=1\), the data point away from \(H_1\), and the region has one tail, with all of \(\alpha\) in it (so the critical value is \(t_\alpha\), not \(t_{\alpha/2}\); a standard slip is to use the wrong one).

See also (companion courses): the pooled test as the dual of the pooled interval (Section 8) and the two-sample demo (preset 1: equal spreads, both tests reject about 5%).

pp. 452–455 Case Study 9.2.1 in numbers.

Case Study 9.2.1: was Quintus Curtius Snodgrass really Mark Twain? pp. 453–455

Authors have a characteristic word-length profile, so a forensic statistician compares the proportion of three-letter words in eight essays known to be by Twain (\(\bar x=0.2319\)) with the ten Snodgrass essays (\(\bar y=0.2097\); data in Table 9.2.1, Larsen and Marx 2018). Let \(\mu_X,\mu_Y\) be the true average proportions and test \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X\ne\mu_Y\) at \(\alpha=0.01\). Here \(n=8\), \(m=10\), \(s_p=0.0121\), and \[ t=\frac{0.2319-0.2097}{0.0121\sqrt{\frac18+\frac1{10}}}=3.88 \quad(16\text{ df}).\] The critical values are \(\pm t_{.005,16}=\pm2.9208\) (Figure 9.2.1), so \(H_0\) is rejected (two-sided \(P=0.0013\)): the essays do not look like one author's. Recomputed from the printed table, the sample variances are \(s_X^2=0.000212\) and \(s_Y^2=0.0000933\) and \(t=3.878\); the book's \(0.0002103\) and \(0.0000955\) come from sums of squares rounded to four decimals, which does not change the conclusion.

About the data. Proportions are not normal and the two variances differ by a factor of 2.3, so the assumptions of Theorem 9.2.2 are only roughly met. Two checks say the conclusion is safe. The sample sizes are nearly equal, so by Filling the gap 9.4 the pooled \(t\) statistic has asymptotic variance \(\tau=1.09\), close to 1. And Welch's statistic, which does not need equal variances, gives \(w=3.70\) on \(\nu=11.7\) degrees of freedom, \(P=0.0032\): the same conclusion.

A Student t density with 16 degrees of freedom, with both tails beyond plus and minus 2.9208 shaded red and labelled 0.005, and a green vertical line at the observed t of 3.88 far inside the right-hand rejection region.
Figure 9.2.1. The two-sided 0.01 critical region of the pooled \(t\) test with 16 degrees of freedom and the observed \(t=3.88\) of Case Study 9.2.1: the observed value lies well inside the rejection region. Reproduces Larsen and Marx (2018), Figure 9.2.1. Code: ch09_two_sample_inference.py, fig_9_2_1.

Case Study 9.2.2: does an enthusiastic lecturer look more knowledgeable? pp. 455–457

An instructor taught the same course twice, in the second semester with a more enthusiastic style, and compared the students' ratings on a 1 to 5 scale (summary statistics in Tables 9.2.2 and 9.2.3 of the book). With \(n=229\) (fall) and \(m=243\) (spring) and \(\alpha=0.05\), the one-sided alternative \(H_1\colon\mu_X<\mu_Y\) for the "enthusiasm" question has \(\bar x=2.14\), \(\bar y=4.21\), \(s_X=0.94\), \(s_Y=0.83\), so \(s_p=0.885\) and \[ t=\frac{2.14-4.21}{0.885\sqrt{\frac1{229}+\frac1{243}}}=-25.4\] (the book's \(-25.42\) uses rounded intermediate values), far below \(-t_{.05,470}\doteq-1.648\): the increase in enthusiasm was noticed. For the "knowledgeable" question (\(\bar x=3.61\), \(\bar y=4.05\), \(s_X=0.84\), \(s_Y=0.95\)) one gets \(s_p=0.898\) and \(t=-5.32\) (book: \(-5.33\)), also far in the rejection region: the instructor did not become more knowledgeable, but the ratings rose. The lesson of the study is about what rating forms measure, not about \(t\) tests.

About the data. The book worries that five-point Likert answers are not normal and that students talk to each other (so the answers are not independent). Normality is not a concern at \(n\approx230\) (the statistic is asymptotically normal by the central limit theorem; see Filling the gap 9.4, where the sample sizes \(229\) and \(243\) give \(\tau=1.007\)), and for such large samples \(t_{.05,470}=1.648\) and \(z_{.05}=1.645\) are interchangeable (Filling the gap 9.7). Dependence among respondents is a genuine threat that no choice of test repairs.

Filling the gap 9.4: when the pooled \(t\) test survives non-normal data and unequal variances pp. 454, 457

The book says that violating the assumptions often has little effect on the pooled \(t\) ratio, and asserts that the robustness of the one-sample \(t\) carries over. That is true for non-normality when the samples are large, and the proof also shows exactly where it fails: the pooled test is protected by equal sample sizes, not by equal variances.

Claim. Let \(X_i\) be iid with mean \(\mu\) and variance \(\sigma_X^2\), and \(Y_j\) iid with the same mean \(\mu\) and variance \(\sigma_Y^2\) (any distributions with finite variances, independent). Let \(n,m\to\infty\) with \(n/(n+m)\to\lambda\in(0,1)\). Then under \(H_0\) the pooled ratio \(T\) converges in distribution to \(\N(0,\tau)\), where \[ \tau=\frac{(1-\lambda)\sigma_X^2+\lambda\sigma_Y^2}{\lambda\sigma_X^2+(1-\lambda)\sigma_Y^2}.\] So \(\tau=1\) when \(\sigma_X=\sigma_Y\) or \(\lambda=\frac12\) (equal sample sizes), and the true size of the two-sided pooled test of nominal level \(\alpha\) tends to \(2\big(1-\Phi(z_{\alpha/2}/\sqrt\tau)\big)\).

Hint 1 of 6: the key idea

The pooled \(t\) ratio divides by an estimate of the standard error that mixes the two variances with weights \(n\) and \(m\). When does that estimate still match the true variance of \(\bar X-\bar Y\)?

Hint 2 of 6: tools you will need
  • The central limit theorem for each sample and the weak law for \(S_X^2,S_Y^2\) (needs only second moments).
  • Slutsky's theorem.
  • \(\frac1\lambda+\frac1{1-\lambda}=\frac1{\lambda(1-\lambda)}\); Proposition 8.1 for equal sizes.
Hint 3 of 6: step 1

Normalise \(\bar X-\bar Y\) by its true standard deviation. Aim for: a limit \(\N(0,1)\), whatever the shape of the data.

Hint 4 of 6: step 2

Find the limit in probability of \(S_p^2\) as \(n/(n+m)\to\lambda\). Aim for: \(\lambda\sigma_X^2+(1-\lambda)\sigma_Y^2\).

Hint 5 of 6: step 3

Write \(T\) as the product of the normalised difference and the square root of the ratio of true to estimated variance, and compute that ratio's limit \(\tau\). Aim for: \(\tau=1\) when \(\lambda=\frac12\) or \(\sigma_X=\sigma_Y\).

Hint 6 of 6: step 4

Evaluate \(\tau\) for \(\lambda=0.75\) with the small group three times as spread out (\(\sigma_Y^2=9\sigma_X^2\)) and turn it into a size. Which sample size dominates the pooled variance?

Proof

By the central limit theorem applied to each sample and independence, \(\dfrac{\bar X-\bar Y}{\sqrt{\sigma_X^2/n+\sigma_Y^2/m}}\to\N(0,1)\). By the law of large numbers \(S_X^2\to\sigma_X^2\) and \(S_Y^2\to\sigma_Y^2\) in probability (only second moments are needed), and \(\frac{n-1}{n+m-2}\to\lambda\), so \(S_p^2\to\lambda\sigma_X^2+(1-\lambda)\sigma_Y^2\). Write \[ T=\frac{\bar X-\bar Y}{\sqrt{\sigma_X^2/n+\sigma_Y^2/m}}\cdot\sqrt{\frac{\sigma_X^2/n+\sigma_Y^2/m}{S_p^2(1/n+1/m)}}.\] With \(n\approx\lambda N\), \(m\approx(1-\lambda)N\) the second factor squared has the limit \[ \frac{\sigma_X^2/\lambda+\sigma_Y^2/(1-\lambda)}{(\lambda\sigma_X^2+(1-\lambda)\sigma_Y^2)\big(\frac1\lambda+\frac1{1-\lambda}\big)}=\frac{(1-\lambda)\sigma_X^2+\lambda\sigma_Y^2}{\lambda\sigma_X^2+(1-\lambda)\sigma_Y^2}=\tau,\] using \(\frac1\lambda+\frac1{1-\lambda}=\frac1{\lambda(1-\lambda)}\). Slutsky's theorem gives \(T\to\sqrt\tau\,\N(0,1)\). If \(\lambda=\frac12\) the numerator and denominator of \(\tau\) are both \(\frac12(\sigma_X^2+\sigma_Y^2)\); if \(\sigma_X=\sigma_Y\) they are equal as well. ∎

Two consequences. First, for large samples of roughly equal size, non-normality does not matter for the pooled test, even with unequal variances: Case Study 9.2.2 (\(\tau=1.007\)) is safe. Second, when the sizes are unequal the variances matter: if the smaller sample has the larger variance (\(\lambda=0.75\) for the first sample, \(\sigma_Y^2=9\sigma_X^2\)), then \(\tau=7/3\) and the nominal 5% test has limiting size \(0.199\); in the reverse arrangement \(\tau=3/7\) and the size is \(0.003\). Simulation with 30 and 10 observations gives 0.21 in the first arrangement and 0.004 in the second. The sign of the error is the one printed in the first-year demonstration (try also preset 3): the pooled variance is dominated by the larger sample, so when that sample is the calm one the denominator is too small. Welch's statistic divides by \(\sqrt{S_X^2/n+S_Y^2/m}\), which estimates the standard error without pooling, and keeps its size near \(\alpha\) throughout (Figure x9.1). Equal sample sizes make the two statistics identical (Proposition 8.1), which is one reason to design studies with \(n=m\).

What the theorem does not give: a statement about small samples (a skewed distribution with \(n=m=5\) can still distort the size), and about the sign of the asymmetry in one-sided tests.

▶ DemoPooled or Welch?First-year demo: with 30 and 10 observations and the small group three times as spread out, the pooled test rejects a true null about 21% of the time and Welch's about 5% (preset 2); with equal sizes the two statistics coincide (preset 4). For the one-sample version of the non-normality question see How robust is the t test?.

pp. 457–459 The Behrens–Fisher problem. When \(\sigma_X\ne\sigma_Y\) the statistic \[ W=\frac{\bar X-\bar Y-(\mu_X-\mu_Y)}{\sqrt{S_X^2/n+S_Y^2/m}}\] has no exact distribution that is free of the unknown variance ratio; this seventy-five-year-old problem is named after Behrens (1929) and Fisher (1935). Welch (1938) showed that \(W\) is approximately a \(t\) variable with a particular, data-dependent, number of degrees of freedom. The book motivates the approximation by writing \(W=Z/\sqrt{V}\), with \(Z\) standard normal and \(V=\dfrac{S_X^2/n+S_Y^2/m}{\sigma_X^2/n+\sigma_Y^2/m}\), and looking for \(\nu\) such that \(V\) behaves like \(\chi^2_\nu/\nu\); matching moments, it says, "can be shown" to give the degrees-of-freedom formula of Theorem 9.2.3. The next two boxes prove what is asserted.

Filling the gap 9.5: why \(W\) is not pivotal, and where Welch's degrees of freedom come from pp. 457–458

The key observation is that \(V\) is a weighted average of two independent chi-squared variables, with weights that depend on the unknown variance ratio. A single \(\chi^2_\nu/\nu\) can match its mean and variance but not its shape.

Hint 1 of 5: the key idea

Write the Welch statistic as \(Z/\sqrt V\). What is \(V\) as a function of the two chi-squared variables, and what do its weights depend on?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Put \(a=\sigma_X^2/n\), \(b=\sigma_Y^2/m\) and write \(V=(S_X^2/n+S_Y^2/m)/(a+b)\) with \(U_X,U_Y\). Aim for: \(V=c\,U_X/(n-1)+(1-c)\,U_Y/(m-1)\), \(c=a/(a+b)\).

Hint 4 of 5: step 2

Explain why the law of \(W\) depends on \(c\). When the weights are proportional to the degrees of freedom, what law does \(V\) have, and what does that give for \(n=m\) and equal variances?

Hint 5 of 5: step 3

Compute \(\E V\) and \(\mathrm{Var}\,V\), then match them to \(\chi^2_\nu/\nu\). Aim for: \(\nu=(a+b)^2/\big(a^2/(n-1)+b^2/(m-1)\big)\).

Proof

Put \(a=\sigma_X^2/n\), \(b=\sigma_Y^2/m\) and \(c=a/(a+b)\in(0,1)\). With \(U_X=(n-1)S_X^2/\sigma_X^2\sim\chi^2_{n-1}\) and \(U_Y=(m-1)S_Y^2/\sigma_Y^2\sim\chi^2_{m-1}\) independent (and independent of \(\bar X,\bar Y\)), \[ V=\frac{S_X^2/n+S_Y^2/m}{a+b}=\frac{a\,U_X/(n-1)+b\,U_Y/(m-1)}{a+b}=c\,\frac{U_X}{n-1}+(1-c)\,\frac{U_Y}{m-1}.\] The numerator \(Z=\dfrac{\bar X-\bar Y-(\mu_X-\mu_Y)}{\sqrt{a+b}}\) is \(\N(0,1)\) and independent of \(V\) by the normal-sample theorem, and \(W=Z/\sqrt V\).

Not pivotal. The law of \(V\), and so of \(W\), depends on \(c\), which depends on the unknown ratio \(\sigma_X^2/\sigma_Y^2\) (and on \(n,m\)). There is an exceptional case: if the weights are proportional to the degrees of freedom, \(\frac c{n-1}=\frac{1-c}{m-1}\), that is \(\frac{\sigma_X^2}{n(n-1)}=\frac{\sigma_Y^2}{m(m-1)}\), then \(V=\frac{c}{n-1}(U_X+U_Y)\) and, since \(\E V=1\), \(V\sim\chi^2_{n+m-2}/(n+m-2)\) exactly, so \(W\sim t_{n+m-2}\) exactly. For \(n=m\) this is \(\sigma_X=\sigma_Y\): the pooled test with equal sizes (Proposition 8.1 of the first-year notes). But this condition involves the unknown variances, so it cannot be used to choose a test; for every other ratio \(V\) is a genuine mixture and no single \(t\) law is correct for all \(c\). That is the Behrens–Fisher problem.

Moment matching. Using \(\E(U/k)=1\) and \(\mathrm{Var}(U/k)=2/k\) for \(U\sim\chi^2_k\), and independence, \[ \E V=c+(1-c)=1,\qquad \mathrm{Var}\,V=2\Big[\frac{c^2}{n-1}+\frac{(1-c)^2}{m-1}\Big].\] A variable \(\chi^2_\nu/\nu\) has mean 1 and variance \(2/\nu\). The means already agree; equating the variances gives \[ \nu=\Big[\frac{c^2}{n-1}+\frac{(1-c)^2}{m-1}\Big]^{-1}=\frac{(a+b)^2}{\dfrac{a^2}{n-1}+\dfrac{b^2}{m-1}}=\frac{\Big(\frac{\sigma_X^2}{n}+\frac{\sigma_Y^2}{m}\Big)^2}{\dfrac{\sigma_X^4}{n^2(n-1)}+\dfrac{\sigma_Y^4}{m^2(m-1)}},\] which is the expression of the book (p. 458). In practice the variances are replaced by \(s_X^2,s_Y^2\), which gives the \(\nu\) of Theorem 9.2.3 (next box). The approximation \(W\approx t_\nu\) is then the \(t\) law that has the same first two moments for \(V\); the first-year notes derive the same \(\nu\) in terms of \(S^2\) directly (Theorem 3.8; Satterthwaite, 1946, used the same moment matching for variance components). ∎

How good is it? In Figure x9.1 (sizes 30 and 10, and 10 and 10, with standard-deviation ratios from 1/4 to 4) Welch's two-sided 5% test has a true size between 0.047 and 0.053 throughout. It is an approximation, not an exact test, but an excellent one.

Theorem 9.2.3 (Welch's approximate \(t\) test) p. 459

Let \(X_1,\dots,X_n\) and \(Y_1,\dots,Y_m\) be independent normal samples with standard deviations \(\sigma_X\) and \(\sigma_Y\). Put \(\hat\theta=s_X^2/s_Y^2\) and \[ \nu=\frac{\big(\hat\theta+\frac nm\big)^2}{\frac1{n-1}\hat\theta^2+\frac1{m-1}\big(\frac nm\big)^2},\] rounded to the nearest integer. Then \(W=\dfrac{\bar X-\bar Y-(\mu_X-\mu_Y)}{\sqrt{S_X^2/n+S_Y^2/m}}\) has approximately a Student \(t\) distribution with \(\nu\) degrees of freedom; tests and intervals follow as in Theorem 9.2.2.

Filling the gap 9.6: the degrees of freedom in the book's \(\theta\) form, their bounds, and what rounding costs pp. 458–459, Question 9.2.18

The book rewrites \(\nu\) in terms of the ratio \(\theta=\sigma_X^2/\sigma_Y^2\) "to be more appealing", and Question 9.2.18 asks why \(\nu<n+m-2\) is a disadvantage. Three facts make everything precise: the \(\theta\) form equals the Satterthwaite form, \(\nu\) always lies between \(\min(n,m)-1\) and \(n+m-2\), and it equals \(n+m-2\) only in a special case.

Hint 1 of 5: the key idea

The book's \(\theta\) form is Satterthwaite's formula with \(\sigma_Y^2\) factored out. For the bounds, compare \((a+b)^2\) with \(a^2/k_1+b^2/k_2\). Which inequality links them?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Put \(a=\theta\sigma_Y^2/n\) and \(b=\sigma_Y^2/m\) in \((a+b)^2/(a^2/(n-1)+b^2/(m-1))\) and cancel the common factor. Aim for: the book's expression in \(\theta\) and \(n/m\).

Hint 4 of 5: step 2

For the upper bound, write \(a+b=\sqrt{k_1}\,\frac a{\sqrt{k_1}}+\sqrt{k_2}\,\frac b{\sqrt{k_2}}\). Aim for: \(\nu\le n+m-2\), with equality iff \(a/k_1=b/k_2\).

Hint 5 of 5: step 3

For the lower bound use \(k=\min(k_1,k_2)\). Aim for: \(\nu\ge\min(n,m)-1\). Then say in one sentence why a smaller \(\nu\) costs power when the variances really are equal.

Proof

The \(\theta\) form. With \(a=\theta\sigma_Y^2/n\) and \(b=\sigma_Y^2/m\) we have \(a+b=\sigma_Y^2(\theta+\frac nm)/n\), \(a^2=\sigma_Y^4\theta^2/n^2\) and \(b^2=\sigma_Y^4(\frac nm)^2/n^2\). Substituting in \(\nu=(a+b)^2\big/\big(\frac{a^2}{n-1}+\frac{b^2}{m-1}\big)\), the factor \(\sigma_Y^4/n^2\) cancels and \[ \nu=\frac{(\theta+n/m)^2}{\frac{\theta^2}{n-1}+\frac{(n/m)^2}{m-1}},\] which is the book's form. It depends on the data only through \(\hat\theta=s_X^2/s_Y^2\) and on the design through \(n/m\).

Bounds (as in Theorem 3.8 of the advanced notes). Put \(k_1=n-1\), \(k_2=m-1\) and, for the estimates, \(a=s_X^2/n\), \(b=s_Y^2/m\). By the Cauchy–Schwarz inequality, \((a+b)^2=\big(\sqrt{k_1}\frac a{\sqrt{k_1}}+\sqrt{k_2}\frac b{\sqrt{k_2}}\big)^2\le(k_1+k_2)\big(\frac{a^2}{k_1}+\frac{b^2}{k_2}\big)\), so \(\nu\le k_1+k_2=n+m-2\), with equality exactly when \(a/k_1=b/k_2\), that is \[ \frac{s_X^2}{n(n-1)}=\frac{s_Y^2}{m(m-1)}.\] This is not the condition \(s_X^2=s_Y^2\) (unless \(n=m\)). For the lower bound, with \(k=\min(k_1,k_2)\), \(\frac{a^2}{k_1}+\frac{b^2}{k_2}\le\frac{a^2+b^2}{k}\le\frac{(a+b)^2}{k}\), so \(\nu\ge k=\min(n,m)-1\). ∎

Why \(\nu<n+m-2\) costs power (Question 9.2.18). If the variances are in fact equal, the pooled test uses \(n+m-2\) degrees of freedom and Welch's uses fewer. A \(t\) law with fewer degrees of freedom has heavier tails, so its critical value is larger and the test rejects a false \(H_0\) less often. With equal variances and equal sizes the statistics coincide and only the critical value differs; for \(n=m=10\) the loss is small (about 16.5 degrees of freedom on average against 18) but with sizes 5 and 20 it is large (about 7.9 against 23). This is the price of not having to assume \(\sigma_X=\sigma_Y\), and it is small compared with the damage the pooled test can do when the assumption is false (Filling the gap 9.4).

Rounding. The book rounds \(\nu\) to an integer because its table lists integer degrees of freedom. The \(t\) quantile is a smooth function of \(\nu\), so using \(\nu\) unrounded (as software does) changes the critical value in the third decimal at most: for Case Study 9.2.3, \(\nu=17.18\) gives \(t_{.025}=2.1081\) against \(2.1098\) for \(\nu=17\).

Case Study 9.2.3: do bigger companies earn more on their equity? pp. 459–460

Take the twelve companies with the largest sales and the twelve with the smallest (return on equity in percent, Table 9.2.4 of the book) and test \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X\ne\mu_Y\) at \(\alpha=0.05\). The sample variances (about 116 and 36) differ by a factor of three, so the book uses Theorem 9.2.3. From the printed table: \(\bar x=18.58\), \(\bar y=21.92\), \(s_X^2=116.08\), \(s_Y^2=35.72\), so \[ w=\frac{18.58-21.92}{\sqrt{116.08/12+35.72/12}}=-0.937,\qquad \hat\theta=3.25,\qquad \nu=17.18\ \to\ 17.\] The critical values are \(\pm t_{.025,17}=\pm2.1098\), so \(H_0\) is not rejected (with \(\nu=17.18\) the two-sided \(P=0.36\)): there is no evidence that return on equity differs. The book prints \(w=-0.928\) from the rounded means 18.6 and 21.9 and the printed variances 115.9929 and 35.7604, which cannot be reproduced exactly from the table as printed; the difference does not matter. Since \(n=m\) the pooled and Welch statistics are equal (here \(t=-0.937\)) and only their degrees of freedom differ (22 against 17.18); the conclusion is the same.

p. 460 The Comment: known variances, and large degrees of freedom. The book adds that if \(\sigma_X^2\) and \(\sigma_Y^2\) are known one should use the normal ratio \(Z\) of equation (9.2.1) instead of a \(t\) ratio, and that for more than 100 degrees of freedom the normal table can stand in for the \(t\) table.

Filling the gap 9.7: the \(Z\) test for known variances (Question 9.2.14) and the "more than 100 degrees of freedom" rule p. 460

Hint 1 of 4: the key idea

With known variances there is nothing to estimate, so \(\bar X-\bar Y\) is a linear combination of independent normals. For the large-df rule, ask what happens to \(\chi^2_\nu/\nu\) as \(\nu\) grows.

Hint 2 of 4: tools you will need
  • A linear combination of independent normals is normal (Theorem 4.3.3 and its corollary).
  • \(\mathrm{Var}(\bar X-\bar Y)=\mathrm{Var}\,\bar X+\mathrm{Var}\,\bar Y\) for independent variables.
  • Slutsky's theorem; \(\E(V/\nu)=1\), \(\mathrm{Var}(V/\nu)=2/\nu\).
Hint 3 of 4: step 1

Find the mean and variance of \(\bar X-\bar Y\) and standardise. Aim for: \(Z\sim\N(0,1)\) exactly.

Hint 4 of 4: step 2

Show the denominator of a \(t_\nu\) variable tends to 1 in probability. Then compare \(t_{.025,100}\) with \(z_{.025}\). Aim for: 1.984 against 1.960.

Proof and numbers

Equation (9.2.1). \(\bar X\sim\N(\mu_X,\sigma_X^2/n)\) and \(\bar Y\sim\N(\mu_Y,\sigma_Y^2/m)\) are independent, so a linear combination is normal: \(\bar X-\bar Y\sim\N\big(\mu_X-\mu_Y,\ \sigma_X^2/n+\sigma_Y^2/m\big)\), because \(\mathrm{Var}(\bar X-\bar Y)=\mathrm{Var}\,\bar X+\mathrm{Var}\,\bar Y\) for independent variables. Standardising, \[ Z=\frac{\bar X-\bar Y-(\mu_X-\mu_Y)}{\sqrt{\sigma_X^2/n+\sigma_Y^2/m}}\sim\N(0,1).\] This is exact, with no degrees of freedom to approximate. The test of \(H_0\colon\mu_X=\mu_Y\) rejects when \(|z|\ge z_{\alpha/2}\) (two-sided) and the interval is \(\bar x-\bar y\pm z_{\alpha/2}\sqrt{\sigma_X^2/n+\sigma_Y^2/m}\) (Question 9.5.5). Example (Question 9.2.12): \(\sigma_X^2=17.6\), \(\sigma_Y^2=22.9\), \(n=10\), \(m=20\), \(\bar x=81.6\), \(\bar y=79.9\) give \(z=1.7/\sqrt{1.76+1.145}=0.997\) and a two-sided \(P=2\P(Z\ge0.997)=0.319\).

Large degrees of freedom. A \(t_\nu\) variable is \(Z'/\sqrt{V/\nu}\) with \(V\sim\chi^2_\nu\); since \(\E(V/\nu)=1\) and \(\mathrm{Var}(V/\nu)=2/\nu\to0\), the denominator tends to 1 in probability and \(t_\nu\to\N(0,1)\) (Slutsky). The quantiles are close once \(\nu\) is moderate: \(t_{.025,100}=1.984\) against \(z_{.025}=1.960\) (a 1.2% difference) and \(t_{.05,470}=1.648\) against \(z_{.05}=1.645\) (0.2%; the book's \(1.64\) is a rounding of \(z_{.05}\)). So treating the statistic as a \(Z\) ratio when \(\nu>100\) changes the level only in the second decimal of the critical value. The rule is a convenience of printed tables; software uses the exact \(t\) law. ∎

Notice the logical difference: the \(Z\) test with known variances is exact; the "use the \(Z\) table when \(\nu>100\)" rule is an approximation for estimated variances.

9.3 Testing \(H_0\colon\sigma_X^2=\sigma_Y^2\): the \(F\) Test

pp. 463–464 Most two-sample studies ask about location, but sometimes the spread is the point. Two machines may fill boxes with the same average weight and yet one of them leaves a much larger fraction of boxes outside the engineering limits (Figure 9.3.1 of the book, a schematic, not redrawn). With independent normal samples, \(X_1,\dots,X_n\) from \(\N(\mu_X,\sigma_X^2)\) and \(Y_1,\dots,Y_m\) from \(\N(\mu_Y,\sigma_Y^2)\), all four parameters unknown, the comparison of variances uses the ratio of sample variances.

Theorem 9.3.1 (the \(F\) test for equal variances) p. 464

Let \(x_1,\dots,x_n\) and \(y_1,\dots,y_m\) be independent normal samples with standard deviations \(\sigma_X,\sigma_Y\). At level \(\alpha\):

  1. to test \(H_0\colon\sigma_X^2=\sigma_Y^2\) against \(H_1\colon\sigma_X^2>\sigma_Y^2\), reject if \(s_Y^2/s_X^2\le F_{\alpha,m-1,n-1}\);
  2. against \(H_1\colon\sigma_X^2<\sigma_Y^2\), reject if \(s_Y^2/s_X^2\ge F_{1-\alpha,m-1,n-1}\);
  3. against \(H_1\colon\sigma_X^2\ne\sigma_Y^2\), reject if \(s_Y^2/s_X^2\le F_{\alpha/2,m-1,n-1}\) or \(s_Y^2/s_X^2\ge F_{1-\alpha/2,m-1,n-1}\).

The book says the proof "will not be given" and that it follows the pattern of other likelihood ratio tests: the likelihood ratio is a monotone function of the \(F\) variable of Definition 7.3.2. It adds that the test is only approximately a GLRT because the two tails of the \(F\) density have different shapes, so the equal-tail cut-offs differ a little from the likelihood-ratio ones. The next two boxes supply the missing pieces: why the ratio has an \(F\) law and how to read the lower cut-off from an upper-tail table, and the likelihood ratio itself, including how much "a little" is.

Filling the gap 9.8: \(S_Y^2/S_X^2\) has an \(F_{m-1,n-1}\) law, and the lower cut-off is the reciprocal of an upper one pp. 464, 466

Hint 1 of 5: the key idea

The \(F\) law is a ratio of independent chi-squared variables over their degrees of freedom. Which two appear in \(S_Y^2/S_X^2\), and what happens to the unknown variance under \(H_0\)?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Write \(S_Y^2/\sigma_Y^2\) and \(S_X^2/\sigma_X^2\) through \(U_Y\) and \(U_X\). Aim for: the ratio is \(F_{m-1,n-1}\); which degrees of freedom go on top?

Hint 4 of 5: step 2

If \(F\sim F_{a,b}\), what law has \(1/F\)? Use it on \(\P(F_{a,b}\le F_{p,a,b})=p\). Aim for: \(F_{p,a,b}=1/F_{1-p,b,a}\).

Hint 5 of 5: step 3

Apply it to get \(F_{.025,9,9}\) from \(F_{.975,9,9}=4.026\) and \(F_{.025,4,6}\) from \(F_{.975,6,4}=9.197\).

Proof

The \(F\) law. By the normal-sample theorem (Theorem 7.3.2) \(U_X=(n-1)S_X^2/\sigma_X^2\sim\chi^2_{n-1}\) and \(U_Y=(m-1)S_Y^2/\sigma_Y^2\sim\chi^2_{m-1}\), independent. By Definition 7.3.2 (a ratio of independent chi-squared variables over their degrees of freedom), \[ \frac{S_Y^2/\sigma_Y^2}{S_X^2/\sigma_X^2}=\frac{U_Y/(m-1)}{U_X/(n-1)}\sim F_{m-1,n-1}.\] When \(\sigma_X^2=\sigma_Y^2\) the unknown variance cancels and \(S_Y^2/S_X^2\sim F_{m-1,n-1}\) exactly, whatever \(\mu_X,\mu_Y\) and the common \(\sigma^2\) are: the statistic is a pivot under \(H_0\), which is what a test needs. The order of the degrees of freedom is the one that is easy to get wrong: numerator degrees of freedom \(m-1\) go with the variance on top, \(S_Y^2\).

The reciprocal symmetry. If \(F\sim F_{a,b}\) then \(1/F=\dfrac{V/b}{U/a}\sim F_{b,a}\) (the same ratio upside down). Hence, for \(0<p<1\), \[ p=\P(F_{a,b}\le F_{p,a,b})=\P\big(F_{b,a}\ge1/F_{p,a,b}\big)\quad\Longrightarrow\quad 1-p=\P\big(F_{b,a}\le1/F_{p,a,b}\big),\] so \(1/F_{p,a,b}=F_{1-p,b,a}\), that is \[ F_{p,a,b}=\frac1{F_{1-p,\,b,\,a}}.\] Tables list mostly upper points, so lower cut-offs come from this rule with the degrees of freedom swapped: \(F_{.025,9,9}=1/F_{.975,9,9}=1/4.026=0.2484\) (the book's \(0.248\)), \(F_{.025,4,6}=1/F_{.975,6,4}=1/9.197=0.1087\) (Case Study 9.5.2) and \(F_{.025,11,11}=1/3.474=0.288\) (Question 9.3.1). ∎

The same fact says what happens if one swaps the labels \(X\) and \(Y\): the statistic \(S_X^2/S_Y^2\) is the reciprocal and the test (c) rejects for exactly the same data, because the two cut-offs \(F_{\alpha/2,m-1,n-1}\) and \(F_{1-\alpha/2,m-1,n-1}\) become each other's reciprocals. A one-sided test puts the larger sample variance on top (so that \(F\ge1\)) and compares with the upper point only.

The two-sided P-value is twice the smaller tail: \(P=2\min\{\P(F_{m-1,n-1}\le F),\P(F_{m-1,n-1}\ge F)\}\). For Case Study 9.3.1, \(F=1.70\) with 9 and 9 degrees of freedom has \(P=0.44\).

Filling the gap 9.9: the likelihood ratio for two variances (Question 9.3.9), and how equal-tailed the exact test is pp. 464, 468

Question 9.3.9 asks for the likelihood ratio; Theorem 9.3.1 says the \(F\) test is "approximately" the GLRT. Here is the ratio, its shape, and the exact likelihood-ratio cut-offs.

Hint 1 of 6: the key idea

The likelihood ratio depends on the data only through \(r=B/A\), the ratio of the two sums of squares. Look at how it rises and falls with \(r\): the shape of \(\lambda(r)\) decides the rejection region.

Hint 2 of 6: tools you will need
  • The MLEs \(\hat\sigma_X^2=A/n\), \(\hat\sigma_Y^2=B/m\) on \(\Omega\) and \((A+B)/N\) on \(\omega\) (gap 9.2).
  • Differentiating \(\ln\lambda(r)\).
  • The \(F\) law of gap 9.8.
Hint 3 of 6: step 1

Compute the two maximised likelihoods and divide. Aim for: the expression of Question 9.3.9; then set \(r=B/A\).

Hint 4 of 6: step 2

Differentiate \(\ln\lambda(r)=\mathrm{const}+\frac m2\ln r-\frac N2\ln(1+r)\). Aim for: a single maximum at \(r=m/n\) with \(\lambda=1\).

Hint 5 of 6: step 3

For \(n=m\) show \(\lambda(r)=\lambda(1/r)\) and use \(1/F_{9,9}\sim F_{9,9}\). Aim for: the exact test is the equal-tailed one.

Hint 6 of 6: step 4

For \(n\ne m\) the equal-height and equal-area conditions differ. Solve both numerically for \(n=8\), \(m=12\). Aim for: exact likelihood-ratio tail areas of about \(0.018\) (lower) and \(0.032\) (upper). Then compare the power of the two tests at variance ratios just below and just above 1: is either exactly unbiased?

Proof and numbers

Put \(A=\sum(x_i-\bar x)^2\), \(B=\sum(y_j-\bar y)^2\), \(N=n+m\). The parameter space \(\Omega\) lets \(\mu_X,\mu_Y,\sigma_X^2,\sigma_Y^2\) vary; \(\omega\) requires \(\sigma_X^2=\sigma_Y^2=\sigma^2\). Maximising as in Filling the gap 9.2:

  • on \(\Omega\): \(\hat\mu_X=\bar x\), \(\hat\mu_Y=\bar y\), \(\hat\sigma_X^2=A/n\), \(\hat\sigma_Y^2=B/m\), and the maximised likelihood is \((2\pi e)^{-N/2}(A/n)^{-n/2}(B/m)^{-m/2}\);
  • on \(\omega\): \(\hat\sigma^2=(A+B)/N\) and the maximised likelihood is \((2\pi e)^{-N/2}\big(\frac{A+B}N\big)^{-N/2}\).
Dividing, \[ \lambda=\frac{(A/n)^{n/2}(B/m)^{m/2}}{\big((A+B)/N\big)^{N/2}}=\frac{N^{N/2}}{n^{n/2}m^{m/2}}\cdot\frac{A^{n/2}B^{m/2}}{(A+B)^{N/2}},\] which is the expression of Question 9.3.9. Divide numerator and denominator by \(A^{N/2}\) and put \(r=B/A\): \[ \lambda(r)=\frac{N^{N/2}}{n^{n/2}m^{m/2}}\ \frac{r^{m/2}}{(1+r)^{N/2}},\qquad F=\frac{B/(m-1)}{A/(n-1)}=\frac{n-1}{m-1}\,r.\] So \(\lambda\) depends on the data only through \(F=s_Y^2/s_X^2\).

Shape. \(\ln\lambda(r)=\mathrm{const}+\frac m2\ln r-\frac N2\ln(1+r)\) has derivative \(\frac m{2r}-\frac N{2(1+r)}\), positive for \(r<m/n\) and negative for \(r>m/n\). So \(\lambda\) rises from 0 at \(r=0\) to its maximum \(\lambda(m/n)=1\) and falls back to 0 as \(r\to\infty\). Therefore \(\{\lambda\le\lambda^*\}=\{r\le r_1\}\cup\{r\ge r_2\}\) with \(r_1<m/n<r_2\) and \(\lambda(r_1)=\lambda(r_2)=\lambda^*\): a two-tailed \(F\) test, as claimed, with cut-offs chosen to make the heights of \(\lambda\) equal. The level requires \(\P(r\le r_1)+\P(r\ge r_2)=\alpha\) under \(H_0\).

Equal sample sizes. If \(n=m\) then \(\lambda(r)=\lambda(1/r)\) (substitute \(1/r\): \(r^{-n/2}(1+1/r)^{-n}=r^{n/2}(1+r)^{-n}\)), so \(r_2=1/r_1\); since \(1/F_{9,9}\) has the same law as \(F_{9,9}\), the two tail areas are equal, and the exact likelihood ratio test is the equal-tailed test: for Case Study 9.3.1 the cut-offs are \(0.2484\) and \(4.026\).

Unequal sample sizes. Then the equal-height and equal-area conditions disagree. Solving numerically: for \(n=8\), \(m=12\) (so \(F\) has 11 and 7 degrees of freedom) the equal-tailed cut-offs are \(0.266\) and \(4.709\), but the exact likelihood ratio cut-offs are \(0.242\) and \(4.30\), with tail areas \(0.018\) and \(0.032\) instead of \(0.025\) and \(0.025\): the likelihood ratio moves part of \(\alpha\) into the upper tail, which is longer. Here "slightly different areas" is a fair description, and the two tests behave almost alike. Neither is exactly unbiased: the power of the exact likelihood ratio test dips to \(0.0494\) near \(\sigma_Y^2/\sigma_X^2=0.95\) (it is \(0.050\) at ratio \(0.9\) and \(0.060\) at \(1.2\)), and that of the equal-tailed test to \(0.0497\) near \(1.04\) (\(0.054\), \(0.050\) and \(0.054\) at ratios \(0.9\), \(1.1\) and \(1.2\)). Both dips are tiny; the exactly unbiased cut-offs are a third choice (Lehmann and Romano, 2005, Chapter 5). Statisticians use the equal-tailed version because its cut-offs come straight from a table of \(F\) quantiles. ∎

Question 9.3.10 (known means) leads to \(F=\dfrac{\sum(y_j-\mu_Y)^2/m}{\sum(x_i-\mu_X)^2/n}\), an \(F_{m,n}\) variable with no degrees of freedom lost to estimating means.

Case Study 9.3.1: does solitary confinement change the variability of alpha waves? pp. 464–466

Twenty prison inmates were split at random into ten kept in solitary confinement and ten left in their own cells; seven days later the frequency of their alpha waves was recorded (Table 9.3.1; Figure 9.3.2). The solitary group looks lower and more variable. For the second claim test \(H_0\colon\sigma_X^2=\sigma_Y^2\) against \(H_1\colon\sigma_X^2\ne\sigma_Y^2\) at \(\alpha=0.05\), with \(X\) the nonconfined group. The sample variances are \(s_X^2=0.211\) and \(s_Y^2=0.357\) (the book rounds them to 0.21 and 0.36), so \[ F=\frac{s_Y^2}{s_X^2}=1.70\quad(\text{the book's }1.71),\] to be compared with \(F_{.025,9,9}=0.248\) and \(F_{.975,9,9}=4.03\) (Figure 9.3.3). The ratio is well inside, so \(H_0\) is not rejected (\(P=0.44\)): a ratio of variances of 1.7 is entirely ordinary for samples of ten. Remember that failing to reject does not show the variances are equal, only that the data cannot tell them apart (a 10-and-10 test detects a doubling of the standard deviation only half the time, Filling the gap 9.10).

The book then notes that, the variances being accepted as equal, the next step would be the pooled \(t\) test of the means. Since the two groups were assigned at random and only compare spread here, that advice is fine in this example; as a general rule it is criticised in Filling the gap 9.10.

A dot plot on one axis from 8.8 to 11.4 cycles per second with two rows of dots: the nonconfined subjects, mostly between 10.3 and 11.2 with one at 9.6, and the solitary-confinement subjects spread from 9.0 to 10.9; triangles mark the two sample means.
Figure 9.3.2. Alpha-wave frequencies (cycles per second) of the ten nonconfined and the ten solitary-confinement inmates of Case Study 9.3.1; the triangles are the sample means (10.58 and 9.78). The solitary group is lower and more spread out. Data: Table 9.3.1. Reproduces Larsen and Marx (2018), Figure 9.3.2. Code: ch09_two_sample_inference.py, fig_9_3_2.
The F density with 9 and 9 degrees of freedom, rising steeply to a peak near 0.6 and with a long right tail; both tails beyond 0.248 and 4.03 are shaded red and labelled 0.025, and a green vertical line at the observed ratio 1.70 lies in the acceptance region.
Figure 9.3.3. The \(F\) density with 9 and 9 degrees of freedom, the two equal-area rejection tails of the 5% test (cut-offs 0.248 and 4.03) and the observed ratio 1.70, which falls in the acceptance region. Because \(n=m\) these are also the exact likelihood ratio cut-offs (Filling the gap 9.9). Reproduces Larsen and Marx (2018), Figure 9.3.3. Code: ch09_two_sample_inference.py, fig_9_3_3.
▶ DemoThe F test for equal variancesSimulate thousands of studies of the Case Study 9.3.1 size: with normal data the histogram of \(\ln F\) follows the \(F\) curve and the test rejects 5% of the time (preset 1); with heavy tails or skew it does not (preset 2, preset 3).

Filling the gap 9.10: the \(F\) test is not robust, and "test the variances first" is a poor rule pp. 463–464, 466

The book's Comment advises running a test of \(H_0\colon\sigma_X^2=\sigma_Y^2\) before every test of \(H_0\colon\mu_X=\mu_Y\): if it accepts, use Theorem 9.2.2, otherwise Theorem 9.2.3. Two things are wrong with the advice. The \(F\) test is far less trustworthy than the \(t\) test when the data are not normal, and chaining two tests changes the size of the combined procedure and gains little.

Claim. Let both samples be iid with finite fourth moment, variance \(\sigma^2\) and standardised fourth moment \(\kappa=\E(X-\mu)^4/\sigma^4\) (\(\kappa=3\) for normal data, 1.8 uniform, 6 Laplace, 9 for the exponential and for \(t_5\)), with equal true variances. Then as \(n,m\to\infty\) the true size of the nominal two-sided \(F\) test tends to \[ 2\Big(1-\Phi\Big(z_{\alpha/2}\sqrt{\tfrac{2}{\kappa-1}}\Big)\Big),\] which is \(\alpha\) only for \(\kappa=3\).

Hint 1 of 6: the key idea

The \(t\) test is protected by the central limit theorem because \(\mathrm{Var}\,\bar X=\sigma^2/n\) whatever the shape. What does \(\mathrm{Var}\,S^2\) depend on, and what does that do to the \(F\) ratio?

Hint 2 of 6: tools you will need
  • The CLT for the iid variables \((X_i-\mu)^2\), with variance \(\sigma^4(\kappa-1)\).
  • The delta method for \(\ln\); Slutsky's theorem.
  • \(\ln F_{a,b}\) has variance about \(2/a+2/b\); gap 9.4 for the \(t\) side.
Hint 3 of 6: step 1

Show \(\sqrt n(S^2-\sigma^2)\to\N(0,\sigma^4(\kappa-1))\), then take logarithms. Aim for: variance \(\kappa-1\).

Hint 4 of 6: step 2

Combine the two independent samples. Aim for: \(\ln F\approx\N(0,(\kappa-1)(1/n+1/m))\) under \(H_0\), against \(2(1/n+1/m)\) for normal data.

Hint 5 of 6: step 3

Turn the ratio of standard deviations \(\sqrt{(\kappa-1)/2}\) into a size. Aim for: \(2(1-\Phi(z_{\alpha/2}\sqrt{2/(\kappa-1)}))\); evaluate it for \(\kappa=6\) and \(9\).

Hint 6 of 6: step 4

Explain, with the pooled test of sizes 30 and 10, why “test the variances first” gives a combined test of the wrong size and little gain over Welch.

Proof

Let \(D_i=(X_i-\mu)^2\), with mean \(\sigma^2\) and variance \(\E(X-\mu)^4-\sigma^4=\sigma^4(\kappa-1)\). Since \(S^2=\frac n{n-1}\big(\frac1n\sum D_i-(\bar X-\mu)^2\big)\), and \(\sqrt n(\bar X-\mu)^2\to0\) in probability, the central limit theorem and Slutsky give \(\sqrt n(S^2-\sigma^2)\to\N\big(0,\sigma^4(\kappa-1)\big)\). (Exactly, \(\mathrm{Var}\,S^2=\sigma^4\big[\frac2{n-1}+\frac{\kappa-3}n\big]\); for normal data \(2\sigma^4/(n-1)\).) The delta method for the logarithm gives \(\sqrt n(\ln S^2-\ln\sigma^2)\to\N(0,\kappa-1)\). By independence of the two samples, \[ \ln\frac{S_Y^2}{S_X^2}\approx\N\Big(0,\ (\kappa-1)\Big(\frac1n+\frac1m\Big)\Big)\quad\text{under }H_0.\] For normal data the same calculation (\(\kappa=3\)) gives variance \(2(\frac1n+\frac1m)\), and indeed \(\ln F_{a,b}\) has variance about \(\frac2a+\frac2b\); so the cut-offs \(F_{\alpha/2}\), \(F_{1-\alpha/2}\) correspond, on the log scale, to \(\pm z_{\alpha/2}\sqrt{2(\frac1n+\frac1m)}\). The true statistic has standard deviation \(\sqrt{(\kappa-1)/2}\) times larger, so \[ \P(\text{reject})\to\P\big(|\N(0,1)|\ge z_{\alpha/2}\sqrt{2/(\kappa-1)}\big),\] the displayed formula. ∎

Numbers. The limits are \(0.002\) (uniform), \(0.05\) (normal), \(0.215\) (Laplace) and \(0.327\) (\(t_5\) or exponential). The limit is approached slowly, which is why the bars for \(n=m=50\) in Figure x9.2 still fall short of it. With \(n=m=10\) the simulated sizes are \(0.011\), \(0.049\), \(0.157\), \(0.127\) and \(0.230\) for uniform, normal, Laplace, \(t_5\) and exponential data, and with \(n=m=20\) heavy tails are worse (\(t_5\): \(0.161\)). The cause is that the variance of a sample variance depends on the fourth moment, which no amount of normal-theory bookkeeping can know about. The \(t\) test is protected by the central limit theorem because a sample mean has variance \(\sigma^2/n\) whatever the shape (Filling the gap 9.4); no such protection exists for the variance.

Test the variances first? In the two-stage procedure "pooled \(t\) if the \(F\) test accepts, Welch if it rejects", the final size is a mixture of the two. For normal data and sizes 30 and 10, Figure x9.1 shows that the size of the pooled test alone climbs to \(0.158\) when the second standard deviation is twice the first, the two-stage rule only reduces it to \(0.073\) (the \(F\) test often fails to notice the unequal variances), while Welch's test used throughout has size \(0.053\). The two-stage rule is never better than using Welch's test straight away, and for non-normal data the first stage itself has the wrong size. Modern practice is therefore to use Welch's test by default, and the loss of degrees of freedom is small (Filling the gap 9.6). Reserve the \(F\) test for the case where the ratio of variances is itself the object of interest, with normal data.

Bar chart of the rejection rate of the nominal 5 percent F test when the variances are equal, for uniform, normal, Laplace and t5 data; bars for n equal m equal 10 and 50 sit near 0.01 and 0.002, 0.05, 0.16 and 0.19, 0.13 and 0.20, with black marks at the limits 0.002, 0.05, 0.215 and 0.327.
Figure x9.2. The true size of the nominal 5% \(F\) test of equal variances when the data are not normal (the variances are equal in every case). The black marks are the limits \(2(1-\Phi(z_{.025}\sqrt{2/(\kappa-1)}))\) as \(n,m\to\infty\), \(\kappa\) the standardised fourth moment. Own figure. Code: ch09_two_sample_inference.py, fig_x9_2.
Two panels of rejection rate when the means are equal against the ratio of standard deviations from 1/4 to 4. Left, sizes 30 and 10: the pooled t rate falls to 0.002 for small ratios and rises to 0.24 for large ratios, the Welch rate stays near 0.05 and the F-test-then-t rate lies between. Right, sizes 10 and 10: all three curves stay between 0.047 and 0.061.
Figure x9.1. The true size of three tests of \(H_0\colon\mu_X=\mu_Y\) (normal data, equal means) as the ratio \(\sigma_Y/\sigma_X\) varies: the pooled \(t\) test, Welch's test, and the two-stage rule "\(F\) test at 5%, then pooled \(t\) if it accepts and Welch if it rejects". (a) Sizes \(n=30\), \(m=10\): the pooled test is far from its nominal 5% in both directions and the two-stage rule repairs it only partly. (b) Equal sizes: all three are close to 5%. Twenty thousand simulated studies per point. Own figure. Code: ch09_two_sample_inference.py, fig_x9_1.

9.4 Binomial Data: Testing \(H_0\colon p_X=p_Y\)

pp. 468–469 So far the data were normal. The commonest other case is yes/no data: \(x\) successes in \(n\) independent trials of treatment \(X\) and \(y\) in \(m\) independent trials of treatment \(Y\), with success probabilities \(p_X\) and \(p_Y\). To test \(H_0\colon p_X=p_Y\,(=p)\) against \(H_1\colon p_X\ne p_Y\) the book follows the likelihood ratio recipe. The likelihood is \(L=p_X^x(1-p_X)^{n-x}p_Y^y(1-p_Y)^{m-y}\); under \(\omega\) (\(p_X=p_Y=p\)) it is maximised at the pooled proportion \(p_e=\dfrac{x+y}{n+m}\), and on \(\Omega\) at \(p_{Xe}=x/n\), \(p_{Ye}=y/m\), giving \[ \lambda=\frac{p_e^{\,x+y}(1-p_e)^{n+m-x-y}}{(x/n)^x(1-x/n)^{n-x}(y/m)^y(1-y/m)^{m-y}}\tag{9.4.1}\] (the likelihood ratio, equation 9.4.1). It is hard to work with, so the book offers two approximations: \(-2\ln\lambda\) is approximately \(\chi^2_1\) under \(H_0\) (reject at 5% if \(-2\ln\lambda\ge3.84\)), and, the one used in practice, the central limit theorem.

Theorem 9.4.1 (the two-proportion \(z\) test) p. 469

Let \(x\) and \(y\) be the numbers of successes in independent sets of \(n\) and \(m\) Bernoulli trials with success probabilities \(p_X,p_Y\). Let \(p_e=\dfrac{x+y}{n+m}\) and \[ z=\frac{\dfrac xn-\dfrac ym}{\sqrt{\dfrac{p_e(1-p_e)}{n}+\dfrac{p_e(1-p_e)}{m}}}.\] At level \(\alpha\), to test \(H_0\colon p_X=p_Y\): reject against \(H_1\colon p_X>p_Y\) if \(z\ge z_\alpha\); against \(H_1\colon p_X<p_Y\) if \(z\le-z_\alpha\); against \(H_1\colon p_X\ne p_Y\) if \(z\le-z_{\alpha/2}\) or \(z\ge z_{\alpha/2}\).

The book derives it in one paragraph: under \(H_0\), \(\frac Xn-\frac Ym\) has mean \(0\) and variance \(p(1-p)\big(\frac1n+\frac1m\big)\), the central limit theorem makes it approximately normal, and \(p\) is replaced by its maximum likelihood estimate \(p_e\) under \(H_0\). The first-year advanced notes prove the statement, with the Slutsky step, as Theorem 9.1 (demo). The two boxes below fill what the book leaves implicit: how the likelihood ratio (9.4.1) and the \(z\) test are related, and why a test that pools the two samples sits beside an interval that does not.

Filling the gap 9.11: \(-2\ln\lambda\) and \(z^2\) are two approximations to one quantity; \(z^2\) is Pearson's chi-squared pp. 469, 473 (Question 9.4.10)

Hint 1 of 5: the key idea

Write both statistics as sums over the four cells of the \(2\times2\) table, observed against expected under \(H_0\). Then compare \(2\sum O\ln(O/E)\) with \(\sum(O-E)^2/E\).

Hint 2 of 5: tools you will need
  • The likelihood ratio (9.4.1) and \(p_e=(x+y)/(n+m)\).
  • The second-order expansion of \(O\ln(O/E)\) around \(O=E\).
  • Wilks' theorem (Theorem 10.22) and gap 10.12.
Hint 3 of 5: step 1

List the four expected counts \(np_e,n(1-p_e),mp_e,m(1-p_e)\) and rewrite \(\ln\lambda\) as \(\sum O\ln(E/O)\).

Hint 4 of 5: step 2

Show all four residuals \(O-E\) equal \(\pm\delta\) with \(\delta=\frac{nm}{n+m}(\frac xn-\frac ym)\). Aim for: \(\sum(O-E)^2/E=\delta^2(\frac1n+\frac1m)/(p_e(1-p_e))\).

Hint 5 of 5: step 3

Simplify to \(z^2\). Then expand \(O\ln(O/E)\) to second order; why do the first-order terms cancel?

Proof

The cells. Arrange the data as a \(2\times2\) table with observed counts \(O=\big(x,\ n-x,\ y,\ m-y\big)\) (successes and failures in each sample). Under \(H_0\) the expected counts, with \(p\) estimated by \(p_e\), are \(E=\big(np_e,\ n(1-p_e),\ mp_e,\ m(1-p_e)\big)\). The log likelihood ratio is \(\ln\lambda=\sum_{\rm cells}O\ln(E/O)\): in (9.4.1) each cell contributes \(O\ln\) of its probability under \(H_0\) to the numerator (\(p_e\) for a success, \(1-p_e\) for a failure) and \(O\ln\) of its estimated probability under \(\Omega\) (\(x/n\), \(1-x/n\), \(y/m\), \(1-y/m\)) to the denominator, and the ratio of the two probabilities in a cell is \(\frac{p_e}{x/n}=\frac{np_e}{x}=\frac EO\) (and likewise for the other three cells). Hence \[ -2\ln\lambda=2\sum_{\rm cells}O\ln\frac OE\qquad(\text{with }0\ln0=0).\] For Question 9.4.10 (Case Study 9.4.2): \(O=(55,105,60,132)\), \(E=(52.3,107.7,62.7,129.3)\) and \(-2\ln\lambda=0.387\), far below the 1% point \(\chi^2_{.99,1}=6.635\): \(H_0\) is not rejected.

\(z^2\) is Pearson's statistic. Let \(d=\frac xn-\frac ym\). Then \(x-np_e=n(\frac xn-p_e)\), and since \(p_e=\frac{n(x/n)+m(y/m)}{n+m}\), \(\frac xn-p_e=\frac m{n+m}d\), so \(x-np_e=\frac{nm}{n+m}d=:\delta\). Because each margin is fixed, the other three residuals are \(-\delta\), \(-\delta\), \(+\delta\) (\(y-mp_e=-\delta\)). Therefore \[ \sum\frac{(O-E)^2}{E}=\delta^2\Big[\frac1{np_e}+\frac1{n(1-p_e)}+\frac1{mp_e}+\frac1{m(1-p_e)}\Big]=\frac{\delta^2\big(\frac1n+\frac1m\big)}{p_e(1-p_e)}=\frac{d^2}{p_e(1-p_e)\big(\frac1n+\frac1m\big)}=z^2,\] using \(\delta^2\big(\frac1n+\frac1m\big)=\frac{n^2m^2}{(n+m)^2}d^2\cdot\frac{n+m}{nm}=\frac{nm}{n+m}d^2\) and \(\frac{nm}{n+m}=\big(\frac1n+\frac1m\big)^{-1}\). So the two-sided \(z\) test is Pearson's chi-squared test of independence for the \(2\times2\) table (Chapter 10 of the book).

Two approximations to one statistic. A second-order expansion of \(O\ln(O/E)\) around \(O=E\) is \((O-E)+\frac{(O-E)^2}{2E}+\cdots\) and the first-order terms sum to zero (observed and expected totals agree), so \(-2\ln\lambda\approx\sum\frac{(O-E)^2}{E}=z^2\) when the counts are large, and both are approximately \(\chi^2_1\) under \(H_0\) (Wilks' theorem, Wilks 1938: \(\Omega\) has two free parameters and \(\omega\) one; the proof and the link to Pearson's statistic are in Filling the gap 10.12 of the graduate course). For the nightmare data \(z^2=0.3875\) and \(-2\ln\lambda=0.3870\). The two differ only in the fourth decimal because \(n\) is large; for small counts they can differ noticeably and neither is exact.

How good is the approximation? The true size of the nominal 5% two-sided \(z\) test, computed by summing the binomial probabilities of every table with \(|z|\ge1.96\), is \(0.039\) at \(p_X=p_Y=0.1\) and \(0.043\) at \(0.5\) for \(n=m=20\), and \(0.052\) for \(n=m=100\), \(p=0.1\). ∎

Case Study 9.4.1: did carbolic acid save lives? pp. 470–471

Joseph Lister performed forty amputations with carbolic acid as a disinfectant and thirty-five without it; 34 and 19 patients survived. Test \(H_0\colon p_X=p_Y\) against \(H_1\colon p_X>p_Y\) at \(\alpha=0.01\), where \(p_X\) is the survival probability with the antiseptic. The pooled survival rate is \(p_e=53/75=0.707\), the sample proportions are \(0.850\) and \(0.543\), and \[ z=\frac{0.850-0.543}{\sqrt{\frac{0.707\cdot0.293}{40}+\frac{0.707\cdot0.293}{35}}}=2.91\] (the book's \(2.92\) uses the rounded proportions). This exceeds \(z_{.01}=2.326\) (one-sided \(P=0.0018\)): reject \(H_0\); the antiseptic saved lives. The book adds that Lister's work was not accepted at once in Britain, and recalls the death of President Garfield from infection after his doctors dismissed it.

Case Study 9.4.2: do men and women have nightmares equally often? pp. 471–472

In a survey of 160 men and 192 women, 55 men (34.4%) and 60 women (31.3%) reported nightmares "often" (Table 9.4.1). With \(H_0\colon p_M=p_W\) against the two-sided alternative at \(\alpha=0.05\): \(p_e=115/352=0.327\) and \[ z=\frac{0.344-0.313}{\sqrt{\frac{0.327\cdot0.673}{160}+\frac{0.327\cdot0.673}{192}}}=0.62,\] well inside \(\pm1.96\) (\(P=0.53\)); there is no evidence that the frequencies differ. About the data. The 352 people were all institutionalised mental patients, so the conclusion, whatever the test says, concerns that population only: inference reaches as far as the sampling, and no further.

Filling the gap 9.12: why the test pools the two samples and the interval does not pp. 469, 476

In Theorem 9.4.1 the variance estimate uses the single pooled proportion \(p_e\) for both samples; the interval of Theorem 9.5.3 (next section) uses \(\frac xn(1-\frac xn)\) and \(\frac ym(1-\frac ym)\) separately. This is not an inconsistency, but it has a consequence the book does not mention: the test and the interval can disagree.

Hint 1 of 5: the key idea

A test is computed as if \(H_0\) were true; an interval must be valid whether it is or not. Which estimate of \(p\) is allowed in each?

Hint 2 of 5: tools you will need
  • \(\mathrm{Var}(\hat p_X-\hat p_Y)\) for independent samples.
  • The restricted and unrestricted maximum likelihood estimates (Section 9.4).
  • Duality of tests and intervals (gap 6.3); first-year Theorem 9.1.
Hint 3 of 5: step 1

Write the variance of \(\hat p_X-\hat p_Y\) when \(p_X=p_Y\) and when they are free. Which \(p\)'s can be replaced by \(p_e\)?

Hint 4 of 5: step 2

Compute the pooled \(z\) for 0 successes in 10 against 3 in 10. Aim for: \(|z|\approx1.88<1.96\).

Hint 5 of 5: step 3

Compute the interval of Theorem 9.5.3 for the same data. Aim for: it excludes 0, so test and interval disagree. Why does this never happen for means?

Explanation and an example

Why the difference. A test is computed assuming \(H_0\) is true, so \(p_X=p_Y=p\) and the best estimate of the one unknown \(p\) is the pooled \(p_e\) (the restricted maximum likelihood estimate, which uses all \(n+m\) trials). An interval must hold for every value of \(p_X-p_Y\), including nonzero ones, so it cannot assume \(p_X=p_Y\): the variance of \(\frac Xn-\frac Ym\) is \(\frac{p_X(1-p_X)}n+\frac{p_Y(1-p_Y)}m\) and each term is estimated from its own sample. Both statistics are asymptotically \(\N(0,1)\) (Theorem 3.9 and Theorem 9.1 of the first-year notes), because \(p_e\) and the separate estimates are all consistent under \(H_0\).

The consequence. For means, the pooled interval is the exact dual of the pooled test (Filling the gap 6.3): the interval excludes 0 exactly when the test rejects. For proportions it is not: inverting the test would give an interval whose limits solve \(z=\pm z_{\alpha/2}\) with a variance that changes with the hypothesised difference, and the interval of Theorem 9.5.3 differs from that. So the two can disagree near the boundary. Example: 0 successes in 10 trials against 3 in 10. The pooled estimate is \(p_e=0.15\) and \(z=\dfrac{0-0.3}{\sqrt{0.15\cdot0.85\cdot0.2}}=-1.88\), two-sided \(P=0.06\): not significant at 5%. The interval of Theorem 9.5.3 is \(-0.30\pm1.96\sqrt{0+0.3\cdot0.7/10}=(-0.58,\ -0.016)\), which excludes 0. For Lister's data the pooled \(z=2.91\) and the unpooled one is \(3.03\).

Both calculations are approximations, and with a count of 0 or 3 neither should be trusted; the lesson is that "the interval excludes 0" and "the test rejects" are the same statement for means but only approximately the same for proportions. When it matters, report the interval, or use an exact method (Fisher's exact test) for small counts. ∎

9.5 Confidence Intervals for the Two-Sample Problem

p. 473 For two-sample data a null hypothesis always exists ("no difference"), but an interval says more: how large the difference might be. The intervals for \(\mu_X-\mu_Y\), \(\sigma_X^2/\sigma_Y^2\) and \(p_X-p_Y\) all come from the same recipe as in Chapter 7 of the book: take a pivot, whose law is free of the unknowns, and rearrange the inequality "pivot between two quantiles" to put the parameter in the middle.

Theorem 9.5.1 (interval for \(\mu_X-\mu_Y\), equal variances) p. 473

For independent normal samples with the same standard deviation \(\sigma\), a \(100(1-\alpha)\%\) confidence interval for \(\mu_X-\mu_Y\) is \[ \Big(\bar x-\bar y-t_{\alpha/2,n+m-2}\,s_p\sqrt{\tfrac1n+\tfrac1m},\ \ \bar x-\bar y+t_{\alpha/2,n+m-2}\,s_p\sqrt{\tfrac1n+\tfrac1m}\Big).\] If the variances may differ the book's Comment (p. 475) gives the approximate interval \(\bar x-\bar y\pm t_{\alpha/2,\nu}\sqrt{s_X^2/n+s_Y^2/m}\), with \(\nu\) from Theorem 9.2.3 (use \(z_{\alpha/2}\) if \(\nu>100\)).

Theorem 9.5.2 (interval for \(\sigma_X^2/\sigma_Y^2\)) p. 475

For independent normal samples, a \(100(1-\alpha)\%\) confidence interval for the variance ratio \(\sigma_X^2/\sigma_Y^2\) is \[ \Big(\frac{s_X^2}{s_Y^2}F_{\alpha/2,m-1,n-1},\ \ \frac{s_X^2}{s_Y^2}F_{1-\alpha/2,m-1,n-1}\Big).\]

Theorem 9.5.3 (interval for \(p_X-p_Y\)) p. 476

If \(x\) and \(y\) are the numbers of successes in independent sets of \(n\) and \(m\) Bernoulli trials, an approximate \(100(1-\alpha)\%\) confidence interval for \(p_X-p_Y\) is \[ \frac xn-\frac ym\ \pm\ z_{\alpha/2}\sqrt{\frac{\frac xn\big(1-\frac xn\big)}n+\frac{\frac ym\big(1-\frac ym\big)}m}.\]

Filling the gap 9.13: the pivots behind Theorems 9.5.1 and 9.5.2, and their duality with the tests (Questions 9.5.4, 9.5.5, 9.5.8) pp. 473, 475, 478

Hint 1 of 5: the key idea

A confidence interval is a pivot inverted: put the parameter alone between two quantiles of a law that is free of the parameters. Which pivot is it in each of the three cases?

Hint 2 of 5: tools you will need
  • The pooled \(t\) pivot (gap 9.1) and the \(F\) pivot \(\frac{S_Y^2/\sigma_Y^2}{S_X^2/\sigma_X^2}\) (gap 9.8).
  • Multiplying an inequality by a positive number keeps the order; subtracting reverses it.
  • Tests and intervals (gap 6.3).
Hint 3 of 5: step 1

Isolate \(\mu_X-\mu_Y\) in \(\P(-t_{\alpha/2}\le T\le t_{\alpha/2})=1-\alpha\). Aim for: Theorem 9.5.1.

Hint 4 of 5: step 2

Write \(\sigma_X^2/\sigma_Y^2=Q\cdot S_X^2/S_Y^2\) with \(Q\sim F_{m-1,n-1}\) and isolate it. Aim for: Theorem 9.5.2; why does \(m-1\) come first?

Hint 5 of 5: step 3

Check the duality: the pooled interval excludes 0 iff \(|t|>t_{\alpha/2}\); the variance-ratio interval contains 1 iff the \(F\) test does not reject.

Proof

Theorem 9.5.1. By Theorem 9.2.1, \(T=\dfrac{\bar X-\bar Y-(\mu_X-\mu_Y)}{S_p\sqrt{1/n+1/m}}\sim t_{n+m-2}\), a law free of all parameters, so \(\P\big(-t_{\alpha/2}\le T\le t_{\alpha/2}\big)=1-\alpha\) (equation 9.5.1). Multiply the inequalities by \(S_p\sqrt{1/n+1/m}>0\) and subtract \(\bar X-\bar Y\) throughout, which reverses the order, to get \[ \P\Big(\bar X-\bar Y-t_{\alpha/2}S_p\sqrt{\tfrac1n+\tfrac1m}\ \le\ \mu_X-\mu_Y\ \le\ \bar X-\bar Y+t_{\alpha/2}S_p\sqrt{\tfrac1n+\tfrac1m}\Big)=1-\alpha.\] Replacing the random \(\bar X,\bar Y,S_p\) by their observed values gives the interval. Known variances (Question 9.5.5): the same argument with the \(\N(0,1)\) pivot \(Z\) of (9.2.1) gives \(\bar x-\bar y\pm z_{\alpha/2}\sqrt{\sigma_X^2/n+\sigma_Y^2/m}\).

Theorem 9.5.2. By Filling the gap 9.8, \(Q=\dfrac{S_Y^2/\sigma_Y^2}{S_X^2/\sigma_X^2}=\dfrac{S_Y^2}{S_X^2}\cdot\dfrac{\sigma_X^2}{\sigma_Y^2}\sim F_{m-1,n-1}\) whatever the parameters are, so \(\P(F_{\alpha/2,m-1,n-1}\le Q\le F_{1-\alpha/2,m-1,n-1})=1-\alpha\). The parameter appears as \(\dfrac{\sigma_X^2}{\sigma_Y^2}=Q\cdot\dfrac{S_X^2}{S_Y^2}\), so multiplying by the positive number \(S_X^2/S_Y^2\) (which keeps the order) gives \[ \P\Big(\tfrac{S_X^2}{S_Y^2}F_{\alpha/2,m-1,n-1}\le\tfrac{\sigma_X^2}{\sigma_Y^2}\le\tfrac{S_X^2}{S_Y^2}F_{1-\alpha/2,m-1,n-1}\Big)=1-\alpha.\] Note that \(Y\) (with \(m-1\) degrees of freedom) is the numerator of \(Q\) even though \(X\) is the numerator of the interval: that is why the degrees of freedom appear as \(m-1,n-1\) in both theorems. Taking square roots (a monotone map) gives an interval for \(\sigma_X/\sigma_Y\).

Duality. The pooled interval excludes 0 exactly when \(|\bar x-\bar y|>t_{\alpha/2}s_p\sqrt{1/n+1/m}\), that is when \(|t|>t_{\alpha/2,n+m-2}\): exactly when the two-sided test of Theorem 9.2.2 rejects at level \(\alpha\). Likewise the interval of Theorem 9.5.2 contains 1 exactly when \(s_Y^2/s_X^2\) lies between the two cut-offs \(F_{\alpha/2,m-1,n-1}\) and \(F_{1-\alpha/2,m-1,n-1}\), that is, exactly when the \(F\) test of Theorem 9.3.1(c) does not reject. (Rearrange: \(1\ge\frac{s_X^2}{s_Y^2}F_{\alpha/2}\) iff \(\frac{s_Y^2}{s_X^2}\ge F_{\alpha/2}\), and \(1\le\frac{s_X^2}{s_Y^2}F_{1-\alpha/2}\) iff \(\frac{s_Y^2}{s_X^2}\le F_{1-\alpha/2}\).) This is the correspondence of Filling the gap 6.3; it is how the book reads Case Studies 9.5.1 and 9.5.2. Exact coverage is easy to check by simulation: the pooled interval and the variance-ratio interval each cover with frequency 0.95. ∎

▶ DemoTests and intervalsFirst-year demo: moving the hypothesised value across a confidence interval flips the test between "reject" and "do not reject" at exactly the interval's end points.

Case Study 9.5.1: telling male teeth from female teeth pp. 473–475

Forensic scientists identify the sex of decomposed bodies partly from how much X-rays penetrate tooth enamel. Table 9.5.1 gives the penetration gradients of eight male and eight female teeth. With \(\bar x=5.425\), \(\bar y=4.513\), \(s_X^2=0.554\), \(s_Y^2=0.578\) the pooled standard deviation is \(s_p=0.752\) (the book's \(0.75\)) and, with \(t_{.025,14}=2.1448\), the 95% interval for \(\mu_X-\mu_Y\) is \[ 0.9125\pm2.1448\cdot0.752\sqrt{\tfrac18+\tfrac18}=0.9125\pm0.807=(0.11,\ 1.72)\] (the book prints \((0.1,1.7)\)). It does not contain 0, so \(H_0\colon\mu_X=\mu_Y\) is rejected at 5% (\(t=2.43\), \(P=0.029\)), and the interval shows how much larger the male gradients are: from about 0.1 to 1.7 units. The book says the standardised difference is "approximated by" a \(t\) curve with 14 degrees of freedom; under the stated normality and equal-variance assumptions it is exactly \(t_{14}\).

Case Study 9.5.2: how far apart should glacier photographs be? pp. 475–476

Flow rates of the Hoseason Glacier have been computed from photographs taken three years apart (\(n=7\) values) and five years apart (\(m=5\) values, Table 9.5.2). The true flow rate is assumed constant, so the two time spans differ only in the variability of the estimates. The sample variances are \(s_X^2=0.000224\) and \(s_Y^2=0.000120\), so \(s_X^2/s_Y^2=1.865\). With 4 and 6 degrees of freedom, \(F_{.025,4,6}=0.1087\) and \(F_{.975,4,6}=6.227\) (the book's \(0.109\) and \(6.23\)), and the 95% interval for \(\sigma_X^2/\sigma_Y^2\) is \[ (1.865\cdot0.1087,\ 1.865\cdot6.227)=(0.203,\ 11.61)\] (the book's \(11.629\) multiplies by the rounded \(6.23\)). It contains 1, so the data do not show that the two spans give estimates of different precision, but the interval is extremely wide: samples of 7 and 5 cannot rule out a tenfold difference in variance either way. A confidence interval makes this plain where "fail to reject" would not.

Filling the gap 9.14: the interval for \(p_X-p_Y\) (Question 9.5.11) and how well it covers p. 476, Question 9.5.11

The book leaves the proof of Theorem 9.5.3 to Question 9.5.11: the studentised difference of proportions is approximately standard normal. The central limit theorem plus a Slutsky step prove it (first-year version: Theorem 3.9). The more useful question for practice is how large \(n\) and \(m\) must be.

Hint 1 of 5: the key idea

Two independent proportions: central limit theorem for each, then combine, then replace the unknown \(p\)'s in the standard error by their estimates. Which theorem justifies the last step?

Hint 2 of 5: tools you will need
  • The CLT for \(\hat p_X\) and \(\hat p_Y\) and independence.
  • Consistency of \(\hat p\) and continuity of \(x\mapsto x(1-x)\); Slutsky.
  • First-year Theorem 3.9; gap 9.13.
Hint 3 of 5: step 1

Standardise \(\hat p_X-\hat p_Y\) with its true standard deviation. Aim for: a \(\N(0,1)\) limit.

Hint 4 of 5: step 2

Show the estimated and true standard errors have ratio \(\to1\), so the studentised statistic is also \(\N(0,1)\) in the limit; invert it into Theorem 9.5.3. Why must \(0<p_X,p_Y<1\)?

Hint 5 of 5: step 3

For coverage, sum the binomial probabilities of all \((x,y)\) whose interval contains \(p_X-p_Y\). What does adding one success and one failure per sample do near \(p=0\)?

Proof and coverage

The pivot. Write \(\hat p_X=X/n\), \(\hat p_Y=Y/m\), \(\sigma_n^2=\frac{p_X(1-p_X)}n+\frac{p_Y(1-p_Y)}m\). By independence \(\mathrm{Var}(\hat p_X-\hat p_Y)=\sigma_n^2\), and the central limit theorem applied to each sample, then to the difference of two independent asymptotically normal variables, gives \(\dfrac{\hat p_X-\hat p_Y-(p_X-p_Y)}{\sigma_n}\to\N(0,1)\). If \(0<p_X,p_Y<1\) then \(\hat p_X\to p_X\), \(\hat p_Y\to p_Y\) in probability, and by continuity \(\hat\sigma_n/\sigma_n\to1\), where \(\hat\sigma_n\) is the denominator in Theorem 9.5.3. Slutsky's theorem gives the statement of Question 9.5.11: \(\dfrac{\hat p_X-\hat p_Y-(p_X-p_Y)}{\hat\sigma_n}\to\N(0,1)\). Isolating \(p_X-p_Y\) in \(\P(-z_{\alpha/2}\le\cdot\le z_{\alpha/2})\approx1-\alpha\) as in Filling the gap 9.13 gives Theorem 9.5.3. ∎

Coverage. The statement is about \(n,m\to\infty\) and the proportions \(p_X,p_Y\) fixed in \((0,1)\); for finite samples the actual coverage differs from 95%. Computing it exactly by summing binomial probabilities over all \((x,y)\), Figure x9.3 shows, for \(p_X=p_Y=p\) and \(n=m=20\), coverage that dips to 0.92 near \(p=0.5\) (0.919), is 0.96 at \(p=0.1\) and rises towards 1 at the ends, and for \(n=m=100\) a ripple between 0.944 and 0.949 in the middle. Near \(p=0\) or \(1\) the curve rises towards 1 only because the all-failures sample gives a degenerate interval \(\{0\}\), which covers the true difference 0 by luck; for \(p_X\ne p_Y\) it is the Wald interval's weakness near 0 and 1 that matters. The repair of Agresti and Caffo (2000), "add one success and one failure to each sample, then use the same formula" (\(\tilde p_X=\frac{x+1}{n+2}\), \(\tilde p_Y=\frac{y+1}{m+2}\), standard errors computed with \(n+2\) and \(m+2\)), gives coverage between 0.948 and 0.957 for \(0.3\le p\le0.7\) even with 20 per group (0.988 at \(p=0.1\), conservative), and is as easy to compute. For Question 9.5.12 (9 complications in 77 patients against 6 in 73) the Theorem 9.5.3 interval is \((-0.061,\ 0.130)\) and the Agresti–Caffo interval \((-0.065,\ 0.132)\): practically identical, because \(n\) is not tiny and \(p\) is not near 0.

Two panels of exact coverage of the nominal 95 percent interval for a difference of proportions against the common success probability from 0 to 1. Left, 20 per group: the standard interval dips to about 0.92 near the middle and rises to 1 at the ends, while the Agresti-Caffo interval stays between 0.95 and 0.99. Right, 100 per group: both curves lie close to 0.95.
Figure x9.3. The exact coverage of the nominal 95% interval of Theorem 9.5.3 (red) and of the Agresti–Caffo repair (blue) when \(p_X=p_Y=p\), for 20 and for 100 observations per group, computed by summing the binomial probabilities of every pair \((x,y)\). Own figure. Code: ch09_two_sample_inference.py, fig_x9_3.
▶ DemoCounting successesFirst-year demo: the exact coverage of the Wald interval for one proportion with 20 observations swings widely with \(p\) (preset 4) and settles with 100 (preset 5); the same behaviour is behind Figure x9.3.

Case Study 9.5.3: is cardiac arrest at night more deadly? p. 477

Over seven years in more than five hundred hospitals, 11 604 of 58 593 patients who suffered cardiac arrest in the day and early evening survived to leave hospital (\(0.198\)), against 4139 of 28 155 after 11 p.m. (\(0.147\)). The 95% interval for \(p_X-p_Y\) is \[ 0.0510\pm1.96\sqrt{\tfrac{0.198\cdot0.802}{58593}+\tfrac{0.147\cdot0.853}{28155}}=(0.0458,\ 0.0563)\] (the book's upper limit \(0.0562\) rounds the difference to 0.051). The interval lies entirely above 0: survival is lower at night, by roughly 4.6 to 5.6 percentage points. With samples this large the width of the interval is tiny and only observational confounding (sicker patients at night?) can doubt the conclusion; a test would have said "significant" and left the size of the effect unstated.

9.6 Taking a Second Look at Statistics (Choosing Samples)

pp. 478–480 The section is not about a formula but about two decisions made before any data exist. The first is how many observations: more observations make estimators more precise and tests better at telling \(H_0\) from \(H_1\), but cost more. The second, which the book argues is usually more important, is which subjects get which treatment. If the two groups differ in some hidden way that relates to the measurement, no statistic computed afterwards can undo it.

The book's example: twenty female rats are to be split into ten that will receive injections of a synthetic testosterone and ten that serve as controls, and the response is aggression. If the experimenter reaches into the cage and pulls out ten rats, she will tend (understandably) to avoid the ones that look as if they might bite, so the treated group starts out calmer. The cure is to number the rats 1 to 20 and let a random number generator choose ten; the book shows Minitab choosing rats 1, 5, 8, 9, 10, 14, 15, 18, 19, 20. (Figure 9.6.1 is a printout of that command and is not reproduced; our code draws a split with a seeded generator, random_split(20, 10, seed), for instance rats 1, 3, 5, 6, 7, 10, 14, 17, 18, 20.) The moral the book draws is that the simplest and most basic steps of an experiment, such as assigning subjects to treatments, deserve the most careful scrutiny.

▶ DemoRandom assignment versus reaching in and grabbingTwenty rats with fixed aggression scores: a random split gives a difference of means centred at the true effect with standard deviation 4.24, and the \(t\) test rejects a true null 5% of the time (preset 1); avoiding the aggressive rats shifts the difference and the test rejects about 28% of the time with no effect at all (preset 3).

Filling the gap 9.15: why random assignment works, with the exact mean and variance of the difference pp. 478–480

The book says random assignment avoids bias without showing why or what the resulting difference of means looks like. Here it is, exactly: treat the \(N=n+m\) responses \(u_1,\dots,u_N\) as fixed numbers (what each unit would show), and let the \(n\) units that get treatment \(X\) be chosen so that all \(\binom Nn\) subsets are equally likely.

Claim. Let \(\bar X\) be the mean of the chosen \(n\) and \(\bar Y\) the mean of the other \(m\), and \(S^2=\frac1{N-1}\sum(u_i-\bar u)^2\). Then \(\E(\bar X-\bar Y)=0\) and \(\mathrm{Var}(\bar X-\bar Y)=S^2\big(\frac1n+\frac1m\big)\). If the treatment adds a constant \(\delta\) to each treated unit, \(\E(\bar X-\bar Y)=\delta\) with the same variance.

Hint 1 of 6: the key idea

Write the group mean through indicator variables \(I_i\) of being chosen. All the randomness is in the \(I_i\), and by symmetry they have simple means, variances and covariances.

Hint 2 of 6: tools you will need
  • \(\E I_i=n/N\), \(\mathrm{Var}\,I_i=\frac nN(1-\frac nN)\), \(\mathrm{Cov}(I_i,I_j)=-\mathrm{Var}\,I_i/(N-1)\).
  • \(\sum(u_i-\bar u)=0\), so \(\sum_{i\ne j}d_id_j=-\sum d_i^2\).
  • The permutation test (gap 10.11).
Hint 3 of 6: step 1

Show \(\E\bar X=\bar u\) and \(\E\bar Y=\bar u\). Aim for: no bias, because every unit has the same chance of being a treated unit.

Hint 4 of 6: step 2

Compute \(\mathrm{Var}\,\bar X\) from the covariances. Aim for: \(\frac1n(1-\frac nN)S^2\).

Hint 5 of 6: step 3

Use \(n\bar X+m\bar Y=N\bar u\) to write \(\bar X-\bar Y\) as a multiple of \(\bar X-\bar u\). Aim for: variance \(S^2(\frac1n+\frac1m)\).

Hint 6 of 6: step 4

If the chance of selection depends on \(u_i\), which step breaks, and does a larger sample repair it?

Proof

Let \(I_i=1\) if unit \(i\) is chosen. Then \(\E I_i=\frac nN\), \(\mathrm{Var}\,I_i=\frac nN(1-\frac nN)=:v\), and for \(i\ne j\), \(\E(I_iI_j)=\frac{n(n-1)}{N(N-1)}\), so \(\mathrm{Cov}(I_i,I_j)=\frac{n(n-1)}{N(N-1)}-\frac{n^2}{N^2}=-\frac v{N-1}\). Put \(d_i=u_i-\bar u\), so \(\sum d_i=0\). Since \(\bar X=\frac1n\sum I_iu_i\) and \(\sum I_i=n\), \(\bar X-\bar u=\frac1n\sum I_id_i\). Hence \(\E\bar X=\bar u+\frac1n\sum\frac nNd_i=\bar u\), and the same for \(\bar Y\): no bias, because every unit has the same chance \(n/N\) of being in treatment group.

For the variance, \[ \mathrm{Var}\,\bar X=\frac1{n^2}\Big[v\sum d_i^2-\frac v{N-1}\sum_{i\ne j}d_id_j\Big],\qquad \sum_{i\ne j}d_id_j=\Big(\sum d_i\Big)^2-\sum d_i^2=-\sum d_i^2,\] so \(\mathrm{Var}\,\bar X=\frac v{n^2}\sum d_i^2\big(1+\frac1{N-1}\big)=\frac v{n^2}\cdot\frac N{N-1}\sum d_i^2=\frac{v\,N}{n^2}S^2=\frac1n\big(1-\frac nN\big)S^2\): the variance of a sample mean with the finite-population correction. Finally \(n\bar X+m\bar Y=N\bar u\) gives \(\bar Y-\bar u=-\frac nm(\bar X-\bar u)\), hence \(\bar X-\bar Y=\frac Nm(\bar X-\bar u)\) and \[ \mathrm{Var}(\bar X-\bar Y)=\frac{N^2}{m^2}\cdot\frac1n\cdot\frac mNS^2=\frac{N}{nm}S^2=S^2\Big(\frac1n+\frac1m\Big).\] With a constant effect \(\delta\) the treated responses are \(u_i+\delta\), which adds \(\delta\) to \(\bar X\) and nothing to the variance. ∎

What it means. The variance has exactly the form of the pooled-\(t\) denominator, \(\sigma^2(\frac1n+\frac1m)\), with the finite-population variance \(S^2\) in place of \(\sigma^2\): random assignment, not a normal model, is what justifies comparing \(\bar X-\bar Y\) with a \(t\) distribution, and the permutation test uses exactly this population of equally likely splits (Filling the gap 10.11; demo). For the twenty rats there are \(\binom{20}{10}=184{,}756\) splits, and for scores with standard deviation 9.48 the difference of means has standard deviation \(9.48\sqrt{0.2}=4.24\).

What goes wrong with a non-random rule. If the chance of being chosen depends on \(u_i\) (calm rats favoured), \(\E I_i\) is no longer constant and \(\E\bar X\ne\bar u\): the difference of means is biased by an amount no sample size can reduce, because the selection is repeated at every sample size. In the demonstration, favouring calm rats with weight \(e^{-0.5z}\) (\(z\) the standardised score) shifts the mean difference to \(-5.8\) points when there is no effect at all, and the pooled \(t\) test then rejects 28% of the time instead of 5%.

Filling the gap 9.16: the power of the two-sample \(t\) test and the sample size for a given power pp. 478–479

The section says that larger samples make tests better at distinguishing \(H_0\) from \(H_1\), and stops there. Here are the formulas (for the power function in general see Filling the gap 6.7; the first-year version for the one-sample \(z\) test is Theorem 5.2).

Hint 1 of 5: the key idea

Under a true difference the pooled \(t\) numerator is still normal but no longer centred at 0, while the denominator is unchanged. What law is a shifted normal over an independent \(\sqrt{\chi^2/\nu}\)?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Add the shift: \(T=(Z+\gamma)/\sqrt{V/\nu}\). Aim for: \(\gamma=\delta/\sqrt{1/n+1/m}\), a non-central \(t\).

Hint 4 of 5: step 2

Replace the denominator by 1 for large \(\nu\). Aim for: power \(\approx\Phi(\gamma-z_{\alpha/2})\).

Hint 5 of 5: step 3

With \(n=m\), set \(\gamma=z_{\alpha/2}+z_\beta\) and solve. Aim for: \(n=2(z_{\alpha/2}+z_\beta)^2/\delta^2\); evaluate for \(\delta=0.5\), power 0.90.

Derivation and numbers

Suppose the true means differ, \(\mu_X-\mu_Y=\Delta\), with a common \(\sigma\), and let \(\delta=\Delta/\sigma\). The pooled ratio is \(T=\dfrac{\bar X-\bar Y}{S_p\sqrt{1/n+1/m}}\). Divide numerator and denominator by \(\sigma\sqrt{1/n+1/m}\): \(T=\dfrac{Z+\gamma}{\sqrt{V/(n+m-2)}}\), where \(Z=\dfrac{\bar X-\bar Y-\Delta}{\sigma\sqrt{1/n+1/m}}\sim\N(0,1)\), \(V=(n+m-2)S_p^2/\sigma^2\sim\chi^2_{n+m-2}\) is independent of \(Z\) (Filling the gap 9.1), and \(\gamma=\dfrac{\delta}{\sqrt{1/n+1/m}}\). By definition this is a non-central \(t\) variable with \(n+m-2\) degrees of freedom and non-centrality \(\gamma\). So the two-sided power is \[ \pi(\delta)=\P\big(|T'|\ge t_{\alpha/2,n+m-2}\big),\qquad T'\sim t_{n+m-2}(\gamma),\] and \(\pi(0)=\alpha\). For moderate degrees of freedom the denominator is nearly 1, so \(T'\approx\N(\gamma,1)\) and \[ \pi(\delta)\approx\Phi(\gamma-z_{\alpha/2})+\Phi(-\gamma-z_{\alpha/2})\approx\Phi(\gamma-z_{\alpha/2}).\] The power depends on the data only through \(\gamma\): it increases with the standardised effect \(|\delta|\) and with the sample sizes, and \(\gamma\) is the quantity the book's phrase "estimators more precise" refers to.

Sample size. With \(n=m\) we have \(\gamma=\delta\sqrt{n/2}\). Requiring power \(1-\beta\) in the normal approximation gives \(\gamma=z_{\alpha/2}+z_\beta\) and \[ n=\frac{2\,(z_{\alpha/2}+z_\beta)^2}{\delta^2}\quad\text{per group}.\] The exact (non-central \(t\)) answer is slightly larger because \(t\) quantiles exceed normal ones. For \(\delta=0.5\) (half a standard deviation), \(\alpha=0.05\): power 0.90 needs \(2(1.960+1.282)^2/0.25=84.1\), so 85 by the approximation and 86 exactly (power 0.9032 at 86, 0.8999 at 85); power 0.80 needs 62.8, so 63 by the approximation and 64 exactly (power 0.7952 at 63, 0.8015 at 64). For a smaller effect the requirement grows like \(1/\delta^2\): halving \(\delta\) quadruples \(n\). Planning \(n\) before the study, from the smallest difference that would matter, is the discipline the section recommends. ∎

The Python code computes these exactly (power_pooled_t, n_per_group); the first-year power demo shows the one-sample version.

Filling the gap 9.17: how to split a fixed number of subjects between the two groups pp. 478–479

If a fixed total \(N=n+m\) of subjects is available, should the groups be of equal size? Only if the spreads are equal. The standard error of \(\bar X-\bar Y\) is \(\sqrt{\sigma_X^2/n+\sigma_Y^2/m}\); the aim is to minimise its square.

Hint 1 of 5: the key idea

The variance \(\sigma_X^2/n+\sigma_Y^2/m\) is a weighted sum of reciprocals with \(n+m\) fixed. A lower bound of the form \((\sum\text{something})^2/N\) suggests Cauchy–Schwarz.

Hint 2 of 5: tools you will need
  • Cauchy–Schwarz: \((\sum a_i^2)(\sum b_i^2)\ge(\sum a_ib_i)^2\), with equality iff proportional.
  • \(\mathrm{Var}(\bar X-\bar Y)=\sigma_X^2/n+\sigma_Y^2/m\).
  • Equal sizes make pooled and Welch agree (Proposition 8.1).
Hint 3 of 5: step 1

Multiply the variance by \(n+m\) and apply Cauchy–Schwarz with \(a=(\sigma_X/\sqrt n,\sigma_Y/\sqrt m)\) and \(b=(\sqrt n,\sqrt m)\). Aim for: a bound \((\sigma_X+\sigma_Y)^2/N\).

Hint 4 of 5: step 2

Find when equality holds. Aim for: \(n/m=\sigma_X/\sigma_Y\); what does this give when \(\sigma_X=\sigma_Y\)?

Hint 5 of 5: step 3

Apply it to \(N=100\), \(\sigma_X=4\), \(\sigma_Y=10\) and compare with \(n=m=50\).

Proof

By the Cauchy–Schwarz inequality, \(\Big(\dfrac{\sigma_X^2}n+\dfrac{\sigma_Y^2}m\Big)(n+m)\ \ge\ (\sigma_X+\sigma_Y)^2\), because \(\sigma_X+\sigma_Y=\dfrac{\sigma_X}{\sqrt n}\sqrt n+\dfrac{\sigma_Y}{\sqrt m}\sqrt m\). So \(\mathrm{Var}(\bar X-\bar Y)\ge(\sigma_X+\sigma_Y)^2/N\), with equality exactly when \(\dfrac{\sigma_X/\sqrt n}{\sqrt n}=\dfrac{\sigma_Y/\sqrt m}{\sqrt m}\), that is when \(n/m=\sigma_X/\sigma_Y\): \[ n=N\frac{\sigma_X}{\sigma_X+\sigma_Y},\qquad m=N\frac{\sigma_Y}{\sigma_X+\sigma_Y}.\] (Neyman allocation: sample more from the more variable group.) If \(\sigma_X=\sigma_Y\) this is \(n=m=N/2\), with variance \(4\sigma^2/N\). Example: \(N=100\), \(\sigma_X=4\), \(\sigma_Y=10\). The best split is \(n=28.6\), \(m=71.4\) (say 29 and 71), with variance \(196/100=1.96\); equal groups give \(16/50+100/50=2.32\), 18% larger. ∎

The calculation assumes the \(\sigma\)'s are known roughly in advance (a pilot study, or earlier work). With unequal \(n,m\) and \(\sigma_X\ne\sigma_Y\) use Welch's test rather than the pooled one (Filling the gap 9.4), because optimal allocation is precisely the situation in which the pooled test misbehaves.

Notes on the book

Rounded intermediate values in the case studies pp. 454–477

The book rounds sums of squares, variances and proportions before computing test statistics. Recomputing each from the printed data (or the printed summaries) gives slightly different values; none changes a conclusion.

Quantitybookunrounded
CS 9.2.1: \(s_X^2,\ s_Y^2\)0.0002103, 0.00009550.0002121, 0.0000933
CS 9.2.1: \(t\) (16 df)3.883.878
CS 9.2.2: \(t\) (enthusiasm, knowledge)−25.42, −5.33−25.39, −5.32
CS 9.2.3: \(s_X^2,\ s_Y^2,\ w\)115.9929, 35.7604, −0.928116.083, 35.720, −0.937
CS 9.3.1: \(F\)1.711.696
CS 9.4.1: \(z\)2.922.915
CS 9.5.1: interval(0.1, 1.7)(0.106, 1.719)
CS 9.5.2: interval for \(\sigma_X^2/\sigma_Y^2\)(0.203, 11.629)(0.203, 11.614)
CS 9.5.3: upper limit0.05620.0563

Answer to Question 9.2.17: 13 degrees of freedom should be 14 p. 715

The printed answer uses \(t_{.05,13}=1.7709\). For the titer data (\(s_X=428\), \(s_Y=183\), \(n=m=11\)) the formula of Theorem 9.2.3 gives \(\hat\theta=5.47\) and \(\nu=13.54\), which rounds to 14, not 13 (\(t_{.05,14}=1.7613\); with \(\nu=13.56\) unrounded, \(1.7654\)). The statistic \(w=2.165\) exceeds all of them, so the decision (reject) is unchanged. See Question 9.2.17.

Answers to Questions 9.4.5, 9.5.3 and 9.3.3 p. 715

9.4.5: the printed \(z=4.25\) uses the rounded proportions 0.617 and 0.521; the exact counts give \(z=4.22\). 9.5.3: the printed intervals \((-13.32,\ 6.72)\) and \((-13.61,\ 7.01)\) use the rounded means 18.6 and 21.9; from the table of Case Study 9.2.3 they are \((-13.36,\ 6.69)\) and \((-13.64,\ 6.97)\) (with \(\nu=17\); \((-13.63,\ 6.96)\) with \(\nu=17.18\) unrounded). 9.3.3(a): the book approximates the cut-offs for 19 and 19 degrees of freedom by those for 20 and 20 (0.406 and 2.46); the exact ones are \(0.396\) and \(2.527\). None changes a decision.

"Slightly different areas" in the comment after Theorem 9.3.1, and the advice to test variances first p. 464

For equal sample sizes the equal-tailed \(F\) test is the likelihood ratio test; for unequal sizes the likelihood ratio cut-offs differ, but only a little, so the book's comment is accurate (for \(n=8\), \(m=12\) the tail areas are 0.018 and 0.032 instead of 0.025 and 0.025, and both tests have power within 0.001 of \(\alpha\) at their worst; Filling the gap 9.9). The advice to run a test of equal variances before every test of \(\mu_X=\mu_Y\) is no longer recommended; use Welch's test directly (Filling the gap 9.10).

Selected questions

Eight of the book's questions, restated in my own words, and one problem of my own for Section 9.6 (the book has no questions there), covering every section of the chapter, with complete solutions (hidden). Numbers were cross-checked with the book's answers to the odd-numbered questions, which they match except where noted in Notes on the book.

  1. Question 9.2.2 (the Atkins and Zone diets). In a study of one-year weight loss, 77 subjects on the Atkins diet had a mean change of \(\bar x=-4.7\) kg (sample standard deviation \(s_X=7.05\)) and 79 subjects on the Zone diet \(\bar y=-1.6\) kg (\(s_Y=5.36\)). Is the greater reduction under Atkins statistically significant at \(\alpha=0.05\)? (Data: Question 9.2.2 of Larsen and Marx 2018.)

    Hint 1 of 5: the key idea

    More weight lost is a more negative change, so decide the direction of \(H_1\) first. Then ask whether the two spreads are close enough to pool, and check the answer with both tests.

    Hint 2 of 5: tools you will need
    Hint 3 of 5: part (a)

    Set up \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X<\mu_Y\) and compute \(s_p\). Aim for: \(s_p\approx6.25\).

    Hint 4 of 5: part (b)

    Compute the pooled \(t\) on 154 degrees of freedom and compare with \(-t_{.05}\). Aim for: \(t\approx-3.10\).

    Hint 5 of 5: part (c)

    Repeat with Welch's statistic and its degrees of freedom. Aim for: \(w\approx-3.09\) on about 142 df, the same decision. What remains to say about the size of the effect?

    Solution

    A greater reduction means a more negative change, so test \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X<\mu_Y\); reject if the statistic is at most minus the critical value. The standard deviations differ (variance ratio \(s_Y^2/s_X^2=0.578\); the \(F\) test with 78 and 76 degrees of freedom has cut-offs 0.638 and 1.569 and rejects equality, \(P=0.017\)), so the pooled assumption is doubtful and Welch's test is the right one; with sizes 77 and 79 the two will agree closely, and we compute both.

    Pooled. \(s_p=\sqrt{(76\cdot7.05^2+78\cdot5.36^2)/154}=6.25\) and \[ t=\frac{-4.7-(-1.6)}{6.25\sqrt{\frac1{77}+\frac1{79}}}=\frac{-3.1}{1.0011}=-3.10\] on \(154\) degrees of freedom; the critical value is \(-t_{.05,154}=-1.655\), so \(H_0\) is rejected (\(P=0.0012\)).

    Welch. \(w=\dfrac{-3.1}{\sqrt{7.05^2/77+5.36^2/79}}=\dfrac{-3.1}{1.0045}=-3.09\), with \(\nu=141.9\) degrees of freedom and one-sided \(P=0.0012\). Same conclusion.

    Conclusion. The Atkins subjects lost on average 3.1 kg more than the Zone subjects, and this is far too large to be chance (\(P\approx0.001\)). A statistically significant difference of 3.1 kg is not necessarily a large one for health; and the standard deviations, 5 to 7 kg, are larger than the effect: many individuals on either diet do better than the average person on the other (see Section 6.6).

  2. Question 9.2.16 (the likelihood ratio test for two means with a known variance). Let \(X_1,\dots,X_n\) and \(Y_1,\dots,Y_m\) be independent normal samples with means \(\mu_X,\mu_Y\) and the same known variance \(\sigma^2\). Use the generalized likelihood ratio criterion to derive a test of \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X\ne\mu_Y\).

    Hint 1 of 5: the key idea

    With \(\sigma^2\) known, the likelihood depends only on the sum of squares. What is the difference of the two sums of squares at the restricted and unrestricted maxima?

    Hint 2 of 5: tools you will need
    • The identity \(SS(w,w)=A+B+\frac{nm}{n+m}(\bar x-\bar y)^2\) (gap 9.2).
    • The normal likelihood and the \(\N(0,1)\) ratio (gap 9.7).
    • The likelihood ratio (Definition 6.5.1).
    Hint 3 of 5: step 1

    Write the likelihood with known \(\sigma^2\) and find its maxima over \(\Omega\) and \(\omega\).

    Hint 4 of 5: step 2

    Divide. Aim for: \(\lambda=\exp\{-\frac1{2\sigma^2}\frac{nm}{n+m}(\bar x-\bar y)^2\}\).

    Hint 5 of 5: step 3

    Show \(\lambda\le\lambda^*\) means \(|z|\ge c\) and fix \(c\) from the size. Note \(-2\ln\lambda=z^2\): what law is that, and is it exact?

    Solution

    With \(\sigma^2\) known the only parameters are the means. Put \(N=n+m\), \(SS(\mu_X,\mu_Y)=\sum(x_i-\mu_X)^2+\sum(y_j-\mu_Y)^2\) and \(L=(2\pi\sigma^2)^{-N/2}\exp\{-SS/(2\sigma^2)\}\). Over \(\Omega\) the likelihood is largest at \((\bar x,\bar y)\); over \(\omega\) (\(\mu_X=\mu_Y\)) at the grand mean \(w=\frac{n\bar x+m\bar y}N\). The identity of Filling the gap 9.2 gives \(SS(w,w)-SS(\bar x,\bar y)=\frac{nm}N(\bar x-\bar y)^2\), so \[ \lambda=\frac{L(w,w)}{L(\bar x,\bar y)}=\exp\Big\{-\frac{1}{2\sigma^2}\cdot\frac{nm}{n+m}(\bar x-\bar y)^2\Big\}=\exp\Big\{-\frac{z^2}2\Big\},\qquad z=\frac{\bar x-\bar y}{\sigma\sqrt{1/n+1/m}}.\] \(\lambda\) is a decreasing function of \(z^2\), so \(\lambda\le\lambda^*\) is the event \(|z|\ge c\). Under \(H_0\), \(Z\sim\N(0,1)\) exactly (equation 9.2.1, Filling the gap 9.7), so \(c=z_{\alpha/2}\):

    reject \(H_0\) if \(|\bar x-\bar y|\ge z_{\alpha/2}\,\sigma\sqrt{1/n+1/m}\).

    Notice that \(-2\ln\lambda=z^2\) is exactly \(\chi^2_1\) under \(H_0\), with no approximation: when \(\sigma\) is known Wilks' theorem is an identity. Replacing \(\sigma\) by an estimate costs the normal law and gives the \(t\) law of Theorem 9.2.2, which is why \(\lambda^{2/N}\) there is \(\frac{N-2}{N-2+t^2}\) instead of \(e^{-z^2/N}\).

  3. Question 9.2.17 (antibody titers in a tularemia outbreak). Antibody titers of eleven severely ill and eleven asymptomatic patients were: severely ill 640, 80, 1280, 160, 640, 640, 1280, 640, 160, 320, 160; asymptomatic 10, 320, 320, 320, 320, 80, 160, 10, 640, 160, 320. The sample standard deviations are 428 and 183. Use Theorem 9.2.3 to test \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X>\mu_Y\) at \(\alpha=0.05\), where \(X\) is the severely ill group. (Data: Question 9.2.17 of Larsen and Marx 2018.)

    Hint 1 of 5: the key idea

    The two sample variances are very different, so use Theorem 9.2.3. Compute the statistic, then the degrees of freedom from \(\hat\theta=s_X^2/s_Y^2\), then decide.

    Hint 2 of 5: tools you will need
    • Welch's statistic and degrees of freedom (Theorem 9.2.3).
    • Rounding and the bounds on \(\nu\) (gap 9.6).
    • A one-sided \(t\) critical value.
    Hint 3 of 5: step 1

    Compute the means and the standard error \(\sqrt{s_X^2/n+s_Y^2/m}\). Aim for: \(w\approx2.16\).

    Hint 4 of 5: step 2

    Compute \(\hat\theta\) and \(\nu\) from the book's formula. Aim for: \(\nu\approx13.5\); what does the book's rounding rule give?

    Hint 5 of 5: step 3

    Compare \(w\) with \(t_{.05,\nu}\) for the one-sided alternative. Because \(n=m\), what else equals \(w\)? Would a log transformation help?

    Solution

    The means are \(\bar x=545.5\) and \(\bar y=241.8\); the standard deviations are 427.6 and 183.3. The variances are very different (ratio 5.4), so Welch's test is appropriate. With \(n=m=11\), \[ w=\frac{545.5-241.8}{\sqrt{427.6^2/11+183.3^2/11}}=\frac{303.6}{140.3}=2.165.\] The degrees of freedom: \(\hat\theta=s_X^2/s_Y^2=5.47\) and \[ \nu=\frac{(5.47+1)^2}{\frac{5.47^2}{10}+\frac{1}{10}}=\frac{41.86}{3.09}=13.54,\] which rounds to 14 (13.56 with the unrounded standard deviations; the book's answer uses 13, see Notes on the book). Since \(w=2.165>t_{.05,14}=1.7613\) (and also \(>t_{.05,13}=1.7709\)), reject \(H_0\): the severely ill had significantly higher titers (one-sided \(P=0.024\)).

    Two remarks. Because \(n=m\), the pooled statistic equals \(w\) here (Proposition 8.1 of the first-year notes) and only the degrees of freedom differ (20 against 13.54), so the pooled test also rejects; with unequal sizes the choice could matter. The titers are in a doubling series (10, 80, 160, 320, 640, 1280), clearly not normal and right-skewed, so a log transformation would be a more natural analysis (and would make the variances similar); the conclusion is not in doubt but the normal model is only an approximation.

  4. Question 9.3.3 (TAT scores of mothers). Forty women took the thematic apperception test: twenty mothers of normal children and twenty mothers of schizophrenic children. The score is the number of ten pictures for which the story showed a positive parent–child relationship. Normal group: 8, 4, 6, 3, 1, 4, 4, 6, 4, 2, 2, 1, 1, 4, 3, 3, 2, 6, 3, 4. Schizophrenic group: 2, 1, 1, 3, 2, 7, 2, 1, 3, 1, 0, 2, 4, 2, 3, 3, 0, 1, 2, 2. (a) Test \(H_0\colon\sigma_X^2=\sigma_Y^2\) against the two-sided alternative at \(\alpha=0.05\). (b) If the variances are accepted as equal, test \(H_0\colon\mu_X=\mu_Y\) against \(H_1\colon\mu_X\ne\mu_Y\) at \(\alpha=0.05\). (Data: Question 9.3.3 of Larsen and Marx 2018.)

    Hint 1 of 5: the key idea

    Part (a) is an \(F\) test with equal sample sizes, part (b) a pooled \(t\) test that the book makes conditional on (a). Do each carefully and then ask whether (a) was needed.

    Hint 2 of 5: tools you will need
    Hint 3 of 5: part (a)

    Compute the two sample variances and \(F=s_Y^2/s_X^2\) with 19 and 19 degrees of freedom. Aim for: \(F\approx0.68\), cut-offs about 0.40 and 2.53.

    Hint 4 of 5: part (b)

    Compute \(s_p\) and \(t\) on 38 degrees of freedom. Aim for: \(t\approx2.66\).

    Hint 5 of 5: part (c)

    Compare with \(t_{.025,38}\) and report the decision. How much power does the \(F\) test in (a) have against a 1.5-fold standard-deviation ratio with 20 per group?

    Solution

    (a) \(n=m=20\), \(\bar x=3.55\), \(\bar y=2.10\), \(s_X^2=3.524\), \(s_Y^2=2.411\). The ratio is \(F=s_Y^2/s_X^2=0.684\), to be compared with the \(F_{19,19}\) points \(F_{.025,19,19}=0.396\) and \(F_{.975,19,19}=2.527\) (the book uses 20 and 20 degrees of freedom: 0.406 and 2.46). Since \(0.396<0.684<2.527\), do not reject (\(P=0.42\)); the data do not distinguish the variances.

    (b) \(s_p^2=(3.524+2.411)/2=2.968\), \(s_p=1.722\), and \[ t=\frac{3.55-2.10}{1.722\sqrt{\frac1{20}+\frac1{20}}}=\frac{1.45}{0.5447}=2.662\] on 38 degrees of freedom. The critical values are \(\pm t_{.025,38}=\pm2.024\), so \(H_0\) is rejected (\(P=0.011\)): mothers of normal children tell stories with a positive relationship about 1.45 more pictures out of ten on average. Welch's statistic equals \(2.662\) here (equal sizes; 36.7 degrees of freedom) and gives the same conclusion, without having needed part (a).

    Comment. The two-step logic of the book is legitimate when the equal-variance assumption matters and the data are plausibly normal, but part (a) has little power with twenty per group (it detects a doubling of the standard deviation about 84% of the time here, a 1.5-fold increase only about 40%), and these scores are counts between 0 and 10, not normal; Filling the gap 9.10 explains why Welch's test used from the start is the safer plan.

  5. Question 9.4.5 (plea bargains in Escambia County). The mitigation rate (the share of cases settled by a plea bargain) was 61.7% (1033 of 1675 cases) in a first study. After new policies limited plea bargains, a follow-up study found 52.1% (344 of 660 cases). Is it fair to conclude that the drop was caused by the new policies, or can it be written off to chance? Test at \(\alpha=0.01\). (Data: Question 9.4.5 of Larsen and Marx 2018.)

    Hint 1 of 5: the key idea

    Two independent proportions, a direction (a drop), and a pooled estimate under \(H_0\). After the number, ask what the test does and does not tell you about the cause of the drop.

    Hint 2 of 5: tools you will need
    Hint 3 of 5: step 1

    Compute \(p_e\) from the counts and the standard error of the difference. Aim for: \(p_e\approx0.590\) and a standard error of about 0.0226.

    Hint 4 of 5: step 2

    Compute \(z\) and compare with \(z_{.01}\) (one-sided). Aim for: \(z\approx4.22\).

    Hint 5 of 5: step 3

    Give the interval for the size of the drop. Then say why a significant drop between two different years is not proof that the new policy caused it.

    Solution

    Let \(p_X\) and \(p_Y\) be the true mitigation rates before and after, and test \(H_0\colon p_X=p_Y\) against \(H_1\colon p_X>p_Y\) (the policy aimed at a drop). The pooled rate is \(p_e=\frac{1033+344}{1675+660}=0.590\), and by Theorem 9.4.1 \[ z=\frac{0.6167-0.5212}{\sqrt{0.590\cdot0.410\big(\frac1{1675}+\frac1{660}\big)}}=\frac{0.0955}{0.0226}=4.22.\] This exceeds \(z_{.01}=2.326\) by a wide margin (one-sided \(P\approx1\times10^{-5}\)): the drop cannot be written off to chance. (The book's answer \(4.25\) uses the rounded proportions 0.617 and 0.521; see Notes on the book.) A 95% interval for the size of the drop (Theorem 9.5.3) is \(0.0955\pm1.96\cdot0.0228=(0.051,\ 0.140)\): between 5 and 14 percentage points.

    Causation. The test addresses only chance. The two samples are not randomised groups: they are different years, and anything else that changed between them (the mix of offences, prosecution practice) is confounded with the policy. The statistics establish that the rate fell; the argument that the policy caused the fall rests on knowledge outside the data, the point made in the discussion of Section 9.6 about how groups are formed.

  6. Question 9.4.10 (the likelihood ratio statistic for the nightmare data). For the data of Case Study 9.4.2 (55 of 160 men and 60 of 192 women report frequent nightmares) compute \(-2\ln\lambda\) from equation (9.4.1) and use it to test \(H_0\colon p_X=p_Y\) at \(\alpha=0.01\).

    Hint 1 of 5: the key idea

    \(-2\ln\lambda\) is twice a sum over the four cells of \(O\ln(O/E)\). Build the \(2\times2\) table and the expected counts under \(H_0\) first.

    Hint 2 of 5: tools you will need
    • Equation (9.4.1) and its cell form (gap 9.11).
    • The pooled estimate \(p_e=115/352\).
    • The \(\chi^2_1\) quantile for the test.
    Hint 3 of 5: step 1

    Fill in the expected counts \(np_e,n(1-p_e),mp_e,m(1-p_e)\). Aim for: about 52.3, 107.7, 62.7, 129.3.

    Hint 4 of 5: step 2

    Compute \(2\sum O\ln(O/E)\). Aim for: about 0.387.

    Hint 5 of 5: step 3

    Compare with \(\chi^2_{.99,1}=6.635\), and with \(z^2\) from Case Study 9.4.2. Why do they nearly agree?

    Solution

    By Filling the gap 9.11, \(-2\ln\lambda=2\sum O\ln(O/E)\) over the four cells of the \(2\times2\) table. With \(p_e=115/352=0.3267\):

    observed \(O\)expected \(E\)\(O\ln(O/E)\)
    men, often5552.272.7972
    men, seldom105107.73−2.6925
    women, often6062.73−2.6671
    women, seldom132129.272.7558
    The four terms sum to \(0.1935\), so \(-2\ln\lambda=2(0.1935)=0.387\). Under \(H_0\) this is approximately \(\chi^2_1\), whose upper 1% point is \(6.635\); since \(0.387<6.635\) (\(P=0.53\)), do not reject \(H_0\). It agrees with Case Study 9.4.2, where \(z=0.62\), \(z^2=0.3875\) and \(P=0.53\): \(z^2\) equals Pearson's statistic and \(-2\ln\lambda\) is the likelihood-ratio version of the same quantity, and they differ only in the fourth decimal because the counts are large.

  7. Question 9.5.7 (end diastolic volume). End diastolic volumes were recorded for eight persons with normal cardiac function: 62, 60, 78, 62, 49, 67, 80, 48, and six with constrictive pericarditis: 24, 56, 42, 74, 44, 28. Would it be correct to use Theorem 9.2.2 to test \(H_0\colon\mu_X=\mu_Y\)? Answer by constructing a 95% confidence interval for \(\sigma_X^2/\sigma_Y^2\). (Data: Question 9.5.7 of Larsen and Marx 2018.)

    Hint 1 of 5: the key idea

    Build the interval for \(\sigma_X^2/\sigma_Y^2\) and see whether it contains 1. Then ask how informative that is when the samples have 8 and 6 observations.

    Hint 2 of 5: tools you will need
    • Theorem 9.5.2 and the pivot of gap 9.13.
    • \(F_{p,a,b}=1/F_{1-p,b,a}\) (gap 9.8).
    • The pooled and Welch tests, to see whether the choice matters.
    Hint 3 of 5: step 1

    Compute \(s_X^2/s_Y^2\) and the two \(F\) points with \(m-1=5\) and \(n-1=7\) degrees of freedom. Aim for: a ratio near 0.40 and points about 0.146 and 5.29.

    Hint 4 of 5: step 2

    Form the interval and say whether the pooled test is justified. Aim for: about \((0.06,\,2.13)\), which contains 1.

    Hint 5 of 5: step 3

    Compute the pooled \(t\) and Welch's statistic on these data. Do they give the same decision at 5%? What does that say about the width of your interval?

    Solution

    \(n=8\), \(m=6\); \(\bar x=63.25\), \(\bar y=44.67\); \(s_X^2=137.36\), \(s_Y^2=340.27\), so \(s_X^2/s_Y^2=0.4037\). By Theorem 9.5.2 the interval is \(\big(0.4037\,F_{.025,5,7},\ 0.4037\,F_{.975,5,7}\big)\) (degrees of freedom \(m-1=5\) and \(n-1=7\)), with \(F_{.975,5,7}=5.285\) and \(F_{.025,5,7}=1/F_{.975,7,5}=1/6.853=0.146\) (Filling the gap 9.8): \[ (0.4037\cdot0.1459,\ 0.4037\cdot5.285)=(0.059,\ 2.13).\] The interval contains 1, so equal variances are not rejected at 5% and, following the book (answer: \((0.06,\ 2.14)\)), the pooled test is acceptable. But look at how wide the interval is: it allows the variance of the pericarditis group to be about 17 times that of the normal group or half of it. "Not rejected" is a weak reassurance here, and in fact it matters: the pooled test gives \(t=2.31\) on 12 degrees of freedom, \(P=0.039\) (reject at 5%), while Welch's test gives \(w=2.16\) on \(\nu=7.96\) degrees of freedom, \(P=0.063\) (do not reject). With samples this small and a variance ratio of 2.5, the decision changes with the method. The honest reading is that the evidence is borderline, and Welch's test, which does not rely on the doubtful equal-variance assumption, is the more defensible choice (Filling the gap 9.10).

  8. Question 9.5.12 (suturing and wound complications). Obese patients were randomly assigned to a standard suturing technique (control) or a new one. Control: 68 without and 9 with complications; new sutures: 67 without and 6 with. Find a 95% confidence interval for the difference in complication rates. Is there evidence that the new sutures are better? (Data: Question 9.5.12 of Larsen and Marx 2018.)

    Hint 1 of 5: the key idea

    Two small binomial samples with random assignment: use the interval of Theorem 9.5.3, read it against 0, and be honest about how little information a few events carry.

    Hint 2 of 5: tools you will need
    • The interval of Theorem 9.5.3 (Theorem 9.5.3).
    • Its coverage and the Agresti–Caffo repair (gap 9.14).
    • The pooled \(z\) test for comparison.
    Hint 3 of 5: step 1

    Read off \(n,x,m,y\) and the two proportions. Aim for: 9/77 and 6/73.

    Hint 4 of 5: step 2

    Compute the standard error and the 95% interval. Aim for: about \((-0.06,\ 0.13)\).

    Hint 5 of 5: step 3

    Does it contain 0? What range of true effects does it still allow, and what would it take to show the new sutures are better?

    Solution

    Let \(p_X\) be the complication probability in the control group (\(n=77\), \(x=9\), \(\hat p_X=0.1169\)) and \(p_Y\) in the new-suture group (\(m=73\), \(y=6\), \(\hat p_Y=0.0822\)). The difference is \(\hat p_X-\hat p_Y=0.0347\) and \[ \hat\sigma=\sqrt{\frac{0.1169\cdot0.8831}{77}+\frac{0.0822\cdot0.9178}{73}}=\sqrt{0.001341+0.001033}=0.0487,\] so the interval of Theorem 9.5.3 is \(0.0347\pm1.96\cdot0.0487=(-0.061,\ 0.130)\). It contains 0: the data do not show a difference in complication rates (the pooled \(z\) test gives \(z=0.71\), \(P=0.48\)). The interval is wide and reaches from a 6-point worse result for the new sutures to a 13-point improvement: with fewer than ten events per group the study is far too small to say the new technique is no better, only that this study cannot show it is. (The Agresti–Caffo interval, adding one success and one failure per group, is \((-0.065,\ 0.132)\), practically the same; Filling the gap 9.14.) The assignment was random, which is what allows a difference to be attributed to the technique rather than to the kind of patient, as Section 9.6 emphasises.

  9. Problem 9.6.1 (planning a two-group study; my own). Two diets are to be compared by weight loss, which has a standard deviation of about 8 kg in either group. (a) How many subjects per group are needed for a 5% two-sided pooled \(t\) test to have power 0.90 against a true difference of 5 kg? (b) A volunteer pool of 108 people is available. In how many ways can they be split into two groups of 54, and how should the split be made? (c) A pilot suggests instead that the first group's results vary little (\(\sigma_X=4\) kg) and the second's a lot (\(\sigma_Y=10\) kg). With 100 subjects, how should they be allocated, and by what percentage does that reduce the variance of \(\bar X-\bar Y\) below an equal split?

    Hint 1 of 5: the key idea

    Part (a) is a power calculation with a standardised effect; (b) counts splits and asks for a random mechanism; (c) is an optimal-allocation problem. Take them one at a time.

    Hint 2 of 5: tools you will need
    Hint 3 of 5: part (a)

    Compute \(\delta=5/8\) and the normal-approximation \(n\). Aim for: about 54 per group; then say why the exact answer is a little larger.

    Hint 4 of 5: part (b)

    Count the splits with a binomial coefficient and describe a mechanism that makes each equally likely. Aim for: a number of order \(10^{31}\).

    Hint 5 of 5: part (c)

    Allocate in proportion to the standard deviations and compare the variance of \(\bar X-\bar Y\) with the equal split. Aim for: 1.96 against 2.32.

    Solution

    (a) The standardised effect is \(\delta=5/8=0.625\). The normal approximation of Filling the gap 9.16 gives \(n=2(1.960+1.282)^2/0.625^2=53.8\), so 54 per group. The exact non-central \(t\) calculation (\(\gamma=\delta\sqrt{n/2}\), \(2n-2\) degrees of freedom) gives power \(0.896\) at \(n=54\) and \(0.901\) at \(n=55\): 55 per group (110 in all). The normal approximation is slightly optimistic because \(t\) quantiles exceed normal ones.

    (b) \(\binom{108}{54}\approx2.5\times10^{31}\) splits. A fair split is made by giving each person a number, drawing a random permutation (or sample of 54 numbers) with a random number generator and putting those 54 in the first group, so that every split is equally likely (Filling the gap 9.15). Choosing "by hand", or alternating as people arrive, can build in exactly the biases the section warns about. (Since 110 are needed for 90% power, the pool of 108 gives power just under 0.90, namely 0.896.)

    (c) By Filling the gap 9.17 the best allocation is proportional to the standard deviations: \(n=100\cdot\frac4{14}=28.6\), \(m=71.4\) (say 29 and 71). The variance of \(\bar X-\bar Y\) is then \(\frac{16}{28.6}+\frac{100}{71.4}=1.96=(4+10)^2/100\), against \(\frac{16}{50}+\frac{100}{50}=2.32\) for the equal split of 50 and 50. The reduction is \(1-1.96/2.32=15.5\%\) in variance (8.1% in the standard error). With unequal sizes and unequal standard deviations the pooled test would be a poor choice (Filling the gap 9.4); use Welch's.

Demonstrations for this chapter

Each demonstration runs in the browser and links back to these notes. The ▶ Demo boxes above open them already set to the case under discussion.

DemonstrationWhat you can seeSections and results
The F test for equal variancesSeeded studies of two samples with a chosen size, true standard deviation ratio and data shape (normal, uniform, Laplace, heavy-tailed \(t_5\), skewed exponential); the histogram of \(\ln F\) over the studies with the normal-theory \(F\) density on top, the two cut-offs of the 5% test, and the rejection rate against the exact value for normal data. Presets: 1 normal data, equal variances; 2 heavy tails, equal variances; 3 skewed data; 4 uniform data; 5 normal data with the true ratio 2 (power); 6 heavy tails with 20 and 20.Section 9.3; 9.8, 9.9, 9.10; Question 9.3.3
Random assignment versus reaching in and grabbingTwenty rats with fixed aggression scores split into ten and ten, either by a random draw or by a rule that avoids the aggressive ones (four strengths), with no treatment effect or a true effect of 10 points; the last split, the histogram of the difference of means against the exact random-assignment normal curve, and the rejection rate of the pooled \(t\) test. Presets: 1 random, no effect; 2 mild avoidance; 3 strong avoidance; 4 random with a real effect; 5 very strong avoidance hides a real effect.Section 9.6; 9.15, 9.16; Problem 9.6.1

Related first-year and graduate demonstrations: Pooled or Welch, paired or not (Section 9.2; Filling the gap 9.4), Exact and approximate methods for proportions (Sections 9.4 and 9.5; 9.14), Tests and intervals (9.13), Power and sample size (9.16), The normal-sample theorem (9.1) and The permutation test is exact (9.15), and from Chapter 7 How robust is the t test? (9.4) and Inference about a variance (9.10).

References

  1. Agresti, A. and Caffo, B. (2000). Simple and effective confidence intervals for proportions and differences of proportions result from adding two successes and two failures. The American Statistician, 54(4), 280–288.
  2. Behrens, W. U. (1929). Ein Beitrag zur Fehlerberechnung bei wenigen Beobachtungen. Landwirtschaftliche Jahrbucher, 68, 807–837.
  3. Fisher, R. A. (1935). The fiducial argument in statistical inference. Annals of Eugenics, 6, 391–398.
  4. Larsen, R. J. and Marx, M. L. (2018). An Introduction to Mathematical Statistics and Its Applications, 6th edition. Pearson, Boston. Chapter 9, pp. 450–482.
  5. Lehmann, E. L. and Romano, J. P. (2005). Testing Statistical Hypotheses, 3rd edition. Springer, New York.
  6. Satterthwaite, F. E. (1946). An approximate distribution of estimates of variance components. Biometrics Bulletin, 2(6), 110–114.
  7. Student (Gosset, W. S.) (1908). The probable error of a mean. Biometrika, 6(1), 1–25.
  8. Welch, B. L. (1938). The significance of the difference between two means when the population variances are unequal. Biometrika, 29(3/4), 350–362.
  9. Wilks, S. S. (1938). The large-sample distribution of the likelihood ratio for testing composite hypotheses. Annals of Mathematical Statistics, 9(1), 60–62.