Lecture notes · Introduction to Mathematical Statistics · Chapter 7

Chapter 7. Inferences Based on the Normal Distribution: Lecture Notes

Chapters 5 and 6 built intervals and tests for a normal mean on the unrealistic assumption that the standard deviation is known. This chapter removes the assumption. Replacing \(\sigma\) by the sample standard deviation \(S\) changes the law of the standardised mean from the normal to Student's \(t\), and the whole chapter is the derivation of that fact and its consequences: the chi-square law of \((n-1)S^2/\sigma^2\), its independence of \(\bar Y\), the \(F\) and \(t\) densities, the \(t\) interval and \(t\) test for \(\mu\), the chi-square interval and test for \(\sigma^2\), the evidence that the \(t\) test survives non-normal data, and the noncentral \(t\) law that gives its Type II error. The book proves most of this and defers the linear algebra and the likelihood ratio calculations to appendices; these notes put the appendices in their place, add the missing arguments (the exact price of not knowing \(\sigma\), the moments and limit of the \(t\) law, why the equal-tailed chi-square test is not quite the likelihood ratio test, which cut-offs give the shortest interval, what the noncentral \(t\) is) and correct a few 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 (7.1 to 7.6, with the three appendices placed where they are used) and numbered items keep theirs (Definition 7.3.1, Theorem 7.4.2, Example 7.6.1, Case Study 7.5.2). Everything is written in new words; the book is cited for each result, example and figure, and displayed equations that the book numbers keep its number, e.g. \((7.4.1)\).

Filling the gaps. Wherever the book says "it can be shown", leaves an exercise to the reader, defers to an appendix or works an example too fast to follow, 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. Ten figures of the chapter (7.2.1, 7.3.1, 7.3.2, 7.4.2, 7.4.3, 7.4.6, 7.5.1, 7.5.3, 7.A.3.1 and 7.A.3.2) are reproduced and the two excerpts of tables (Figures 7.4.1 and 7.5.2) are recomputed as tables; three own figures (x7.1 to x7.3) show the true level of the \(t\) test for non-normal data, the power of the \(t\) test against that of the \(z\) test and the width of the interval for \(\sigma^2\). The sketches (Figures 7.4.4 and 7.4.5) are not redrawn. All are computed by the Python code. The ▶ Demo boxes open an interactive demonstration already set to the case being discussed.

Main reference

R. J. Larsen and M. L. Marx, An Introduction to Mathematical Statistics and Its Applications, 6th edition, Pearson (2018), Chapter 7, pages 380–420. 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

The normal-sample theory 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 argument and link to it rather than repeating it.

Earlier chapters of this course supply the tools: the gamma and chi-square laws (Filling the gap 4.18), the sum and share of independent gammas (4.20), quotients of random variables (3.17), moment-generating functions (3.25), the bias of \(S\) (5.11), the normal MLEs (Example 5.2.5) and the logic of tests and the GLRT (Definition 6.5.2, 6.14).

New here: the exact price of estimating \(\sigma\) (Filling the gap 7.1), the chi-square law by moment-generating functions (7.2) and its normal approximations (7.3), the normal-sample theorem in full (7.4), the \(F\) density (7.5), the \(t\) density by conditioning and its closed forms for one and two degrees of freedom (7.6), moments and the normal limit of the \(t\) law (7.7), the variance and consistency of \(S\) (7.8), the exact coverage and the shortest form of the \(t\) interval (7.9), the \(t\) test, its \(P\)-value and its duality with the interval (7.10), the \(t\) test as a likelihood ratio test (7.11), why it is robust (7.12), the interval for \(\sigma^2\) and its shortest form (7.13), the width problem of Example 7.5.1 (7.14), the exact likelihood ratio test for \(\sigma^2\) and the unbiased test (7.15), the power of the chi-square test (7.16), the noncentral \(t\) law and sample sizes (7.17) and the noise in the book's simulations (7.18).

The chapter at a glance

  • 7.1–7.2 When \(\sigma\) is unknown, \(Z=(\bar Y-\mu)/(\sigma/\sqrt n)\) cannot be computed. Replacing \(\sigma\) by \(S\) gives a ratio with thicker tails, and with small \(n\) the difference matters: the "95%" interval \(\bar y\pm1.96\,s/\sqrt n\) covers only 86% of the time when \(n=4\) (7.1).
  • 7.3 A sum of \(m\) squared standard normals is chi-square with \(m\) degrees of freedom; for a normal sample \(\bar Y\) and \(S^2\) are independent and \((n-1)S^2/\sigma^2\) is chi-square with \(n-1\) (Theorem 7.3.2, 7.4). Dividing a standard normal by the square root of an independent chi-square over its degrees of freedom gives Student's \(t\) (Definition 7.3.3, Theorem 7.3.4, 7.5, 7.6), and \(T_{n-1}=(\bar Y-\mu)/(S/\sqrt n)\) has that law (Theorem 7.3.5).
  • 7.4 The \(t\) interval is \(\bar y\pm t_{\alpha/2,n-1}s/\sqrt n\) and the \(t\) test rejects when \(t\) is beyond \(\pm t_{\alpha/2,n-1}\) (Theorems 7.4.1, 7.4.2, 7.9 to 7.11). It is a likelihood ratio test (Theorem 7.A.2.1) and survives moderate non-normality, less well for skewed data and small \(n\) (7.12).
  • 7.5 For \(\sigma^2\) the pivot is \((n-1)S^2/\sigma^2\sim\chi^2_{n-1}\); the interval is \(\bigl((n-1)s^2/\chi^2_{1-\alpha/2},(n-1)s^2/\chi^2_{\alpha/2}\bigr)\) and the tests use the same cut-offs (Theorems 7.5.1, 7.5.2, 7.13 to 7.16). The chi-square law is skewed, so equal tails are a convention, not an optimum.
  • 7.6 When \(H_1\) is true the \(t\) ratio has a noncentral \(t\) law, which gives the Type II error exactly; for \(n=20\) and a shift of \(0.5\sigma\) it is \(\beta=0.305\) (Example 7.6.1, 7.17, 7.18).

Notation. \(\P\), \(\E\), \(\V\) are probability, mean and variance. \(Z\sim\N(0,1)\), \(\Phi\) is its cdf, \(\varphi\) its density. \(\bar Y=\frac1n\sum Y_i\) and \(S^2=\frac1{n-1}\sum(Y_i-\bar Y)^2\); lower-case \(\bar y\), \(s\) are their observed values. \(T_\nu\) is a Student \(t\) variable with \(\nu\) degrees of freedom and \(t_{\alpha,\nu}\) the number with \(\P(T_\nu\ge t_{\alpha,\nu})=\alpha\); \(\chi^2_\nu\) is a chi-square variable, and, as in the book, \(\chi^2_{p,\nu}\) is the number with \(\P(\chi^2_\nu\le\chi^2_{p,\nu})=p\) (the area to its left is \(p\)). \(F_{m,n}\) is an \(F\) variable with \(m\) and \(n\) degrees of freedom.

Prerequisites. Chapter 4 of the book for the gamma and normal laws and moment-generating functions, Chapter 5 for the maximum likelihood estimates and \(S^2\), Chapter 6 for the logic of tests and the generalized likelihood ratio.

Derivations start hidden: click any bar to open one.

7.1 Introduction

pp. 380–381 The normal density \[ f_Y(y)=\frac1{\sqrt{2\pi}\,\sigma}\,e^{-\frac12[(y-\mu)/\sigma]^2},\qquad-\infty<y<\infty,\tag{7.1.1} \] plays two roles in statistics. It is a model for measurements (heights, IQ scores, errors of an instrument), and, through the central limit theorem and the fact that a sum of independent normal variables is normal, it is the sampling distribution of the standardised mean \(Z=(\bar Y-\mu)/(\sigma/\sqrt n)\). Chapters 5 and 6 used the second role to build confidence intervals and tests for \(\mu\), always assuming that \(\sigma\) is known. This chapter studies what happens when it is not, and the same machinery then gives inference about \(\sigma^2\) itself. Three new sampling distributions appear: chi-square, \(F\) and Student's \(t\). The first and third are the ones that matter in practice; the \(F\) law is a stepping stone here and returns when two variances are compared.

7.2 Comparing \(\dfrac{\bar Y-\mu}{\sigma/\sqrt n}\) and \(\dfrac{\bar Y-\mu}{S/\sqrt n}\)

pp. 381–383 Let \(Y_1,\dots,Y_n\) be a sample from \(\N(\mu,\sigma^2)\) and suppose we want to say something about \(\mu\). If \(\sigma\) is known, the ratio \(Z=(\bar Y-\mu)/(\sigma/\sqrt n)\) is standard normal and Theorem 6.2.1 and Section 5.3 apply. If \(\sigma\) is not known, \(Z\) cannot be computed, even with \(\mu_0\) in place of \(\mu\). The natural repair is to replace \(\sigma\) by the estimate \(S=\sqrt{S^2}\), \(S^2=\frac1{n-1}\sum(Y_i-\bar Y)^2\), giving \[ T=\frac{\bar Y-\mu}{S/\sqrt n}. \] Does the repair change the distribution? For large \(n\), hardly: \(S\) is then very close to \(\sigma\) (Filling the gap 7.8), and early practitioners, who worked with large samples, treated \(T\) as standard normal. For small \(n\) the answer is no, and the credit for seeing it goes to W. S. Gosset, a chemist at a brewery, who published under the name "Student" in 1908. His small experiments always had a handful of observations and a variance he could only estimate, and he noticed that the ratio had the bell shape of a normal curve but thicker tails: very large and very small values were not as rare as the normal curve said. Fisher gave the rigorous derivation in 1924 and called the new law the \(t\) distribution.

Figure 7.2.1 shows the difference in a simulation: 500 samples of size \(n=4\) from a normal law, with \(Z\) (left) and \(T\) (right) computed for each. The normal curve fits the left histogram and visibly underestimates both tails of the right one.

Two histograms of 500 simulated ratios for samples of size four. The left, with sigma known, follows the standard normal curve; the right, with S in place of sigma, is flatter, with several values beyond plus or minus four.
Figure 7.2.1. Five hundred samples of size 4 from a normal law: the ratio with \(\sigma\) known (a) and with \(S\) in its place (b), against the standard normal density. The book's draw cannot be reproduced; this is a fresh seeded draw, and values beyond \(\pm4\) are piled into the end bins. Reproduces Larsen and Marx (2018), Figure 7.2.1. Code: ch07_normal_inference.py, fig_7_2_1.
▶ DemoWhy Student's t? (normal data, n = 3)First-year demo: the studentised mean has far heavier tails than the bell curve (preset 4); preset 5 shows n = 30, where the two are close. For the same effect on intervals see preset 3 (n = 5 with the normal multiplier) and preset 4 (the repair with Student's t).

Filling the gap 7.1: what replacing \(\sigma\) by \(S\) costs, exactly pp. 381–382

The book describes the difference between the two ratios in words and one picture. It can be made exact: the "95%" interval \(\bar y\pm1.96\,s/\sqrt n\) has a true confidence level that depends only on \(n\), and the correct interval, which uses \(t_{.025,n-1}\) instead of 1.96, is longer on average than the interval one could build if \(\sigma\) were known.

Hint 1 of 4: the key idea

Theorem 7.3.5 says the law of \(T=(\bar Y-\mu)/(S/\sqrt n)\) involves neither \(\mu\) nor \(\sigma\). So what is the coverage of \(\bar y\pm1.96\,s/\sqrt n\) in terms of one fixed \(t\) law, and what does the expected length need beyond that?

Hint 2 of 4: tools you will need
  • The pivot property of \(T_{n-1}\) (Theorem 7.3.5).
  • The Cauchy cdf for one degree of freedom (gap 7.6).
  • \(\E S=c_n\sigma\) with \(c_n<1\) (gap 5.11).
  • Linearity of expectation for the length \(2t\,S/\sqrt n\).
Hint 3 of 4: step 1

Write the coverage event as \(\{|T|\le1.96\}\). Aim for: coverage \(=2F_{T_{n-1}}(1.96)-1\), a function of \(n\) only. Evaluate it for \(n=2\) with the arctangent cdf.

Hint 4 of 4: step 2

Take expectations of the length \(2t_{.025,n-1}S/\sqrt n\) and divide by the length \(2(1.96)\sigma/\sqrt n\) available when \(\sigma\) is known. Aim for: the ratio \(t_{.025,n-1}c_n/1.96\), and its limit as \(n\to\infty\).

Proof

By Theorem 7.3.5 (proved below), \(T=(\bar Y-\mu)/(S/\sqrt n)\) has the Student \(t\) law with \(n-1\) degrees of freedom whatever \(\mu\) and \(\sigma\) are. Hence for any multiplier \(c\), \[ \P\Bigl(\bar Y-c\frac S{\sqrt n}\le\mu\le\bar Y+c\frac S{\sqrt n}\Bigr)=\P(|T_{n-1}|\le c)=2F_{T_{n-1}}(c)-1. \] With \(c=1.96\) this is the true coverage of the interval that treats \(S\) as if it were \(\sigma\). For \(n=2\) the law \(T_1\) is the Cauchy law with cdf \(\frac12+\frac1\pi\arctan t\) (Filling the gap 7.6), so the coverage is \(\frac2\pi\arctan1.96=0.700\): with two observations a "95%" interval is a 70% interval. The other values are in the table.

The expected length of the correct interval \(\bar Y\pm t_{.025,n-1}S/\sqrt n\) is \(2t_{.025,n-1}\,\E(S)/\sqrt n=2t_{.025,n-1}\,c_n\sigma/\sqrt n\), where \(c_n=\E(S)/\sigma=\sqrt{2/(n-1)}\,\Gamma(n/2)/\Gamma((n-1)/2)<1\) (Filling the gap 5.11). The interval \(\bar Y\pm1.96\,\sigma/\sqrt n\), available only when \(\sigma\) is known, has length \(2(1.96)\sigma/\sqrt n\). The last column is the ratio \(t_{.025,n-1}c_n/1.96\): the price of not knowing \(\sigma\), a factor that is enormous for \(n=2\) (5.2), still 1.5 for \(n=4\) and tends to 1 as \(n\) grows (it is \(1.007\) for \(n=130\)).

\(n\)true coverage of \(\bar y\pm1.96\,s/\sqrt n\)\(t_{.025,n-1}\)expected length relative to the known-\(\sigma\) interval
20.70012.7065.17
30.8114.3031.95
40.8553.1821.50
50.8782.7761.33
100.9182.2621.12
200.9352.0931.05
300.9402.0451.03
1300.9481.9791.01

(The first-year notes make the same point for body temperatures: coverage 0.878 at \(n=5\).) ∎

7.3 Deriving the Distribution of \(\dfrac{\bar Y-\mu}{S/\sqrt n}\)

pp. 383–389 Probability laws come in two kinds: the dozen or so (normal, binomial, Poisson, exponential, hypergeometric, uniform, ...) that model individual measurements, and a smaller set that describe functions of \(n\) measurements. The latter are sampling distributions. After the normal law itself, the three important ones are Student's \(t\), chi-square and \(F\), and all three are needed to find the law of the \(t\) ratio, which is hard to get at directly because \(T\) is a quotient of two random variables, \(\bar Y\) and \(S\), that are both functions of the same \(n\) observations. The derivation has four steps: (1) a sum of squared standard normals is chi-square; (2) \(\bar Y\) and \(S^2\) are independent and \((n-1)S^2/\sigma^2\) is chi-square; (3) a quotient of independent chi-squares is \(F\); (4) \(T^2\) is such a quotient, so \(T\) can be recovered from an \(F\) density.

Theorem 7.3.1 (a sum of squared normals) p. 384

If \(Z_1,\dots,Z_m\) are independent standard normal variables, then \(U=\sum_{j=1}^mZ_j^2\) has the gamma law with shape \(r=m/2\) and rate \(\lambda=\tfrac12\), that is the density \[ f_U(u)=\frac1{2^{m/2}\Gamma(m/2)}\,u^{(m/2)-1}e^{-u/2},\qquad u\ge0. \]

The book's proof is two lines: for \(m=1\), \(\P(Z^2\le u)=\P(-\sqrt u\le Z\le\sqrt u)\) and differentiating gives the gamma density with \(r=\frac12\), \(\lambda=\frac12\); for general \(m\) the sum of independent gammas with the same rate is gamma with the shapes added (Theorem 4.6.4, proved in Filling the gap 4.20). (The identity \(\Gamma(\frac12)=\sqrt\pi\) that is hidden in the constant is derived in Filling the gap 4.18.)

Definition 7.3.1 (chi-square distribution) p. 384

The law of \(U=\sum_{j=1}^mZ_j^2\) for independent standard normal \(Z_j\) is the chi-square distribution with \(m\) degrees of freedom, written \(\chi^2_m\). Its density is the one in Theorem 7.3.1.

See also (companion courses): Theorem 0.8 of the first-year advanced notes (MGF, mean and variance, additivity, and \(t_k\to\N(0,1)\)) and Result 2.10 of the graduate course.

Filling the gap 7.2: the chi-square density integrates to 1; its moment-generating function, mean and variance p. 384; Questions 7.3.1 and 7.3.2

The book defines the chi-square law as a special gamma law and moves on. Two facts about it are used constantly later and are left as questions: the density is a true density, and \(\E(\chi^2_m)=m\), \(\V(\chi^2_m)=2m\). (The gamma family is treated in Filling the gap 4.19; the direct computation here needs nothing but the definition of \(\Gamma\).)

Hint 1 of 4: the key idea

Every claim comes from one integral: \(\int_0^\infty u^{a-1}e^{-bu}\,\d u\). What substitution turns it into the definition of \(\Gamma(a)\), and what does it give when \(b=\tfrac12(1-2t)\)?

Hint 2 of 4: tools you will need
  • The definition \(\Gamma(a)=\int_0^\infty v^{a-1}e^{-v}\,\d v\).
  • Moments as derivatives of the mgf at 0 (gap 3.26).
  • The gamma family (gap 4.19).
Hint 3 of 4: step 1

Substitute \(u=2v\) to prove that the density integrates to 1. Aim for: \(\int_0^\infty u^{m/2-1}e^{-u/2}\d u=2^{m/2}\Gamma(m/2)\).

Hint 4 of 4: step 2

Compute \(\E e^{tU}\) with \(w=(1-2t)u\). Aim for: \((1-2t)^{-m/2}\) for \(t<\tfrac12\). Then differentiate twice at \(t=0\) to get \(\E U\) and \(\V U\).

Proof

Total mass. With the substitution \(u=2v\), \[ \int_0^\infty u^{m/2-1}e^{-u/2}\,\d u=2^{m/2}\int_0^\infty v^{m/2-1}e^{-v}\,\d v=2^{m/2}\Gamma(m/2), \] which is exactly the reciprocal of the constant in \(f_U\), so \(\int_0^\infty f_U=1\).

Moment-generating function. For \(t<\frac12\) put \(w=(1-2t)u\): \[ M_U(t)=\E e^{tU}=\frac1{2^{m/2}\Gamma(m/2)}\int_0^\infty u^{m/2-1}e^{-(1-2t)u/2}\,\d u=(1-2t)^{-m/2}\cdot\frac1{2^{m/2}\Gamma(m/2)}\int_0^\infty w^{m/2-1}e^{-w/2}\,\d w=(1-2t)^{-m/2}. \] For \(t\ge\frac12\) the integral diverges. The function is finite on an interval around 0, so all moments exist and are its derivatives at 0 (Filling the gap 3.26): \[ M_U'(t)=m(1-2t)^{-m/2-1},\quad M_U''(t)=m(m+2)(1-2t)^{-m/2-2}\ \Longrightarrow\ \E U=m,\ \ \E U^2=m(m+2),\ \ \V U=m(m+2)-m^2=2m. \] Since \((1-2t)^{-a/2}(1-2t)^{-b/2}=(1-2t)^{-(a+b)/2}\), the product of the mgfs of independent \(\chi^2_a\) and \(\chi^2_b\) variables is the mgf of \(\chi^2_{a+b}\): chi-square variables add their degrees of freedom. As a check, \(m=1\) gives \(\E Z^2=1\) and \(\V Z^2=\E Z^4-1=3-1=2\). ∎

Filling the gap 7.3: normal approximations for chi-square percentiles, and a large-sample interval for \(\sigma\) pp. 389, 410–411; Questions 7.3.6, 7.5.5, 7.5.12

Tables stop at moderate degrees of freedom, and the book asks for two approximations without deriving the second. (i) Since \(\chi^2_m=\sum Z_j^2\) is a sum of independent variables with mean 1 and variance 2, the central limit theorem gives \((\chi^2_m-m)/\sqrt{2m}\rightsquigarrow\N(0,1)\), so \(\chi^2_{p,m}\approx m+z^*_p\sqrt{2m}\) with \(z^*_p=\Phi^{-1}(p)\). (ii) The Wilson–Hilferty approximation is much better: \[ \chi^2_{p,m}\approx m\Bigl(1-\frac2{9m}+z^*_p\sqrt{\frac2{9m}}\Bigr)^3. \] For \(m=200\) and \(p=0.40\): (i) gives \(200-0.2533(20)=194.93\), (ii) gives 194.32, the exact value is 194.32. For \(p=0.95\): (i) gives 232.9 and (ii) gives 233.99, the exact value being 233.994 (the book's answer 233.9).

Hint 1 of 5: the key idea

A chi-square variable is a sum of independent squares, so the central limit theorem applies. Why would a cube-root transformation of \(\chi^2_m/m\) do better still? Think about which feature of the chi-square density is bad for a normal approximation.

Hint 2 of 5: tools you will need
  • Mean 1 and variance 2 of \(Z^2\) (gap 7.2).
  • The central limit theorem (gap 4.9).
  • The delta method, to second order, for a power \(g(x)=x^\lambda\).
  • Skewness of a gamma variable.
Hint 3 of 5: step 1

Apply the CLT and invert it to get \(\chi^2_{p,m}\approx m+z_p^*\sqrt{2m}\). Aim for: the value \(194.93\) for \(m=200\), \(p=0.40\), to compare with the exact 194.32.

Hint 4 of 5: step 2

Expand \(X^\lambda\), \(X=\chi^2_m/m\), about 1 and find the exponent that kills the first-order skewness. Aim for: \(\lambda=\tfrac13\), with mean \(1-2/(9m)\) and variance \(2/(9m)\).

Hint 5 of 5: step 3

For \(\sigma\), apply the delta method to \(S/\sigma\) and solve \(|S/\sigma-1|\le z/\sqrt{2(n-1)}\) for \(\sigma\). Aim for: \((20.4,\,40.2)\) for Case Study 7.5.1.

Derivation

(i) is the central limit theorem. For (ii) let \(X=\chi^2_m/m\), which has mean 1, variance \(2/m\) and (computing from the gamma moments) skewness \(\gamma_X=\sqrt{8/m}\). Apply a power \(g(x)=x^\lambda\) and expand about 1. To second order \[ \E g(X)\approx g(1)+\tfrac12g''(1)\V X=1+\tfrac12\lambda(\lambda-1)\frac2m,\qquad \V g(X)\approx g'(1)^2\V X=\lambda^2\frac2m, \] and the skewness of \(g(X)\) is, to first order, \(\gamma_X+3\frac{g''(1)}{g'(1)}\sqrt{\V X}=\sqrt{\tfrac8m}+3(\lambda-1)\sqrt{\tfrac2m}=\sqrt{\tfrac2m}\,(3\lambda-1)\). This vanishes exactly at \(\lambda=\frac13\): the cube root removes the skewness of the chi-square law, so a normal approximation for \(X^{1/3}\) is accurate far into the tails. With \(\lambda=\frac13\) the mean is \(1-\frac2{9m}\) and the variance \(\frac2{9m}\), so \(\P(\chi^2_m\le x)\approx\Phi\Bigl(\dfrac{(x/m)^{1/3}-(1-2/(9m))}{\sqrt{2/(9m)}}\Bigr)\); inverting gives (ii). It is an approximation, not a theorem with an error bound, but its error is already below 0.01 in the percentile for \(m=200\).

A large-sample interval for \(\sigma\) (Question 7.5.12). From (i), \(S^2/\sigma^2\) is approximately \(\N(1,\,2/(n-1))\); by the delta method \(S/\sigma\) is approximately \(\N\bigl(1,\,1/(2(n-1))\bigr)\). Then \(|S/\sigma-1|\le z_{\alpha/2}/\sqrt{2(n-1)}\) with probability about \(1-\alpha\), and solving for \(\sigma\), \[ \Bigl(\frac{s}{1+z_{\alpha/2}/\sqrt{2(n-1)}},\ \frac{s}{1-z_{\alpha/2}/\sqrt{2(n-1)}}\Bigr)\quad\text{for }\sigma,\] with the endpoints squared for \(\sigma^2\). For the 19 potassium–argon ages of Case Study 7.5.1, \(s=27.08\) and \(z/\sqrt{36}=0.327\), giving \((20.4,\ 40.2)\) million years against the exact \((20.5,\ 40.0)\). The tempting "\(s\pm z\,s/\sqrt{2(n-1)}\)" gives \((18.2,\ 35.9)\), which is shifted to the left of the exact interval because it ignores the skewness of the sampling law of \(S\). ∎

Theorem 7.3.2 (the normal-sample theorem) p. 384; proof in Appendix 7.A.1, p. 414

Let \(Y_1,\dots,Y_n\) be a random sample from \(\N(\mu,\sigma^2)\). Then (a) \(\bar Y\) and \(S^2\) are independent, and (b) \((n-1)S^2/\sigma^2=\frac1{\sigma^2}\sum_{i=1}^n(Y_i-\bar Y)^2\) has the chi-square law with \(n-1\) degrees of freedom. (Also \(\bar Y\sim\N(\mu,\sigma^2/n)\).)

This is the centre of the chapter, and it is special to the normal law: for no other family are the sample mean and variance independent (the experiment of Section 7.2 makes the point for \(T\), and the first-year demonstration shows the failure of independence for skewed and uniform data). The book defers the proof to Appendix 7.A.1; it is given here, in place, as Filling the gap 7.4. It is the same proof as Theorem 0.9 of the first-year advanced notes.

▶ DemoThe sample mean and standard deviation (normal data, n = 5)First-year demo: the cloud of \((\bar x,s)\) is shapeless for normal data (preset 1) and tilted for skewed data (preset 2); the histogram of \((n-1)s^2/\sigma^2\) follows the chi-square curve.

Appendix 7.A.1: some distribution results for \(\bar Y\) and \(S^2\)

Filling the gap 7.4: proof of Theorem 7.3.2 (Appendix 7.A.1, Theorem 7.A.1.1) and Fisher's lemma pp. 414–416

The book's appendix proof rotates the standardised sample with an orthogonal matrix whose last row is \((1,\dots,1)/\sqrt n\), argues that the rotated variables are again independent standard normal (Fisher's lemma), and reads off the two claims. It states the existence of the matrix and the change of variables without detail, and its Lemma says that an orthogonal matrix has "\(\det A=1\)", which is not true in general (it is \(\pm1\); see Notes on the book). Here is the argument with every step.

Hint 1 of 5: the key idea

Rotate the standardised sample so that \(\sqrt n\,\bar X\) becomes one coordinate. Why would the rotated coordinates still be independent standard normal, and where do the deviations \(X_j-\bar X\) end up?

Hint 2 of 5: tools you will need
  • An orthogonal matrix preserves length: \(\|A\bm x\|=\|\bm x\|\).
  • The change-of-variables formula with \(|\det A|=1\) (Section 3.8).
  • \(\sum X_j^2=\sum(X_j-\bar X)^2+n\bar X^2\).
  • Theorem 7.3.1 and the first-year proof (Theorem 0.9).
Hint 3 of 5: step 1

Build the matrix with last row \((1,\dots,1)/\sqrt n\): row \(k\) is \((1,\dots,1,-k,0,\dots,0)\) scaled. Aim for: \(AA^\T=I\) (check row lengths, then inner products of different rows).

Hint 4 of 5: step 2

Find the density of \(\bm Z=A\bm X\). Aim for: \((2\pi)^{-n/2}e^{-\|\bm z\|^2/2}\), so the \(Z_j\) are independent \(\N(0,1)\). Why does the sign of \(\det A\) not matter?

Hint 5 of 5: step 3

Use \(Z_n=\sqrt n\bar X\) and length preservation. Aim for: \(\sum_{j<n}Z_j^2=\sum(X_j-\bar X)^2\), then read off independence and the \(\chi^2_{n-1}\) law.

Proof

Standardise. Put \(X_i=(Y_i-\mu)/\sigma\): independent \(\N(0,1)\), with \(\bar Y=\mu+\sigma\bar X\) and \(\sum(Y_i-\bar Y)^2=\sigma^2\sum(X_i-\bar X)^2\). It is enough to prove the theorem for the \(X_i\).

An orthogonal matrix with last row \((1,\dots,1)/\sqrt n\). Let \(A\) be the \(n\times n\) Helmert matrix: for \(k=1,\dots,n-1\), row \(k\) is \[ a_k=\frac1{\sqrt{k(k+1)}}\bigl(\underbrace{1,\dots,1}_{k},\,-k,\,0,\dots,0\bigr),\qquad a_n=\frac1{\sqrt n}(1,\dots,1). \] Then \(\|a_k\|^2=(k+k^2)/(k(k+1))=1\). For \(k<l<n\), \(a_l\) is constant on the first \(l\) coordinates and \(a_k\) lives on the first \(k+1\le l\) of them, where its entries sum to \(k-k=0\); so \(a_k\cdot a_l=0\). Each \(a_k\) with \(k<n\) has entries summing to 0, so \(a_k\cdot a_n=0\). Thus \(AA^\T=I\): \(A\) is orthogonal, \(A^{-1}=A^\T\), and \(\det A=\pm1\) (from \(\det A^2=\det AA^\T=1\)).

Fisher's lemma. Let \(\bm Z=A\bm X\). The vector \(\bm X\) has density \((2\pi)^{-n/2}\exp(-\|\bm x\|^2/2)\). The map \(\bm x\mapsto A\bm x\) is one-to-one with inverse \(\bm z\mapsto A^\T\bm z\), whose Jacobian has absolute value \(|\det A^\T|=1\) (the change-of-variables formula uses the absolute value of the determinant, so the sign does not matter), and \(\|A^\T\bm z\|=\|\bm z\|\). So \(\bm Z\) has density \((2\pi)^{-n/2}\exp(-\|\bm z\|^2/2)=\prod_j\varphi(z_j)\): the \(Z_j\) are independent standard normal.

Read off the claims. Because \(a_n\) is the last row, \(Z_n=\sqrt n\,\bar X\). Because \(A\) preserves length, \(\sum_{j=1}^nZ_j^2=\sum_{j=1}^nX_j^2\), and the algebraic identity \(\sum X_j^2=\sum(X_j-\bar X)^2+n\bar X^2\) then gives \[ \sum_{j=1}^{n-1}Z_j^2=\sum_{j=1}^n(X_j-\bar X)^2. \] So \(\bar X\) is a function of \(Z_n\) alone and \(\sum(X_j-\bar X)^2\) is a function of \((Z_1,\dots,Z_{n-1})\) alone; they are independent. And \(\sum_{j<n}Z_j^2\) is a sum of \(n-1\) independent squared standard normals, so it is \(\chi^2_{n-1}\) (Theorem 7.3.1). Translating back, \(\bar Y\) and \(S^2\) are independent and \((n-1)S^2/\sigma^2\sim\chi^2_{n-1}\). ∎

Why \(n-1\). The first \(n-1\) rows of \(A\) span the subspace orthogonal to \((1,\dots,1)\), in which the deviations \(X_j-\bar X\) live because they sum to zero; one dimension has been spent on estimating \(\mu\). The multivariate version of this argument gives the Wishart law (Filling the gap 14.11 of the graduate course).

Definition 7.3.2 (the \(F\) distribution) p. 385

If \(V\sim\chi^2_m\) and \(U\sim\chi^2_n\) are independent, then \(F_{m,n}=\dfrac{V/m}{U/n}\) has the \(F\) distribution with \(m\) and \(n\) degrees of freedom. (The letter honours Fisher.) The 100\(p\)th percentile is written \(F_{p,m,n}\).

Theorem 7.3.3 (the \(F\) density) p. 385

The density of \(F_{m,n}\) is \[ f_{F_{m,n}}(w)=\frac{\Gamma\bigl(\frac{m+n}2\bigr)\,m^{m/2}n^{n/2}\,w^{m/2-1}}{\Gamma\bigl(\frac m2\bigr)\Gamma\bigl(\frac n2\bigr)\,(n+mw)^{(m+n)/2}},\qquad w\ge0. \]

The book finds the density of \(V/U\) by the quotient formula of Theorem 3.8.4 and a gamma integral, then rescales. (That formula's printed proof contains a slip, corrected in Filling the gap 3.17; the statement is right.) Figure 7.3.1 shows \(F_{3,5}\), whose 95th percentile is \(F_{.95,3,5}=5.41\) (Appendix Table A.4). Like a chi-square curve it lives on \(w\ge0\) and is skewed to the right, so tables list both tails.

The density of the F distribution with 3 and 5 degrees of freedom, a right-skewed curve with the area to the right of 5.41 shaded and labelled 0.05.
Figure 7.3.1. The density of \(F_{3,5}\); 95% of the area lies to the left of \(F_{.95,3,5}=5.41\). Reproduces Larsen and Marx (2018), Figure 7.3.1. Code: ch07_normal_inference.py, fig_7_3_1.

Filling the gap 7.5: the \(F\) density from a Beta integral, its mean, and why \(F_{m,n}\to1\) pp. 385, 389; Questions 7.3.10 to 7.3.12

A route to the \(F\) density that avoids the quotient formula: the share \(B=V/(U+V)\) of a total split between two independent chi-square variables has a Beta law, and \(F\) is a monotone function of \(B\). The same representation gives the mean of \(F\) and the limit of \(F_{m,n}\) as both degrees of freedom grow.

Hint 1 of 5: the key idea

The ratio \(V/(U+V)\) of independent gamma variables with a common rate is independent of the sum and has a Beta law. How is \(F_{m,n}\) a simple increasing function of that share?

Hint 2 of 5: tools you will need
  • Sum and share of two gammas (gap 4.20) and the Beta integral.
  • The one-dimensional change-of-variables formula.
  • \(\E(1/U)\) for a chi-square variable by a gamma integral.
  • Chebyshev's inequality.
Hint 3 of 5: step 1

Write \(F=\tfrac nm\,B/(1-B)\) and \(B=mF/(n+mF)\). Aim for: \(\d B/\d w=mn/(n+mw)^2\).

Hint 4 of 5: step 2

Substitute into the Beta density. Aim for: the exponents \(m/2-1\) on \(w\) and \((m+n)/2\) on \(n+mw\), with the constant of Theorem 7.3.3.

Hint 5 of 5: step 3

For the mean use independence of \(V\) and \(U\), and \(\E(1/U)=1/(n-2)\). For the limit, show that \(V/m\) and \(U/n\) have mean 1 and variances \(2/m,\,2/n\). Aim for: \(\E F=n/(n-2)\) and \(F_{m,n}\to1\) in probability.

Proof

Let \(V\sim\chi^2_m\), \(U\sim\chi^2_n\) be independent. They are gamma variables with the same rate \(\frac12\), so by Filling the gap 4.20 the share \(B=V/(U+V)\) has density \(b^{m/2-1}(1-b)^{n/2-1}/\mathrm B(\tfrac m2,\tfrac n2)\) on \((0,1)\), with \(\mathrm B(a,b)=\Gamma(a)\Gamma(b)/\Gamma(a+b)\). Since \(V/U=B/(1-B)\), \[ F_{m,n}=\frac nm\,\frac{B}{1-B},\qquad\text{equivalently}\quad B=\frac{mF}{n+mF}. \] This is increasing, with \(\d B/\d w=mn/(n+mw)^2\). Hence the density of \(F_{m,n}\) at \(w\) is \[ \frac{1}{\mathrm B(\frac m2,\frac n2)}\Bigl(\frac{mw}{n+mw}\Bigr)^{m/2-1}\Bigl(\frac n{n+mw}\Bigr)^{n/2-1}\frac{mn}{(n+mw)^2}=\frac{m^{m/2}n^{n/2}\,w^{m/2-1}}{\mathrm B(\frac m2,\frac n2)\,(n+mw)^{(m+n)/2}}, \] which is Theorem 7.3.3.

Mean. By independence \(\E F_{m,n}=\frac nm\,\E V\,\E(1/U)=\frac nm\cdot m\cdot\E(1/U)\), and \(\E(1/U)=\dfrac{\Gamma(n/2-1)}{2\Gamma(n/2)}=\dfrac1{n-2}\) for \(n>2\) (the gamma integral \(\int u^{n/2-2}e^{-u/2}\d u=2^{n/2-1}\Gamma(\frac n2-1)\) converges only if \(n>2\)). So \(\E F_{m,n}=n/(n-2)\), which exceeds 1 and does not depend on \(m\).

The limit (Question 7.3.10). \(V/m\) and \(U/n\) have mean 1 and variances \(2/m\) and \(2/n\) (Filling the gap 7.2), so by Chebyshev \(V/m\) and \(U/n\) converge in probability to 1 as \(m,n\to\infty\), and so does their quotient (a continuous function of the pair at \((1,1)\)). For \(m=n=20\,000\) the standard deviation of \(F\) is about 0.014, and \(\P(0.95<F<1.05)=0.9996\). ∎

Definition 7.3.3 (the Student \(t\) ratio) p. 386

If \(Z\sim\N(0,1)\) and \(U\sim\chi^2_n\) are independent, then \(T_n=\dfrac Z{\sqrt{U/n}}\) has the Student \(t\) distribution with \(n\) degrees of freedom (df).

Lemma (symmetry) p. 386

The density of \(T_n\) is symmetric: \(f_{T_n}(t)=f_{T_n}(-t)\). (Indeed \(-Z\) is also standard normal and independent of \(U\), so \(T_n\) and \(-T_n\) have the same law.)

Theorem 7.3.4 (the \(t\) density) p. 386

\[ f_{T_n}(t)=\frac{\Gamma\bigl(\frac{n+1}2\bigr)}{\sqrt{n\pi}\;\Gamma\bigl(\frac n2\bigr)}\Bigl(1+\frac{t^2}n\Bigr)^{-(n+1)/2},\qquad-\infty<t<\infty. \]

The book's proof notes that \(T_n^2=Z^2/(U/n)\) is \(F_{1,n}\), writes \(F_{T_n}(t)=\frac12+\frac12F_{T_n^2}(t^2)\) for \(t>0\) using the symmetry, and differentiates. Filling the gap 7.6 gives a second derivation (by conditioning on \(U\)) and the closed forms for one and two degrees of freedom, which explain two entries of the table.

Filling the gap 7.6: the \(t\) density by conditioning, and the cdf for 1 and 2 degrees of freedom pp. 386–387, 390; Question 7.3.14

Conditioning on \(U\) gives the \(t\) density in one gamma integral and shows where each factor comes from. For \(\nu=1\) and \(\nu=2\) the cdf is elementary, which is where the odd-looking table entries \(t_{.025,1}=12.706\) and \(t_{.025,2}=4.3027\) come from.

Hint 1 of 4: the key idea

Condition on the chi-square variable \(U\). Given \(U=u\), the ratio \(T\) is just a rescaled normal. What is its density, and what remains to be integrated?

Hint 2 of 4: tools you will need
  • The density of \(cZ\): \(c^{-1}\varphi(t/c)\).
  • The gamma integral \(\int_0^\infty u^{a-1}e^{-bu}\d u=\Gamma(a)b^{-a}\).
  • The density of \(\chi^2_\nu\) (Theorem 7.3.1).
  • Antiderivatives of \((1+t^2)^{-1}\) and \((2+t^2)^{-3/2}\).
Hint 3 of 4: step 1

Write the conditional density \(\sqrt{u/\nu}\,\varphi(t\sqrt{u/\nu})\), multiply by \(f_U(u)\) and integrate. Aim for: a gamma integral with rate \(\tfrac12(1+t^2/\nu)\), then Theorem 7.3.4.

Hint 4 of 4: step 2

Put \(\nu=1\) and \(\nu=2\) in the constant and integrate. Aim for: the cdfs \(\tfrac12+\tfrac1\pi\arctan t\) and \(\tfrac12+t/(2\sqrt{2+t^2})\). Solve for the 0.025 upper points to recover 12.706 and 4.3027.

Proof

The density. Write \(T=Z/\sqrt{U/\nu}\). Given \(U=u\), \(T\) is \(Z\) scaled by \(\sqrt{\nu/u}\), with conditional density \(\sqrt{u/\nu}\,\varphi(t\sqrt{u/\nu})\). Averaging over the density of \(U\), \[ f_T(t)=\int_0^\infty\sqrt{\frac u\nu}\,\frac{e^{-t^2u/(2\nu)}}{\sqrt{2\pi}}\cdot\frac{u^{\nu/2-1}e^{-u/2}}{2^{\nu/2}\Gamma(\nu/2)}\,\d u=\frac{1}{\sqrt{2\pi\nu}\,2^{\nu/2}\Gamma(\nu/2)}\int_0^\infty u^{\frac{\nu+1}2-1}e^{-\frac12(1+t^2/\nu)u}\,\d u. \] The last integral is \(\Gamma(\frac{\nu+1}2)\bigl[\frac12(1+t^2/\nu)\bigr]^{-(\nu+1)/2}\) (a gamma density integrates to 1), and \(2^{(\nu+1)/2}/(\sqrt2\,2^{\nu/2})=1\), which leaves Theorem 7.3.4.

One degree of freedom. The constant is \(\Gamma(1)/(\sqrt\pi\,\Gamma(\frac12))=1/\pi\), so \(f_{T_1}(t)=\dfrac1{\pi(1+t^2)}\), the Cauchy density, with cdf \(\frac12+\frac1\pi\arctan t\). A Cauchy variable has no mean (the integral of \(|t|/(1+t^2)\) diverges), so the \(t\) ratio from two observations has no expected value. The upper 2.5% point solves \(\frac12-\frac1\pi\arctan t=0.025\), that is \(t=\tan(0.475\pi)=12.706\), the entry of the table in Figure 7.4.1.

Two degrees of freedom. The constant is \(\Gamma(\frac32)/(\sqrt{2\pi}\,\Gamma(1))=1/(2\sqrt2)\), so \(f_{T_2}(t)=\frac1{2\sqrt2}(1+t^2/2)^{-3/2}=(2+t^2)^{-3/2}\). Differentiating, \[ \frac{\d}{\d t}\,\frac t{2\sqrt{2+t^2}}=\frac12\cdot\frac{(2+t^2)-t^2}{(2+t^2)^{3/2}}=(2+t^2)^{-3/2}, \] and the antiderivative tends to \(\pm\frac12\) at \(\pm\infty\), so the cdf is \(\frac12+\dfrac t{2\sqrt{2+t^2}}\). Setting \(\frac t{2\sqrt{2+t^2}}=0.475\) gives \(t^2=2(0.95)^2/(1-0.95^2)=18.51\) and \(t_{.025,2}=4.3027\), again a table entry.

Question 7.3.14. The function \(1/(\pi(1+t^2))\) is a density, even in \(t\), so \(\int_0^\infty\frac{\d t}{\pi(1+t^2)}=\frac12\) and \(\int_0^\infty\frac{\d x}{1+x^2}=\frac\pi2\). ∎

Theorem 7.3.5 (the \(t\) ratio for a normal sample) p. 387

If \(Y_1,\dots,Y_n\) is a random sample from \(\N(\mu,\sigma^2)\), then \(T_{n-1}=\dfrac{\bar Y-\mu}{S/\sqrt n}\) has the Student \(t\) distribution with \(n-1\) degrees of freedom.

Proof (the book's, in one line): rewrite \[ \frac{\bar Y-\mu}{S/\sqrt n}=\frac{(\bar Y-\mu)/(\sigma/\sqrt n)}{\sqrt{\dfrac{(n-1)S^2/\sigma^2}{n-1}}}. \] The numerator is standard normal, the radicand is a chi-square variable with \(n-1\) degrees of freedom divided by \(n-1\) (Theorem 7.3.2(b)), and the two are independent because \(\bar Y\) and \(S^2\) are (Theorem 7.3.2(a)). That is Definition 7.3.3 with \(n-1\) degrees of freedom. The law does not involve \(\mu\) or \(\sigma\), so \(T_{n-1}\) is a pivot: this is what makes intervals and tests for \(\mu\) possible. The same proof, with the first-year notation, is Theorem 0.9(iv). \(\square\)

See also (companion courses): the graduate course proves that the \(t_\nu\) density integrates to 1, that \(t_1\) is the Cauchy law and that \(t_\nu\to\N(0,1)\) in Result 2.9.

\(f_{T_n}(t)\) and \(f_Z(z)\): how the two are related

p. 388 Student curves and the standard normal curve are all bell-shaped, symmetric and centred at 0, but the \(t\) curves are flatter in the middle and thicker in the tails (Figure 7.3.2, for 2 and 10 degrees of freedom), and as \(n\) grows \(f_{T_n}\) approaches \(f_Z\). The book attributes this to two facts: \(S\) is asymptotically unbiased for \(\sigma\), and its standard deviation tends to 0 (Question 7.3.4). Both are proved in Filling the gap 7.8; the convergence of the densities is proved in Filling the gap 7.7.

The standard normal density and Student t densities with 2 and 10 degrees of freedom; the t curves are lower at the centre and higher in the tails, the one with 2 degrees of freedom more so.
Figure 7.3.2. Student \(t\) densities with 2 and 10 degrees of freedom against the standard normal density. Reproduces Larsen and Marx (2018), Figure 7.3.2. Code: ch07_normal_inference.py, fig_7_3_2.

Filling the gap 7.7: which moments the \(t\) law has, its variance \(n/(n-2)\), and the convergence \(f_{T_n}\to\varphi\) pp. 388–389; Questions 7.3.13 and 7.3.15

The book asserts that \(f_{T_n}\) approaches the normal density and asks for the proof in two questions. Claims: (a) \(\E|T_n|^r\) is finite exactly when \(r<n\), so \(T_n\) has \(2k\) moments only if \(2k<n\); (b) \(\V T_n=n/(n-2)\) for \(n>2\); (c) \(f_{T_n}(t)\to\varphi(t)\) for every \(t\), hence \(F_{T_n}\to\Phi\).

Hint 1 of 5: the key idea

The tails of the \(t\) density decay like a power of \(|t|\), not exponentially. Which moments does a power tail allow? For the limit, what happens to each factor of the density as \(n\to\infty\)?

Hint 2 of 5: tools you will need
  • Comparison of \(\int^\infty t^{-s}\d t\) (finite iff \(s>1\)).
  • \(\E(1/U)=1/(n-2)\) (gap 7.5) and independence of \(Z\) and \(U\).
  • Log-convexity of \(\Gamma\) (Hölder) for Wendel's inequality.
  • \((1+a/n)^n\to e^a\); Slutsky's theorem.
Hint 3 of 5: step 1

For \(|t|\ge\sqrt n\) bound \(1+t^2/n\) between \(t^2/n\) and \(2t^2/n\). Aim for: the density squeezed between multiples of \(|t|^{-(n+1)}\), so \(\E|T|^r<\infty\iff r<n\).

Hint 4 of 5: step 2

Compute \(\E T^2=n\,\E Z^2\,\E(1/U)\). Aim for: \(n/(n-2)\), which is above 1 and tends to 1.

Hint 5 of 5: step 3

Show \(\sqrt{n/2}\sqrt{n/(n+1)}\le\Gamma(\tfrac{n+1}2)/\Gamma(\tfrac n2)\le\sqrt{n/2}\) using log-convexity twice. Aim for: the constant tends to \(1/\sqrt{2\pi}\); combine with \((1+t^2/n)^{-(n+1)/2}\to e^{-t^2/2}\).

Proof

(a) Let \(c_n\) be the constant of the density. For \(|t|\ge\sqrt n\) we have \(t^2/n\le1+t^2/n\le2t^2/n\), hence \[ c_n\Bigl(\frac n2\Bigr)^{(n+1)/2}|t|^{-(n+1)}\ \le\ f_{T_n}(t)\ \le\ c_n\,n^{(n+1)/2}|t|^{-(n+1)}: \] for large \(|t|\) the density is squeezed between two positive multiples of \(|t|^{-(n+1)}\). Therefore \(\int^\infty t^rf_{T_n}(t)\,\d t\) converges if and only if \(\int^\infty t^{r-n-1}\d t\) does, that is if and only if \(r<n\). In particular \(T_1\) (Cauchy) has no mean, \(T_2\) has a mean but no variance, and \(\E T_n^{2k}<\infty\) if \(2k<n\) (Question 7.3.15).

(b) Let \(n>2\). By symmetry \(\E T_n=0\), and by independence of \(Z\) and \(U\), \(\E T_n^2=n\,\E(Z^2)\,\E(1/U)=n\cdot1\cdot\frac1{n-2}\), using \(\E(1/U)=1/(n-2)\) from Filling the gap 7.5. So \(\V T_n=n/(n-2)\), which is 3 for \(n=3\), \(1.25\) for \(n=10\) and tends to 1: the thicker tails are quantified. (For \(n\le2\), \(\E(1/U)=\infty\) and \(\E T_n^2=\infty\).)

(c) First, \((1+t^2/n)^{-(n+1)/2}\to e^{-t^2/2}\) since \((1+a/n)^n\to e^a\) with \(a=t^2\) and \((1+t^2/n)^{-1/2}\to1\). The constant needs a Gamma-ratio estimate. Wendel's inequality: for \(x>0\) and \(0<s<1\), \[ \Bigl(\frac x{x+s}\Bigr)^{1-s}\le\frac{\Gamma(x+s)}{x^s\Gamma(x)}\le1. \] The upper bound is log-convexity of \(\Gamma\): \(x+s=(1-s)x+s(x+1)\) gives \(\Gamma(x+s)\le\Gamma(x)^{1-s}\Gamma(x+1)^s=\Gamma(x)x^s\). For the lower bound write \(x+1=s(x+s)+(1-s)(x+s+1)\), so \(x\Gamma(x)=\Gamma(x+1)\le\Gamma(x+s)^s\Gamma(x+s+1)^{1-s}=\Gamma(x+s)(x+s)^{1-s}\). Take \(x=n/2\), \(s=\frac12\): \[ \sqrt{\frac n2}\sqrt{\frac n{n+1}}\le\frac{\Gamma(\frac{n+1}2)}{\Gamma(\frac n2)}\le\sqrt{\frac n2}\quad\Longrightarrow\quad\frac1{\sqrt{2\pi}}\sqrt{\frac n{n+1}}\le c_n=\frac{\Gamma(\frac{n+1}2)}{\sqrt{n\pi}\,\Gamma(\frac n2)}\le\frac1{\sqrt{2\pi}}. \] So \(c_n\to1/\sqrt{2\pi}\) and \(f_{T_n}(t)\to\varphi(t)\) pointwise. By Scheffé's theorem (pointwise convergence of densities to a density gives convergence in total variation), \(F_{T_n}\to\Phi\) uniformly. (A probabilistic proof: \(U/n\to1\) in probability, since \(U/n\) has mean 1 and variance \(2/n\), so \(T_n=Z/\sqrt{U/n}\rightsquigarrow Z\) by Slutsky's theorem.) ∎

Filling the gap 7.8: \(\V(S^2)=2\sigma^4/(n-1)\), the consistency of \(S^2\), and \(\E S\), \(\V S\) pp. 388–389; Questions 7.3.4 and 7.3.5

For a normal sample, \(\V(S^2)=2\sigma^4/(n-1)\), \(S^2\) is consistent for \(\sigma^2\), and the two properties of \(S\) quoted on page 388 hold: \(\E S\to\sigma\) (the bias is at most \(\sigma/n\)) and \(\V S\le\sigma^2/n\to0\).

Hint 1 of 4: the key idea

You know the variance of \((n-1)S^2/\sigma^2\). Scale it to get \(\V S^2\), then ask which inequality turns a vanishing variance of an unbiased estimator into consistency.

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

Compute \(\V(S^2)\) and apply Chebyshev to \(|S^2-\sigma^2|\). Aim for: \(\V S^2=2\sigma^4/(n-1)\) and \(\P(|S^2-\sigma^2|\ge\varepsilon)\to0\).

Hint 4 of 4: step 2

Bound \(c_n=\sqrt{2/(n-1)}\,\Gamma(\tfrac n2)/\Gamma(\tfrac{n-1}2)\) with Wendel's inequality for \(x=\tfrac{n-1}2\). Aim for: \(\sqrt{(n-1)/n}\le c_n\le1\), then \(\V S=\sigma^2(1-c_n^2)\le\sigma^2/n\).

Proof

\((n-1)S^2/\sigma^2\sim\chi^2_{n-1}\) has variance \(2(n-1)\) (Filling the gap 7.2), so \(\V(S^2)=\dfrac{\sigma^4}{(n-1)^2}\cdot2(n-1)=\dfrac{2\sigma^4}{n-1}\). Since \(\E S^2=\sigma^2\), Chebyshev gives \(\P(|S^2-\sigma^2|\ge\varepsilon)\le\dfrac{2\sigma^4}{(n-1)\varepsilon^2}\to0\): \(S^2\) is consistent, and so is \(S=\sqrt{S^2}\) (a continuous function). For the mean of \(S\), \(\E S=c_n\sigma\) with \(c_n=\sqrt{2/(n-1)}\;\Gamma(n/2)/\Gamma((n-1)/2)\) (Filling the gap 5.11). Apply Wendel's inequality (Filling the gap 7.7) with \(x=\frac{n-1}2\), \(s=\frac12\): \(\sqrt x\sqrt{x/(x+\frac12)}\le\Gamma(x+\frac12)/\Gamma(x)\le\sqrt x\), and multiplying by \(\sqrt{2/(n-1)}=1/\sqrt x\), \[ \sqrt{\frac{n-1}n}\le c_n\le1. \] So \(0\le\sigma-\E S\le\sigma\bigl(1-\sqrt{1-1/n}\bigr)\le\sigma/n\), and \(\V S=\E S^2-(\E S)^2=\sigma^2(1-c_n^2)\le\sigma^2\bigl(1-\frac{n-1}n\bigr)=\sigma^2/n\). (The sharper asymptotics are \(\V S\approx\sigma^2/(2(n-1))\); for \(n=2\), \(c_2=\sqrt{2/\pi}=0.798\).) Thus \(S\) is asymptotically unbiased with variance tending to 0, so the denominator of the \(t\) ratio settles down at \(\sigma\) and \(T\) approaches \(Z\). ∎

7.4 Drawing Inferences About \(\mu\)

pp. 389–404 With Theorem 7.3.5 in hand, the two standard problems about a normal mean, an interval and a test, can be solved when \(\sigma\) is unknown. Section 7.4 does both, and then asks what happens when the data are not normal.

The \(t\) table

p. 390 Just as the \(z\) procedures need percentiles of \(\N(0,1)\), the \(t\) procedures need percentiles of Student curves. A \(t\) table has one row for each number of degrees of freedom and one column for each right-tail area \(\alpha\); the entry is \(t_{\alpha,n}\), the number with \(\P(T_n\ge t_{\alpha,n})=\alpha\) (Figure 7.4.2). Only upper percentiles are tabulated, because symmetry gives \(\P(T_n\le-t_{\alpha,n})=\alpha\). The last row, df \(=\infty\), is the normal row: \(t_{\alpha,\infty}=z_\alpha\). For example \(\P(T_3\ge4.541)=0.01\).

df.20.15.10.05.025.01.005
11.3761.9633.0786.313812.706231.82163.657
21.0611.3861.8862.92004.30276.9659.925
30.9781.2501.6382.35343.18244.5415.841
40.9411.1901.5332.13182.77643.7474.604
50.9201.1561.4762.01502.57063.3654.032
60.9061.1341.4401.94322.44693.1433.707
300.8541.0551.3101.69732.04232.4572.750
∞0.8421.0361.2821.6451.9602.3262.576

Figure 7.4.1 (recomputed as a table). Right-tail points \(t_{\alpha,n}\) of Student \(t\) curves; the book prints the same excerpt, rounded to three or four decimals as here. Computed by ch07_normal_inference.py (scipy.stats.t.ppf). The tables at the end of the book (Appendix Table A.2) cover more rows.

The Student t density with 10 degrees of freedom with the right tail beyond 1.812 shaded and labelled area alpha.
Figure 7.4.2. The number \(t_{\alpha,n}\) cuts off a right-hand area \(\alpha\) under the \(t_n\) density (here \(n=10\), \(\alpha=0.05\), \(t_{.05,10}=1.812\)). The book draws this schematically. Reproduces Larsen and Marx (2018), Figure 7.4.2. Code: ch07_normal_inference.py, fig_7_4_2.

Constructing a confidence interval for \(\mu\)

pp. 390–391 By Theorem 7.3.5, \(\P\bigl(-t_{\alpha/2,n-1}\le\frac{\bar Y-\mu}{S/\sqrt n}\le t_{\alpha/2,n-1}\bigr)=1-\alpha\), and solving the inequalities for \(\mu\), \[ \P\Bigl(\bar Y-t_{\alpha/2,n-1}\frac S{\sqrt n}\le\mu\le\bar Y+t_{\alpha/2,n-1}\frac S{\sqrt n}\Bigr)=1-\alpha.\tag{7.4.1} \] Substituting the observed \(\bar y\) and \(s\) gives the interval of the theorem.

Theorem 7.4.1 (the \(t\) interval) p. 391

If \(y_1,\dots,y_n\) is a random sample from a normal law with unknown mean \(\mu\), a \(100(1-\alpha)\%\) confidence interval for \(\mu\) is \[ \Bigl(\bar y-t_{\alpha/2,n-1}\frac s{\sqrt n},\ \bar y+t_{\alpha/2,n-1}\frac s{\sqrt n}\Bigr). \]

See also (companion courses): Theorem 3.4 of the first-year advanced notes proves the same statement and the confidence-interval demonstration (preset 4) shows the coverage of the \(t\) interval at \(n=5\).

Filling the gap 7.9: the \(t\) interval has coverage exactly \(1-\alpha\) for every \(\mu,\sigma\), equal tails are shortest, and the confidence of other intervals pp. 390–391, 395; Question 7.4.15

The book derives (7.4.1) in one line and later asks for the confidence level of four intervals with unequal multipliers. Three facts fill the gap. (a) The coverage of the interval is exactly \(1-\alpha\) for every \((\mu,\sigma)\) and every \(n\ge2\), because \(T_{n-1}\) is a pivot. (b) For a given sample the equal-tailed interval is the shortest one of its confidence. (c) An interval \(\bar y-a\,s/\sqrt n\le\mu\le\bar y+b\,s/\sqrt n\) has confidence \(\P(-b\le T_{n-1}\le a)=F_{T_{n-1}}(a)-F_{T_{n-1}}(-b)\).

Hint 1 of 5: the key idea

Coverage is a statement about the event \(\{-b\le T\le a\}\) for the pivot \(T\). Once you have written the interval that way, coverage, other multipliers and the shortest choice are all questions about one \(t\) density.

Hint 2 of 5: tools you will need
  • The pivot \(T_{n-1}\) (Theorem 7.3.5) and its symmetry.
  • Lagrange or substitution for minimising \(a+b\) given \(F(a)-F(-b)=1-\alpha\).
  • The same argument for the normal curve (gap 5.6).
  • The first-year proof (Theorem 3.4).
Hint 3 of 5: step 1

Rewrite \(\bar Y-aS/\sqrt n\le\mu\le\bar Y+bS/\sqrt n\) as an event for \(T\). Aim for: \(\{-b\le T\le a\}\), with probability \(F(a)-F(-b)\) whatever \(\mu,\sigma\) are.

Hint 4 of 5: step 2

Minimise \(a+b\) subject to the constraint. Aim for: \(f(a)=f(-b)\), hence \(a=b\) since \(f\) is even and decreasing on \((0,\infty)\).

Hint 5 of 5: step 3

Let \(a\to\infty\) for the one-sided interval. Aim for: \((-\infty,\bar y+t_{\alpha,n-1}s/\sqrt n)\) has confidence \(1-\alpha\).

Proof

(a) The event in (7.4.1) is \(\{-t_{\alpha/2,n-1}\le T\le t_{\alpha/2,n-1}\}\) with \(T=(\bar Y-\mu)/(S/\sqrt n)\), and the law of \(T\) is \(t_{n-1}\) whatever \(\mu\) and \(\sigma\) are (Theorem 7.3.5), so its probability is \(1-\alpha\) for all of them (it does not merely hold on average over \((\mu,\sigma)\)).

(c) The same rewriting works for any numbers \(a,b\). With \(T=(\bar Y-\mu)/(S/\sqrt n)\): \(\mu\le\bar Y+bS/\sqrt n\iff T\ge-b\) and \(\bar Y-aS/\sqrt n\le\mu\iff T\le a\). So the event is \(\{-b\le T\le a\}\), with probability \(F_{T_{n-1}}(a)-F_{T_{n-1}}(-b)\). (For symmetric multipliers \(a=b\) this is \(2F(a)-1\). For part (c) of Question 7.4.15, \(a=1.7056=t_{.05,26}\) and \(b=2.7787=t_{.005,26}\) give \(0.95-0.005=0.945\).)

(b) The length of the interval, \((a+b)\,s/\sqrt n\), is proportional to \(a+b\), so we minimise \(a+b\) subject to \(F(a)-F(-b)=1-\alpha\) where \(F=F_{T_{n-1}}\). Differentiating the constraint, \(f(a)\,\d a+f(-b)\,\d b=0\), and \(\d(a+b)=\d a+\d b=\d a\,(1-f(a)/f(-b))\), which vanishes only if \(f(a)=f(-b)\). Since \(f_{T_{n-1}}\) is even and strictly decreasing on \((0,\infty)\), that means \(a=b\). The second-order condition is satisfied because moving away from \(a=b\) along the constraint curve lengthens the interval (the same argument as for the normal curve in Filling the gap 5.6). The interval is symmetric about \(\bar y\) and \(a=b=t_{\alpha/2,n-1}\).

One-sided intervals. Taking \(a=\infty\): \(\P\bigl(\mu\le\bar Y+t_{\alpha,n-1}S/\sqrt n\bigr)=\P(T\ge-t_{\alpha,n-1})=1-\alpha\), so \((-\infty,\ \bar y+t_{\alpha,n-1}s/\sqrt n)\) has confidence \(1-\alpha\), as in part (d) of Question 7.4.15 (\(t_{.05,20}=1.7247\) gives 95%). ∎

Case Study 7.4.1: how far away does a bat detect an insect? pp. 391–392

When a bat detects a flying insect the interval between its sound pulses shortens suddenly. From films of a bat in a room with fruit flies, the distance (cm) between bat and insect at that moment was estimated for each of \(n=11\) catches (Table 7.4.1: 62, 52, 68, 23, 34, 45, 27, 42, 83, 56, 40). The sums are \(\sum y_i=532\) and \(\sum y_i^2=29{,}000\), so \[ \bar y=\frac{532}{11}=48.4,\qquad s=\sqrt{\frac{11(29000)-532^2}{11\cdot10}}=18.1. \] Assuming normality, \((\bar Y-\mu)/(S/\sqrt{11})\sim T_{10}\) and \(t_{.025,10}=2.2281\), so a 95% interval for the mean detection distance \(\mu\) is \[ 48.4\pm2.2281\cdot\frac{18.1}{\sqrt{11}}=(36.2\text{ cm},\ 60.5\text{ cm}). \] (The book prints 60.6 for the upper endpoint, from the rounded inputs \(48.4\) and \(18.1\); with \(\bar y=48.364\) and \(s=18.085\) it is 60.51.) Data: Case Study 7.4.1. Python: t_interval in ch07_normal_inference.py.

Example 7.4.1: when the interval should not be trusted pp. 392–393

The list 2.5, 0.1, 0.2, 1.3, 3.2, 0.1, 0.1, 1.4, 0.5, 0.2, 0.4, 11.2, 0.4, 7.4, 1.8, 2.1, 0.3, 8.6, 0.3, 10.1 (\(n=20\)) has \(\bar y=2.61\) and \(s=3.62\) (the book rounds to 2.6 and 3.6). The same arithmetic as before gives \(2.6\pm2.0930\cdot3.6/\sqrt{20}=(0.9,\ 4.3)\), but this is not a 95% interval by Theorem 7.4.1: the histogram (Figure 7.4.3) is strongly skewed, so the normality that the theorem assumes is not credible, and the law of \((\bar Y-\mu)/(S/\sqrt{20})\) is not \(T_{19}\). The question left open is whether it is approximately \(T_{19}\), which is the question of robustness taken up at the end of the section and answered numerically in Filling the gap 7.12: for samples of 20 from a skewed (exponential) law, the nominal 95% \(t\) interval covers about 92% of the time.

A histogram of twenty observations: most between 0 and 3, with a long right tail up to about 11.
Figure 7.4.3. Histogram of the twenty observations of Example 7.4.1: strong right skew. Reproduces Larsen and Marx (2018), Figure 7.4.3. Code: ch07_normal_inference.py, fig_7_4_3.

Testing \(H_0\colon\mu=\mu_0\) (the one-sample \(t\) test)

p. 395 The \(t\) test for \(\mu\) is the \(z\) test of Theorem 6.2.1 with \(s\) in place of \(\sigma\), and the critical values taken from the \(t\) law with \(n-1\) degrees of freedom instead of the normal.

Theorem 7.4.2 (the one-sample \(t\) test) p. 395

Let \(y_1,\dots,y_n\) be a random sample from a normal law with \(\sigma\) unknown, and \(t=\dfrac{\bar y-\mu_0}{s/\sqrt n}\). At level \(\alpha\):

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

The book defers the proof to Appendix 7.A.2, which shows that the rule is the generalized likelihood ratio test of Section 6.5. That is one half of the story; the other half, that the rule really has size \(\alpha\), is a one-liner and is spelled out together with the \(P\)-value in Filling the gap 7.10. The GLRT derivation follows as Filling the gap 7.11.

See also (companion courses): Theorem 5.1 of the first-year advanced notes (exact size of the \(t\) tests and their equivalence with \(P\)-value rules) and Theorem 4.2 (tests and intervals are two views of one object).

Filling the gap 7.10: the \(t\) test has size exactly \(\alpha\); its \(P\)-value; the accepted values of \(\mu_0\) form the interval pp. 395, 400; Question 7.4.23

(a) Each rule of Theorem 7.4.2 has size exactly \(\alpha\) for every \(\sigma\). (b) The \(P\)-value of an observed \(t\) is \(\P(T_{n-1}\ge t)\) (one-sided) or \(2\P(T_{n-1}\ge|t|)\) (two-sided), and "reject at level \(\alpha\)" means "\(P\le\alpha\)". (c) The two-sided test accepts \(\mu_0\) if and only if \(\mu_0\) lies in the \(100(1-\alpha)\%\) interval of Theorem 7.4.1: the set of \(\mu_0\) not rejected at level \(\alpha\) is the confidence interval (Question 7.4.23).

Hint 1 of 4: the key idea

Under \(H_0\) the statistic has a known continuous law, so each rule's size is a tail area. For the interval, ask what the acceptance condition \(|\bar y-\mu_0|<t\,s/\sqrt n\) says about \(\mu_0\).

Hint 2 of 4: tools you will need
  • Theorem 7.3.5 and the symmetry of \(t_{n-1}\).
  • The P-value as the smallest level of rejection (gap 6.2).
  • Tests and intervals as two views of one object (Theorem 4.2).
Hint 3 of 4: step 1

For each of the three rules compute the probability of rejection when \(\mu=\mu_0\). Aim for: exactly \(\alpha\), for every \(\sigma\).

Hint 4 of 4: step 2

Solve the acceptance inequality for \(\mu_0\). Aim for: \(\bar y-ts/\sqrt n<\mu_0<\bar y+ts/\sqrt n\). Then test the three values in Question 7.4.23 against the interval \(58.667\pm2.2010\,(6.946)/\sqrt{12}\).

Proof

(a) If \(\mu=\mu_0\) then \(T=(\bar Y-\mu_0)/(S/\sqrt n)\sim T_{n-1}\) for every \(\sigma\) (Theorem 7.3.5), so \(\P(T\ge t_{\alpha,n-1})=\alpha\), \(\P(T\le-t_{\alpha,n-1})=\alpha\) by symmetry, and \(\P(|T|\ge t_{\alpha/2,n-1})=\alpha\). (Under a composite \(H_0\colon\mu\le\mu_0\) the size is still \(\alpha\), attained at \(\mu=\mu_0\), because the rejection probability increases with \(\mu\); see Filling the gap 7.17.) The proof is the one for the \(z\) test of Theorem 6.2.1, with a different curve.

(b) The \(P\)-value is the smallest level at which the data reject (Definition 6.2.4). For the right-sided test, \(t\ge t_{\alpha,n-1}\iff\P(T_{n-1}\ge t)\le\alpha\) because \(\alpha\mapsto t_{\alpha,n-1}\) is decreasing; the left-sided and two-sided cases are the same with the obvious tail, and \(P\) is uniform on \((0,1)\) under \(H_0\) as in Filling the gap 6.2.

(c) \(H_0\colon\mu=\mu_0\) is accepted \(\iff|\bar y-\mu_0|<t_{\alpha/2,n-1}\,s/\sqrt n\iff\bar y-t_{\alpha/2,n-1}s/\sqrt n<\mu_0<\bar y+t_{\alpha/2,n-1}s/\sqrt n\). For Example 7.4.2, \(\bar y=58.667\), \(s=6.946\), \(n=12\) and \(t_{.025,11}=2.2010\): the interval is \(58.667\pm2.2010\cdot6.946/\sqrt{12}=(54.25,\ 63.08)\). It contains 62, 61.7 and 58.6, so none of them is rejected, which is the answer to the question; a value such as 54 or 64 would be rejected. (The same duality, for any pivot, is Theorem 4.2 of the first-year notes.) ∎

Appendix 7.A.2: the one-sample \(t\) test is a GLRT

Theorem 7.A.2.1 (the one-sample \(t\) test is a GLRT) p. 416

The one-sample \(t\) test of Theorem 7.4.2 is a generalized likelihood ratio test: for \(H_0\colon\mu=\mu_0\) against \(H_1\colon\mu\ne\mu_0\), the ratio \(\lambda\) of Definition 6.5.2 is a strictly decreasing function of \(t^2\), so "\(\lambda\) small" and "\(|t|\) large" are the same rule.

Filling the gap 7.11: proof of Theorem 7.A.2.1, and the one-sided versions pp. 416–418

The book computes the generalized likelihood ratio of Section 6.5 for \(H_0\colon\mu=\mu_0\) against \(\mu\ne\mu_0\) and shows that it is a decreasing function of \(t^2\). It asserts the maximum likelihood estimates "can be readily shown" and treats only the two-sided case. Both are filled in here: the ratio is \(\lambda=(1+t^2/(n-1))^{-n/2}\), and for one-sided hypotheses the GLRT also becomes the one-sided \(t\) test.

Hint 1 of 5: the key idea

For fixed \(\mu\), the likelihood in \(\sigma^2\) is maximised in closed form. After that, the whole ratio depends on the data only through \(\sum(y_i-\mu)^2\). Which two values of \(\mu\) matter?

Hint 2 of 5: tools you will need
  • The normal MLEs (Example 5.2.5, gap 5.3).
  • The GLR and its monotone functions (gap 6.12).
  • \(\sum(y_i-\mu)^2=\sum(y_i-\bar y)^2+n(\bar y-\mu)^2\).
Hint 3 of 5: step 1

Maximise over \(\sigma^2\) for fixed \(\mu\), then over \(\mu\) in \(\omega\) and in \(\Omega\). Aim for: \(\lambda=[\sum(y_i-\bar y)^2/\sum(y_i-\mu_0)^2]^{n/2}\).

Hint 4 of 5: step 2

Use the identity with \(\mu=\mu_0\). Aim for: \(\lambda=(1+t^2/(n-1))^{-n/2}\), decreasing in \(t^2\), so reject for \(|t|\) large.

Hint 5 of 5: step 3

For \(H_0\colon\mu\le\mu_0\) find the constrained minimiser of \(n(\bar y-\mu)^2\) over \(\mu\le\mu_0\). Aim for: \(\lambda=1\) if \(\bar y\le\mu_0\), otherwise the same formula, so reject for \(t\) large.

Proof

For a sample from \(\N(\mu,\sigma^2)\) the likelihood is \(L(\mu,\sigma^2)=(2\pi\sigma^2)^{-n/2}\exp\{-\sum(y_i-\mu)^2/(2\sigma^2)\}\). Here \(\omega=\{\mu=\mu_0,\ \sigma^2>0\}\) and \(\Omega=\{\mu\in\mathbb R,\ \sigma^2>0\}\).

The maxima. For fixed \(\mu\), the log-likelihood \(-\frac n2\ln\sigma^2-\frac1{2\sigma^2}Q\) with \(Q=\sum(y_i-\mu)^2\) is maximised at \(\sigma^2=Q/n\) (set the derivative to 0; the second derivative is negative there, as in Filling the gap 5.3), where it equals \(-\frac n2\ln(Q/n)-\frac n2\) (up to the constant \(-\frac n2\ln2\pi\)). So the maximised likelihood is \(\bigl(2\pi eQ/n\bigr)^{-n/2}\), a decreasing function of \(Q\). Under \(\omega\), \(Q=\sum(y_i-\mu_0)^2\). Under \(\Omega\) we choose \(\mu\) to minimise \(Q\): by \(\sum(y_i-\mu)^2=\sum(y_i-\bar y)^2+n(\bar y-\mu)^2\) the minimum is at \(\mu=\bar y\), with \(Q=\sum(y_i-\bar y)^2\). Hence \[ \lambda=\frac{L(\hat\omega)}{L(\hat\Omega)}=\Bigl[\frac{\sum(y_i-\bar y)^2}{\sum(y_i-\mu_0)^2}\Bigr]^{n/2}. \] The ratio as a function of \(t\). The same identity with \(\mu=\mu_0\) gives \(\sum(y_i-\mu_0)^2=\sum(y_i-\bar y)^2+n(\bar y-\mu_0)^2\), and \(\sum(y_i-\bar y)^2=(n-1)s^2\). Therefore \[ \lambda=\Bigl[1+\frac{n(\bar y-\mu_0)^2}{(n-1)s^2}\Bigr]^{-n/2}=\Bigl(1+\frac{t^2}{n-1}\Bigr)^{-n/2},\qquad t=\frac{\bar y-\mu_0}{s/\sqrt n}. \] This is a strictly decreasing function of \(t^2\), so \(\lambda\le\lambda^*\iff t^2\ge c^2\) for a constant \(c\) determined by \(\lambda^*\), and the GLRT of size \(\alpha\) rejects when \(|t|\ge c\). Since \(T\sim T_{n-1}\) under \(H_0\), the size is \(\alpha\) exactly when \(c=t_{\alpha/2,n-1}\): the GLRT is the two-sided test of Theorem 7.4.2(c).

One-sided hypotheses. Test \(H_0\colon\mu\le\mu_0\) against \(H_1\colon\mu>\mu_0\). The maximised likelihood over \(\omega=\{\mu\le\mu_0\}\) uses the \(\mu\le\mu_0\) minimising \(Q\): if \(\bar y\le\mu_0\) this is \(\mu=\bar y\) and \(\lambda=1\); if \(\bar y>\mu_0\) the minimiser of the convex function \(n(\bar y-\mu)^2\) over \(\mu\le\mu_0\) is \(\mu_0\) and \(\lambda=(1+t^2/(n-1))^{-n/2}\) as before. So \(\lambda\) is a decreasing function of \(\max(t,0)\), and rejecting when \(\lambda\) is small means rejecting when \(t\) is large: the GLRT is the right-sided test of part (a), at level \(\alpha\) with the cut-off \(t_{\alpha,n-1}\) (for \(\alpha<\frac12\)). The left-sided case is the mirror image. ∎

Case Study 7.4.2: the golden rectangle and the Shoshoni pp. 396–397

A rectangle of width \(w\) and length \(l\) is "golden" if \(w/l=l/(w+l)\), that is \(w/l=\frac12(\sqrt5-1)=0.618\). Do people who never met Greek art prefer such rectangles? The width-to-length ratios of 20 beaded rectangles sewn by Shoshoni on blankets and clothes (Table 7.4.2) have mean 0.661 (more precisely 0.6605) and standard deviation 0.093 (0.0925). With \(H_0\colon\mu=0.618\) against \(H_1\colon\mu\ne0.618\) at \(\alpha=0.05\) the critical values are \(\pm t_{.025,19}=\pm2.0930\) and \[ t=\frac{0.661-0.618}{0.093/\sqrt{20}}=2.068\qquad(\text{from the unrounded data: }t=2.055). \] The statistic lies just inside the interval \((-2.0930,\,2.0930)\), so \(H_0\) is not rejected: the data do not rule out a Shoshoni preference for the golden ratio. The exact \(P\)-value is \(0.054\), only just above 0.05, so the verdict is fragile; "fail to reject" is not "accept" (Section 6.2). Data: Case Study 7.4.2. Python: t_test in ch07_normal_inference.py.

About the data (the book's aside): the golden ratio is the limit of the quotients of consecutive Fibonacci numbers, \(1/1\), \(1/2\), \(2/3\), \(3/5\), \(5/8\), \(8/13\), \(13/21\), and so on, which alternate above and below \(0.61803\ldots\).

Example 7.4.2: do three banks treat inner-city applicants differently? pp. 397–399

Rural residents were approved for 62% of home mortgage applications. The 12 inner-city branches of three banks (American United, Third Union, Federal Trust) had approval rates 59, 65, 69, 53, 60, 53, 58, 64, 46, 67, 51, 59 percent (Table 7.4.3). Test \(H_0\colon\mu=62\) against \(\mu\ne62\) at \(\alpha=0.05\): with \(\bar y=58.667\), \(s=6.946\), \(n=12\), \(t=(58.667-62)/(6.946/\sqrt{12})=-1.66\), and \(\pm t_{.025,11}=\pm2.2010\), so \(H_0\) is not rejected. Splitting by bank gives a different picture (Table 7.4.5):

Bank\(n\)\(\bar y\)\(s\)\(t\)critical valuereject \(H_0\)?
American United452.255.38−3.63±3.1825yes
Federal Trust558.803.96−1.81±2.7764no
Third Union367.002.00+4.33±4.3027yes

American United is significantly below the rural rate and Third Union significantly above it, so the two complaints are both justified, and they cancel in the pooled analysis. The lesson: pooling groups that differ in direction can hide the effects, because they cancel. A caution the book does not make: three tests at the 5% level, each on 3 to 5 observations, are a weak basis for conclusions about banks (and the \(t\) test assumes normality, which cannot be checked with three points). Data: Example 7.4.2. Python: t_test in ch07_normal_inference.py.

Testing \(H_0\colon\mu=\mu_0\) when the normality assumption is not met

pp. 400–403 Every \(t\) procedure assumes normal data. If the assumption fails, the law of \(T=(\bar Y-\mu_0)/(S/\sqrt n)\) is some other law \(f_{T^*}\), the probability of rejecting a true \(H_0\) is no longer the "nominal" \(\alpha\) we chose but a "true" \(\alpha\), \[ \text{true }\alpha=\int_{-\infty}^{-t_{\alpha/2,n-1}}f_{T^*}(t)\,\d t+\int_{t_{\alpha/2,n-1}}^\infty f_{T^*}(t)\,\d t, \] and the test is usable as long as the two are close. The book draws the two curves schematically (Figure 7.4.5, not redrawn here). There is no formula for \(f_{T^*}\), since it depends on the unknown sampled law, but it can be explored by simulation, and the book does so in Figure 7.4.6: one hundred samples of size 6 from the uniform law on \([0,1]\), the exponential law with \(\lambda=1\) and the Poisson law with mean 5, and one hundred samples of size 15 from the exponential law, each time computing \(\sqrt n(\bar y-\mu)/s\) with the true mean. The ratios from the uniform and Poisson samples follow \(f_{T_5}\) closely; for exponential samples with \(n=6\) very negative ratios are far too frequent and large positive ones too rare; at \(n=15\) the skewness is mostly gone. Figure 7.4.6 repeats the four experiments with 2000 samples each, so that the shapes are visible.

Four histograms of t ratios against the Student t density: uniform samples of size six (close fit), exponential samples of size six (long left tail, too few large positive values), Poisson samples of size six (close fit), exponential samples of size fifteen (much closer, still a little left-skewed).
Figure 7.4.6. Histograms of \(\sqrt n(\bar y-\mu)/s\) for 2000 samples from (a) the uniform, (b) the exponential and (c) the Poisson (mean 5) laws with \(n=6\), and (d) the exponential law with \(n=15\), against the \(t\) density that holds for normal data (values beyond the plotted range are in the end bins). The book uses 100 samples in each panel. Reproduces Larsen and Marx (2018), Figure 7.4.6. Code: ch07_normal_inference.py, fig_7_4_6.

Two general properties emerge: the law of \(T\) is relatively insensitive to the sampled law as long as that law is not too skewed and \(n\) is not too small, and it approaches \(f_{T_{n-1}}\) as \(n\) grows. A procedure that does not depend heavily on its assumptions is called robust, and the \(t\) test is robust in this sense. This matters a great deal in practice: if the law of the \(t\) ratio changed drastically with the unknown sampled law, we would never know whether a nominal 5% test had a true level near 5%.

▶ DemoHow robust is the t test? (exponential data, n = 6)New demo: draw thousands of samples from a chosen population, see the histogram of t ratios against the \(t\) curve, and read off the true level of the nominal 5% test, tail by tail. Preset 2 uniform, 4 Poisson, 5 exponential with \(n=15\), 6 lognormal with \(n=30\).

Filling the gap 7.12: why the \(t\) test is robust, how large the error is, and why exponential data give a left-skewed \(t\) ratio pp. 400–404; Questions 7.4.24 to 7.4.26

The book's evidence for robustness is a handful of simulations, and it says nothing about the true levels. Three things can be said. (a) Asymptotic validity (a theorem): for any sampled law with a finite variance the \(t\) ratio is asymptotically \(\N(0,1)\), so the true level tends to the nominal one. (Question 7.4.26: the \(t_{n-1}\) curve to which the simulated ratios converge is the standard normal.) (b) The rate is governed by skewness: to first order the true tail probabilities are off by an amount proportional to \(\gamma/\sqrt n\), with \(\gamma\) the skewness of the sampled law. (c) The direction: for right-skewed data the \(t\) ratio is left-skewed (Question 7.4.24).

Hint 1 of 5: the key idea

Two limits are at work: the central limit theorem for the numerator and the law of large numbers for \(S\). What combines them? And what does the skewness of the sampled law do to the correlation between \(\bar Y\) and \(S\)?

Hint 2 of 5: tools you will need
  • The CLT (gap 4.9), the strong law and Slutsky's theorem.
  • Convergence in distribution to a continuous limit is uniform (Pólya).
  • The first-order Edgeworth term for the studentised mean (Hall, 1992).
  • Simulation (the Python code, true_size).
Hint 3 of 5: step 1

Show \(S^2\to\sigma^2\) almost surely and apply Slutsky. Aim for: \(T\rightsquigarrow\N(0,1)\), hence true level \(\to\alpha\) as \(n\to\infty\), for every law with finite variance.

Hint 4 of 5: step 2

Read the Edgeworth term \(\tfrac{\gamma}{6\sqrt n}(2x^2+1)\varphi(x)\) at \(x=-t_{.025,29}\) with \(\gamma=2\). Aim for: a left-tail probability near 0.048, to compare with 0.064 simulated.

Hint 5 of 5: step 3

For the exponential law, find samples (all \(y_i\le\varepsilon\)) that force \(T\) to be very negative. Aim for: a long left tail, and an explanation of the short right tail from the positive correlation of \(\bar Y\) and \(S^2\).

Proof and numbers

(a) Let \(Y_i\) be iid with mean \(\mu\) and variance \(\sigma^2\in(0,\infty)\). By the central limit theorem, \(\sqrt n(\bar Y-\mu)/\sigma\rightsquigarrow\N(0,1)\). By the strong law of large numbers, \(\frac1n\sum Y_i^2\to\sigma^2+\mu^2\) and \(\bar Y\to\mu\) almost surely, so \(S^2=\frac n{n-1}\bigl(\frac1n\sum Y_i^2-\bar Y^2\bigr)\to\sigma^2\). By Slutsky's theorem the ratio \(T=\bigl[\sqrt n(\bar Y-\mu)/\sigma\bigr]\big/(S/\sigma)\rightsquigarrow\N(0,1)\). Because the limit law is continuous, the convergence of cdfs is uniform (Pólya's theorem), and \(t_{\alpha/2,n-1}\to z_{\alpha/2}\) (Filling the gap 7.7); hence \(\P(|T|\ge t_{\alpha/2,n-1})\to\alpha\). This is a statement about \(n\to\infty\) with the law fixed; it says nothing about a given \(n\), which is why the simulations matter.

(b) For a law with skewness \(\gamma=\E(Y-\mu)^3/\sigma^3\) (and a finite fourth moment, plus a smoothness condition), an Edgeworth expansion of the studentised mean (Hall, 1992) gives \[ \P(T\le x)=\Phi(x)+\frac{\gamma}{6\sqrt n}\,(2x^2+1)\varphi(x)+O(1/n). \] For a right-skewed law (\(\gamma>0\)) the left tail is therefore heavier than the normal (or \(t\)) tail and the right tail lighter. For the exponential law \(\gamma=2\); at \(n=30\) and \(x=-t_{.025,29}=-2.045\), the first-order term gives a left-tail probability \(0.0204+0.0281=0.048\), against 0.064 in a large simulation (the correction is large relative to \(\alpha/2=0.025\) and the next term is still not small).

(c) For the exponential law with \(\mu=1\) the ratio is \(T=\sqrt n(\bar Y-1)/S\). If all \(n\) observations are within \(\varepsilon\) of 0 (an event of probability \((1-e^{-\varepsilon})^n>0\)), then \(\bar Y\le\varepsilon\) while \(S\le\varepsilon\sqrt{n/(n-1)}\), so \(T\le-\sqrt{n-1}\,(1-\varepsilon)/\varepsilon\), which is as negative as we like. In the other direction a large positive \(\bar Y-1\) usually comes from a large observation, which inflates \(S\) as well, damping \(T\); for the exponential law the correlation between \(\bar Y\) and \(S^2\) is strongly positive (the breakdown of the independence of Theorem 7.3.2). The result is a long left tail and a short right tail: for \(n=6\), \(\P(T<-4)=0.052\) and \(\P(T>4)=0.0004\), and the mean (\(-0.62\)) is below the median (\(-0.16\)), both negative.

True levels. The table gives the true level of the nominal 5% two-sided \(t\) test (the sum of the two tail probabilities; the lower tail alone in brackets) from 100 000 simulated samples per entry. For normal data it is 0.050 up to simulation error. Uniform and Poisson data barely matter; the gamma law with shape 4.694 (the law of Section 7.6, skewness 0.92) costs a little; the exponential law (skewness 2) and the lognormal law with \(\sigma=1\) (skewness 6.2) are far off for small \(n\), and still off at \(n=30\). The nominal \(\alpha/2=0.025\) in each tail is never attained by skewed laws: the lower tail is too heavy and the upper too light, partly cancelling in the two-sided total. Read the bracketed figure against the nominal 0.025: the exponential law with \(n=6\) puts 0.111 in the lower tail, more than four times too much. Figure x7.1 plots the totals against \(n\).

population\(n=3\)\(n=6\)\(n=15\)\(n=30\)
normal0.051 (0.025)0.050 (0.025)0.050 (0.025)0.051 (0.026)
uniform(0,1)0.077 (0.039)0.061 (0.030)0.052 (0.026)0.052 (0.026)
Poisson(5)0.035 (0.023)0.055 (0.037)0.053 (0.034)0.050 (0.031)
gamma (4.694, 0.722)0.062 (0.048)0.065 (0.053)0.059 (0.047)0.056 (0.041)
exponential0.115 (0.109)0.114 (0.111)0.090 (0.085)0.071 (0.064)
lognormal (\(\sigma=1\))0.161 (0.159)0.176 (0.175)0.142 (0.141)0.117 (0.115)

True level of the nominal 5% two-sided \(t\) test, total (lower tail). Nominal: 0.050 (0.025). Source: true_size, 100 000 samples per entry. Samples with \(s=0\) (all values equal, possible only for Poisson data: about 1.9% of them at \(n=3\)) are left out; counting those with \(\bar y\ne5\) as rejections, as the test would, raises the Poisson entry at \(n=3\) to 0.048 (0.032).

(This also answers the open question after Example 7.4.1: for exponential samples of size 20, which look much like the data of that example, the nominal 95% interval covers about 92% of the time.) ∎

Curves of the true level of the nominal 5 percent two-sided t test against sample size from 3 to 100 for normal, uniform, exponential, Poisson and lognormal data; normal stays at 0.05, uniform and Poisson are close to it, exponential and lognormal are well above and decrease slowly.
Figure x7.1. The true level of the nominal 5% two-sided \(t\) test as a function of the sample size \(n\) for five sampled laws (20 000 samples per point; the grey band is the simulation error of the normal curve). Own figure. Code: ch07_normal_inference.py, fig_x7_1.

Whenever the data are far from normal and \(n\) is small, the book suggests the nonparametric tests of Chapter 14. A middle course is the bootstrap (Chapter 8 of the graduate course), which learns the law of the \(t\) ratio from the data themselves.

7.5 Drawing Inferences About \(\sigma^2\)

pp. 404–412 The mean is usually the target, because it carries the "effect" of a treatment. Sometimes the spread is just as important: the precision of an instrument, the volatility of a fund, the uniformity of a product. The tools are two facts from the previous sections: \(S^2\) is an unbiased estimator of \(\sigma^2\), and for normal data \((n-1)S^2/\sigma^2\) has the chi-square law with \(n-1\) degrees of freedom (Theorem 7.3.2). Together they give an interval and a test for \(\sigma^2\), in the same way that \(T_{n-1}\) gave an interval and a test for \(\mu\).

Chi-square tables

pp. 404–405 A chi-square curve is skewed (Figure 7.5.1, with 5 degrees of freedom), so a table must give cut-offs for both tails. By the book's convention the column headed \(p\) gives \(\chi^2_{p,n}\), the number with area \(p\) to its left under the \(\chi^2_n\) curve: \(\P(\chi^2_n\le\chi^2_{p,n})=p\). For 5 degrees of freedom \(\chi^2_{.05,5}=1.145\) and \(\chi^2_{.99,5}=15.086\), so 5% of the area lies below 1.145 and 1% above 15.086.

The chi-square density with 5 degrees of freedom, a right-skewed curve, with the area to the left of 1.145 shaded and labelled 0.05 and the area to the right of 15.086 shaded and labelled 0.01.
Figure 7.5.1. The \(\chi^2_5\) density: area 0.05 to the left of \(\chi^2_{.05,5}=1.145\) and area 0.01 to the right of \(\chi^2_{.99,5}=15.086\). Reproduces Larsen and Marx (2018), Figure 7.5.1. Code: ch07_normal_inference.py, fig_7_5_1.
df.01.025.05.10.90.95.975.99
10.00020.00100.00390.0162.7063.8415.0246.635
20.02010.05060.10260.2114.6055.9917.3789.210
30.1150.2160.3520.5846.2517.8159.34811.345
40.2970.4840.7111.0647.7799.48811.14313.277
50.5540.8311.1451.6109.23611.07012.83315.086
60.8721.2371.6352.20410.64512.59214.44916.812
71.2391.6902.1672.83312.01714.06716.01318.475
81.6462.1802.7333.49013.36215.50717.53520.090
92.0882.7003.3254.16814.68416.91919.02321.666
102.5583.2473.9404.86515.98718.30720.48323.209
113.0533.8164.5755.57817.27519.67521.92024.725
123.5714.4045.2266.30418.54921.02623.33726.217

Figure 7.5.2 (recomputed as a table). The percentiles \(\chi^2_{p,n}\) in the top rows of the book's chi-square table; the column is the left-hand area \(p\). Computed by ch07_normal_inference.py (scipy.stats.chi2.ppf); see Appendix Table A.3 for more rows.

Constructing confidence intervals for \(\sigma^2\)

p. 406 Since \((n-1)S^2/\sigma^2\sim\chi^2_{n-1}\), \[ \P\Bigl(\chi^2_{\alpha/2,n-1}\le\frac{(n-1)S^2}{\sigma^2}\le\chi^2_{1-\alpha/2,n-1}\Bigr)=1-\alpha,\tag{7.5.1} \] and inverting the inequalities to isolate \(\sigma^2\) gives the interval; the book leaves the algebra to the reader (Question 7.5.7), and it is done in Filling the gap 7.13.

Theorem 7.5.1 (intervals for \(\sigma^2\) and \(\sigma\)) p. 406

Let \(s^2\) be the sample variance of a random sample of size \(n\) from \(\N(\mu,\sigma^2)\). Then (a) a \(100(1-\alpha)\%\) confidence interval for \(\sigma^2\) is \[ \Bigl(\frac{(n-1)s^2}{\chi^2_{1-\alpha/2,n-1}},\ \frac{(n-1)s^2}{\chi^2_{\alpha/2,n-1}}\Bigr), \] and (b) a \(100(1-\alpha)\%\) interval for \(\sigma\) is \(\Bigl(\sqrt{\dfrac{(n-1)s^2}{\chi^2_{1-\alpha/2,n-1}}},\ \sqrt{\dfrac{(n-1)s^2}{\chi^2_{\alpha/2,n-1}}}\Bigr)\).

See also (companion courses): Theorem 3.6 of the first-year advanced notes proves the same theorem; the first-year demonstration (preset 6) shows what the variance interval does for skewed data (about 72% coverage at \(n=30\), against 93% for the \(t\) interval): the interval for \(\sigma^2\) is much less robust than the interval for \(\mu\), because it depends on the fourth moment of the sampled law (Filling the gap 7.12 explains why the mean is safe).

Filling the gap 7.13: inverting (7.5.1), exact coverage, and the shortest interval for \(\sigma^2\) pp. 406, 411; Questions 7.5.7 and 7.5.11

Besides the inversion left to the reader: (a) the interval has coverage exactly \(1-\alpha\) for all \((\mu,\sigma)\); (b) the chi-square law is not symmetric, so the equal-tailed interval is a convention, not the shortest interval: the shortest has cut-offs \(a<b\) with \(a^2f(a)=b^2f(b)\) (the \(\chi^2_{n+3}\) density takes equal values at \(a\) and \(b\)); (c) for \(\sigma\) itself the condition is \(a^{3/2}f(a)=b^{3/2}f(b)\) (the \(\chi^2_{n+2}\) density), and its solution coincides with the cut-offs of the exact likelihood ratio test. For \(n=19\) and 95% the equal-tailed cut-offs are \((8.231,\,31.526)\) and the shortest for \(\sigma^2\) are \((9.193,\,37.092)\), which makes the interval 9% shorter.

Hint 1 of 5: the key idea

The pivot \((n-1)S^2/\sigma^2\) is positive, so inequalities can be inverted. But the interval has a free choice of the two cut-offs \(a<b\) once the probability is fixed. What does its length depend on?

Hint 2 of 5: tools you will need
  • The \(\chi^2_{n-1}\) law of the pivot (Theorem 7.3.2; Theorem 3.6).
  • Constrained minimisation by differentiating the constraint.
  • The kernel \(u^{k/2-1}e^{-u/2}\) of the \(\chi^2_k\) density.
Hint 3 of 5: step 1

Invert \(\chi^2_{\alpha/2}\le(n-1)S^2/\sigma^2\le\chi^2_{1-\alpha/2}\) for \(\sigma^2\), then take square roots. Aim for: the intervals of Theorem 7.5.1, with exact coverage \(1-\alpha\).

Hint 4 of 5: step 2

Minimise \(1/a-1/b\) subject to \(F(b)-F(a)=1-\alpha\). Aim for: \(a^2f(a)=b^2f(b)\), which says the \(\chi^2_{n+3}\) density has equal height at \(a\) and \(b\).

Hint 5 of 5: step 3

Do the same for the width in \(\sigma\), \(a^{-1/2}-b^{-1/2}\). Aim for: \(a^{3/2}f(a)=b^{3/2}f(b)\), the \(\chi^2_{n+2}\) density. Then compare this equation, written as \(a^{n/2}e^{-a/2}=b^{n/2}e^{-b/2}\), with the cut-off equation of the likelihood ratio test (gap 7.15): for \(n=19\) both give \((8.969,\ 34.647)\).

Proof

(a) All quantities in (7.5.1) are positive, and \(x\mapsto1/x\) is decreasing on \((0,\infty)\), so \[ \chi^2_{\alpha/2}\le\frac{(n-1)S^2}{\sigma^2}\le\chi^2_{1-\alpha/2}\iff\frac{(n-1)S^2}{\chi^2_{1-\alpha/2}}\le\sigma^2\le\frac{(n-1)S^2}{\chi^2_{\alpha/2}}. \] The pivot \((n-1)S^2/\sigma^2\) has the \(\chi^2_{n-1}\) law whatever \(\mu\) and \(\sigma\) are, so the coverage is exactly \(1-\alpha\). Taking square roots (an increasing map) turns the interval for \(\sigma^2\) into one for \(\sigma\) with the same confidence. In practice \(\sigma\) is preferred because it is in the units of the data (Question 7.5.11), while \(\sigma^2\) is the natural parameter for the algebra.

(b) Any \(a<b\) with \(F(b)-F(a)=1-\alpha\), \(F=F_{\chi^2_{n-1}}\), gives a valid interval \(\bigl((n-1)s^2/b,\ (n-1)s^2/a\bigr)\), of length \((n-1)s^2\,(1/a-1/b)\). Minimise \(1/a-1/b\) under the constraint: differentiating, \(f(a)\,\d a=f(b)\,\d b\) and \(\d(1/a-1/b)=-\d a/a^2+\d b/b^2=\d a\,\bigl(-1/a^2+f(a)/(f(b)b^2)\bigr)\), which vanishes iff \(a^2f(a)=b^2f(b)\). Since \(a^2f_{n-1}(a)\propto a^{(n+3)/2-1}e^{-a/2}\) is proportional to the \(\chi^2_{n+3}\) density, the condition says that the \(\chi^2_{n+3}\) density takes the same value at \(a\) and at \(b\). The length tends to infinity at both ends of the admissible family (\(a\to0\) or \(b\to\infty\)), so the stationary point is the minimum. For \(\sigma\), the length is proportional to \(a^{-1/2}-b^{-1/2}\) and the same computation gives \(a^{3/2}f(a)=b^{3/2}f(b)\), the \(\chi^2_{n+2}\) density.

(c) For \(n=19\), \(\alpha=0.05\): solving numerically, the equal-height points of \(\chi^2_{22}\) with total outside mass 0.05 are \(a=9.193\), \(b=37.092\), against \(8.231\) and \(31.526\) for equal tails; the lengths are \(18(1/9.193-1/37.092)s^2=1.47s^2\) and \(18(1/8.231-1/31.526)s^2=1.62s^2\). For \(\sigma\) itself the condition \(a^{3/2}f(a)=b^{3/2}f(b)\) reads \(a^{n/2}e^{-a/2}=b^{n/2}e^{-b/2}\), which is the equation \(ae^{-a/n}=be^{-b/n}\) of the exact likelihood ratio test (raise it to the power \(n/2\), Filling the gap 7.15); since the interval of confidence \(1-\alpha\) and the test of size \(\alpha\) both leave probability \(\alpha\) outside \((a,b)\), the two pairs of equations are the same: the shortest interval for \(\sigma\) has the cut-offs \((8.969,\ 34.647)\) of the GLRT. For Case Study 7.5.1 (\(s^2=733.4\)) it is \((19.5,\ 38.4)\) million years, against the book's equal-tailed \((20.5,\ 40.0)\), about 4% shorter; the square roots of the shortest interval for \(\sigma^2\) give \((18.9,\ 37.9)\), which is longer (19.0 against 18.8 million years): the shortest interval for \(\sigma^2\) does not map to the shortest interval for \(\sigma\). The equal-tailed interval is the standard one (tables give its cut-offs), and the saving is modest; the point is that the choice is a convention. ∎

Case Study 7.5.1: how precise is potassium–argon dating? pp. 406–407

A rock's age can be estimated from the ratio of potassium-40 to its decay product argon-40. To measure the precision of the method, nineteen minerals from the Black Forest, all of the same age, were dated (Table 7.5.1: 249, 254, 243, 268, 253, 269, 287, 241, 273, 306, 303, 280, 260, 256, 278, 344, 304, 283, 310 million years); the variation from rock to rock reflects the method's precision \(\sigma\). With \(\sum y_i=5261\) and \(\sum y_i^2=1{,}469{,}945\), \[ s^2=\frac{19(1469945)-5261^2}{19\cdot18}=733.4,\qquad s=27.1. \] The \(\chi^2_{18}\) percentiles are \(\chi^2_{.025,18}=8.23\) and \(\chi^2_{.975,18}=31.53\), so a 95% interval for \(\sigma\) is \[ \Bigl(\sqrt{\tfrac{18(733.4)}{31.53}},\ \sqrt{\tfrac{18(733.4)}{8.23}}\Bigr)=(20.5\text{ million years},\ 40.0\text{ million years}). \] The interval is wide (a factor 2 from end to end) because 19 observations pin down a standard deviation only roughly. Data: Case Study 7.5.1. Python: var_interval in ch07_normal_inference.py.

▶ DemoInference about a variance (Case Study 7.5.1)New demo: the chi-square curve with its cut-offs, the interval for \(\sigma^2\) and \(\sigma\), and the coverage over repeated samples. Preset 2 is Case Study 7.5.2, 3 the width problem of Example 7.5.1, 4 three ways to choose the cut-offs, 5 the shortest interval.

Example 7.5.1: how many observations for an interval of reasonable width? pp. 408

The width of the interval is a function of \(n\) and \(s^2\): \[ \text{width}=(n-1)S^2\Bigl(\frac1{\chi^2_{\alpha/2,n-1}}-\frac1{\chi^2_{1-\alpha/2,n-1}}\Bigr).\tag{7.5.2} \] What is the smallest \(n\) for which the expected width of a 95% interval for \(\sigma^2\) is at most \(\sigma^2\)? Since \(\E S^2=\sigma^2\), the expected width is \(r(n)\,\sigma^2\), and we need \(r(n)\le1\), where \[ r(n)=(n-1)\Bigl(\frac1{\chi^2_{.025,n-1}}-\frac1{\chi^2_{.975,n-1}}\Bigr). \] The trial-and-error table is

\(n\)\(\chi^2_{.025,n-1}\)\(\chi^2_{.975,n-1}\)\(r(n)\)
155.62926.1191.95
208.90732.8521.55
3016.04745.7221.17
3822.10655.6681.01
3922.87856.8950.99

(Table 7.5.2.) So \(n=39\) is the smallest sample size that does it. Python: smallest_n_width in ch07_normal_inference.py.

Filling the gap 7.14: the width problem of Example 7.5.1 p. 408

The book finds \(n=39\) by trial and error and does not say why the search can stop there. (a) The width (7.5.2) is exactly proportional to \(S^2\), so \(\E(\text{width})=r(n)\sigma^2\) needs only \(\E S^2=\sigma^2\); compare the \(t\) interval, whose width is proportional to \(S\) and so involves the bias factor \(c_n\) (Filling the gap 7.1). (b) \(r(n)\) decreases with \(n\); its values for \(n\le38\) all exceed 1 and \(r(39)=0.993\). (c) The first-order formula \(r(n)\approx2z_{.025}\sqrt{2/(n-1)}\) would stop at \(n\approx32\); the exact answer 39 is larger because of the skewness of the chi-square law.

Hint 1 of 5: the key idea

The width is a constant times \(S^2\). What does this make of the expected width, and what makes it easy to search over \(n\)?

Hint 2 of 5: tools you will need
  • \(\E S^2=\sigma^2\) (Example 5.4.4).
  • Chi-square quantiles from software or tables.
  • The normal approximation \(\chi^2_{p,m}\approx m+z_p\sqrt{2m}\) (gap 7.3).
Hint 3 of 5: step 1

Write the width as \(\kappa_nS^2\) and take the expectation. Aim for: \(\E(\text{width})=\kappa_n\sigma^2\), free of \(\sigma\) and \(\mu\).

Hint 4 of 5: step 2

Evaluate \(\kappa_n\) for consecutive \(n\) around 38. Aim for: \(1.009\) at \(n=38\) and \(0.993\) at \(n=39\).

Hint 5 of 5: step 3

Replace the quantiles by their normal approximations. Aim for: \(\kappa_n\approx2(1.96)\sqrt{2/(n-1)}\), suggesting \(n\approx32\). Why is the exact answer larger?

Proof

(a) By (7.5.2) the width is the constant \(\kappa_n=(n-1)(1/\chi^2_{\alpha/2,n-1}-1/\chi^2_{1-\alpha/2,n-1})\) times \(S^2\), so \(\E(\text{width})=\kappa_n\E S^2=\kappa_n\sigma^2\) and the condition \(\E(\text{width})\le\sigma^2\) is \(\kappa_n\le1\), with \(\kappa_n=r(n)\), a number that does not depend on \(\sigma\) or \(\mu\).

(b) For the stopping rule one needs \(r(n)\le1\) for all \(n\ge39\) and \(r(n)>1\) for \(n\le38\). Exact evaluation (expected_width_ratio) for \(n=2,\dots,300\) shows that \(r\) decreases at every step (\(r(38)=1.0091\), \(r(39)=0.9931\), \(r(60)=0.769\)); this is a computation, not a proof of monotonicity, but it is all the question needs.

(c) By the asymptotic normality of \(\chi^2_{n-1}\) (Filling the gap 7.3), \(\chi^2_{.025,n-1}\approx(n-1)-1.96\sqrt{2(n-1)}\) and \(\chi^2_{.975,n-1}\approx(n-1)+1.96\sqrt{2(n-1)}\), so \(r(n)\approx\dfrac{2(1.96)\sqrt{2(n-1)}}{(n-1)\,[1-1.96^2\cdot2/(n-1)]}\), whose leading term is \(2(1.96)\sqrt{2/(n-1)}\). Setting this equal to 1 gives \(n-1\approx8(1.96)^2=30.7\), \(n\approx32\). The exact table gives \(r(32)=1.12\): the lower cut-off is smaller than the normal approximation says (the \(\chi^2\) law has a short left tail and a long right tail), which makes \(1/\chi^2_{\alpha/2}\) larger. Figure x7.3 shows \(r(n)\) and the corresponding curve for the shortest interval of Filling the gap 7.13. ∎

Two decreasing curves of the expected width of the 95 percent interval for sigma squared divided by sigma squared against the sample size n from 5 to 79; the curve for the shortest interval lies below the equal-tailed one; both pass through 1 near n equals 39 and 35.
Figure x7.3. Expected width of the 95% interval for \(\sigma^2\), in units of \(\sigma^2\), as a function of \(n\): equal-tailed (Theorem 7.5.1) and shortest (Filling the gap 7.13). The equal-tailed curve crosses 1 at \(n=39\) (Example 7.5.1). Own figure. Code: ch07_normal_inference.py, fig_x7_3.
▶ DemoExpected width of the interval for \(\sigma^2\) (Example 7.5.1)Move \(n\) and see \(r(n)\) cross 1 at \(n=39\) for the equal-tailed interval.

Testing \(H_0\colon\sigma^2=\sigma_0^2\)

pp. 408–410 The generalized likelihood ratio of Section 6.5 gives tests for \(\sigma^2\). The complete derivation is in Appendix 7.A.3 (given below, in Filling the gap 7.15); Theorem 7.5.2 states the rule. The statistic is the chi-square ratio that served for the interval, evaluated at \(\sigma_0^2\).

Theorem 7.5.2 (tests for \(\sigma^2\)) p. 409

Let \(s^2\) be the sample variance of a random sample of size \(n\) from \(\N(\mu,\sigma^2)\) and \(\chi^2=(n-1)s^2/\sigma_0^2\). At level \(\alpha\):

  1. to test \(H_0\colon\sigma^2=\sigma_0^2\) against \(H_1\colon\sigma^2>\sigma_0^2\), reject \(H_0\) if \(\chi^2\ge\chi^2_{1-\alpha,n-1}\);
  2. against \(H_1\colon\sigma^2<\sigma_0^2\), reject if \(\chi^2\le\chi^2_{\alpha,n-1}\);
  3. against \(H_1\colon\sigma^2\ne\sigma_0^2\), reject if \(\chi^2\le\chi^2_{\alpha/2,n-1}\) or \(\chi^2\ge\chi^2_{1-\alpha/2,n-1}\).

Each rule has size exactly \(\alpha\): under \(H_0\), \((n-1)S^2/\sigma_0^2\sim\chi^2_{n-1}\), and the cut-offs are the quantiles that leave the stated areas in the stated tails. (For the composite hypotheses \(\sigma^2\le\sigma_0^2\) and \(\sigma^2\ge\sigma_0^2\) the size is attained at \(\sigma_0^2\), see Filling the gap 7.16.)

Appendix 7.A.3: a proof of Theorem 7.5.2

pp. 418–420 The book computes the GLR for the two-sided problem, finds that it is a function of \(x=\hat\sigma^2/\sigma_0^2\) that falls below a cut-off exactly when \(x\) is near 0 or large (Figure 7.A.3.1), and then makes "a slight approximation": it splits \(\alpha\) equally between the tails. The figures are drawn schematically in the book; here they are computed for \(n=19\) and \(\alpha=0.05\) (the setting of Case Study 7.5.2).

The curve y equals x times e to the minus x, rising to a maximum of 0.37 at x equals 1 and then falling; a horizontal dashed line at height k star meets it at points a and b, and the regions x below a and x above b are labelled reject.
Figure 7.A.3.1. The likelihood ratio \(\lambda=x^{n/2}e^{-(n/2)x+n/2}\) is small exactly when \(y=xe^{-x}\) is small, that is when \(x=\hat\sigma^2/\sigma_0^2\) is below \(a\) or above \(b\). Here \(n=19\), \(\alpha=0.05\), and \(a=0.472\), \(b=1.824\) are the exact size-\(\alpha\) cut-offs. Reproduces Larsen and Marx (2018), Figure 7.A.3.1 (computed rather than sketched). Code: ch07_normal_inference.py, fig_7_A_3_1.
The chi-square density with 18 degrees of freedom with both tails shaded: the area left of 8.23 and the area right of 31.53, each 2.5 percent, labelled reject.
Figure 7.A.3.2. The two-sided rule of Theorem 7.5.2(c) for \(n=19\), \(\alpha=0.05\): reject when \((n-1)s^2/\sigma_0^2\) is below \(\chi^2_{.025,18}=8.23\) or above \(\chi^2_{.975,18}=31.53\), 2.5% in each tail. Reproduces Larsen and Marx (2018), Figure 7.A.3.2. Code: ch07_normal_inference.py, fig_7_A_3_2.

Filling the gap 7.15: the likelihood ratio test for \(\sigma^2\) in full, what the book's "slight approximation" costs, and the unbiased test pp. 418–420

The exact generalized likelihood ratio test of size \(\alpha\) has unequal tail probabilities; the rule of Theorem 7.5.2 (equal tails) is a different test. For \(n=19\) and \(\alpha=0.05\):

testreject if \(\chi^2\le\)or \(\chi^2\ge\)area in lower tailarea in upper tailsmallest power
equal tails (Theorem 7.5.2c)8.23131.5260.02500.02500.0486
exact GLRT8.96934.6470.03950.01050.0472
unbiased test8.58432.6070.03140.01860.0500

"Smallest power" is the minimum over \(\sigma^2\) of the probability of rejecting; a value below \(\alpha=0.05\) means the test is slightly biased (it rejects a false \(H_0\) with smaller probability than a true one for some \(\sigma^2\)). The differences are small in practice, but the GLRT's 4% and 1% tails show the book's phrase "numerically close" is generous. All three rules reject for large and small variances and have size exactly 0.05.

Hint 1 of 5: the key idea

After maximising out \(\mu\), the likelihood ratio depends on the data only through \(x=\hat\sigma^2/\sigma_0^2\), through the function \(xe^{-x}\). That function is not monotone. Where is it small?

Hint 2 of 5: tools you will need
  • The normal MLEs (Example 5.2.5) and the GLR (Definition 6.5.2).
  • Shape of \(xe^{-x}\): increasing on \((0,1)\), decreasing after.
  • The power function \(\pi(\rho)=F(c_1\rho)+1-F(c_2\rho)\).
  • Root-finding for the cut-offs.
Hint 3 of 5: step 1

Compute \(\lambda=x^{n/2}e^{-nx/2+n/2}\) and the rejection set \(\{x\le a\}\cup\{x\ge b\}\) with \(ae^{-a}=be^{-b}\). Aim for: for \(n=19\), \(\alpha=0.05\), tails near 0.040 and 0.010, not 0.025 each.

Hint 4 of 5: step 2

Differentiate \(\pi(\rho)\) at \(\rho=1\) and demand zero. Aim for: \(c_1f(c_1)=c_2f(c_2)\), equal height of the \(\chi^2_{n+1}\) density; check that the equal-tailed rule violates it.

Hint 5 of 5: step 3

For the one-sided hypothesis \(\sigma^2\ge\sigma_0^2\), maximise over \(\sigma^2\ge\sigma_0^2\). Aim for: \(\lambda=1\) for \(x\ge1\) and \(\lambda\) increasing in \(x\) on \((0,1)\), so reject for small \(\chi^2\).

Proof

The ratio. With \(\omega=\{\sigma^2=\sigma_0^2\}\) and \(\Omega\) the full space, the maximum likelihood estimate of \(\mu\) is \(\bar y\) in both (Example 5.2.5); in \(\omega\), \(\hat\sigma^2=\sigma_0^2\), and in \(\Omega\), \(\hat\sigma^2=\sigma_e^2=\frac1n\sum(y_i-\bar y)^2\). Put \(Q=\sum(y_i-\bar y)^2\). The maximised likelihoods are \[ L(\hat\omega)=(2\pi\sigma_0^2)^{-n/2}e^{-Q/(2\sigma_0^2)},\qquad L(\hat\Omega)=(2\pi\sigma_e^2)^{-n/2}e^{-n/2},\qquad\lambda=\Bigl(\frac{\sigma_e^2}{\sigma_0^2}\Bigr)^{n/2}\exp\Bigl\{-\frac n2\frac{\sigma_e^2}{\sigma_0^2}+\frac n2\Bigr\}=x^{n/2}e^{-nx/2+n/2} \] with \(x=\sigma_e^2/\sigma_0^2=\chi^2/n\) and \(\chi^2=(n-1)s^2/\sigma_0^2\). So \(\lambda\le\lambda^*\iff xe^{-x}\le k^*=(\lambda^*)^{2/n}e^{-1}\). The function \(y=xe^{-x}\) increases on \((0,1)\), has its maximum \(e^{-1}\) at \(x=1\) and decreases on \((1,\infty)\) (Figure 7.A.3.1), so \(\{xe^{-x}\le k^*\}=\{x\le a\}\cup\{x\ge b\}\) with \(a<1<b\) and \(ae^{-a}=be^{-b}=k^*\).

The exact cut-offs. The size is \(\P(\chi^2_{n-1}\le na)+\P(\chi^2_{n-1}\ge nb)\), and the GLRT of size \(\alpha\) is the pair \((a,b)\) with \(ae^{-a}=be^{-b}\) and size \(\alpha\) (two equations for the two unknowns: the first gives \(b\) as a function of \(a\), and the size is then a monotone function of \(a\), so a single root-finding step solves it). For \(n=19\), \(\alpha=0.05\) this gives \(na=8.969\), \(nb=34.647\), with tail areas 0.0395 and 0.0105. Nothing forces the two tails to be equal, and they are not. The book instead takes each tail to have area \(\alpha/2\), the cut-offs \(\chi^2_{\alpha/2,n-1}\), \(\chi^2_{1-\alpha/2,n-1}\) (8.231, 31.526), and calls the result the GLRT. It is a perfectly good size-\(\alpha\) test (it is what the tables are laid out for) but it is not the likelihood ratio test.

The unbiased test. The power at \(\sigma^2=\sigma_0^2/\rho\) of a rule with cut-offs \((c_1,c_2)\) is \(\pi(\rho)=F(c_1\rho)+1-F(c_2\rho)\) with \(F=F_{\chi^2_{n-1}}\), since \((n-1)S^2/\sigma_0^2=\chi^2_{n-1}/\rho\). An unbiased test has its minimum at \(\rho=1\), so \(\pi'(1)=c_1f(c_1)-c_2f(c_2)=0\); \(c\,f_{n-1}(c)\propto c^{(n+1)/2-1}e^{-c/2}\) is proportional to the \(\chi^2_{n+1}\) density, so the condition is "equal height of \(\chi^2_{n+1}\) at \(c_1\) and \(c_2\)" together with size \(\alpha\). For \(n=19\) this gives \((8.584,\ 32.607)\), with tails 0.0314 and 0.0186. For the equal-tailed rule, \(c_1f(c_1)=0.137\) while \(c_2f(c_2)=0.213\), so \(\pi'(1)<0\): the power is still falling as \(\sigma^2\) moves just below \(\sigma_0^2\), and it dips slightly under \(\alpha\). Its minimum is 0.0486, at \(\sigma^2=0.96\sigma_0^2\).

One-sided tests. For \(H_0\colon\sigma^2\ge\sigma_0^2\) against \(H_1\colon\sigma^2<\sigma_0^2\) the restricted maximum is at \(\hat\sigma^2=\max(\sigma_e^2,\sigma_0^2)\), so \(\lambda=1\) when \(x\ge1\) and \(\lambda=x^{n/2}e^{-nx/2+n/2}\), increasing in \(x\) on \((0,1)\), when \(x<1\). Small \(\lambda\) therefore means small \(x\), that is small \(\chi^2\), and the size-\(\alpha\) rule is "reject if \(\chi^2\le\chi^2_{\alpha,n-1}\)" (part (b) of the theorem). Part (a) is the mirror image, using the decrease of \(xe^{-x}\) beyond 1. ∎

Case Study 7.5.2: is a mutual fund's volatility really lower? pp. 409–410

The Global Rock Fund claimed less volatility than the Lipper Average over 1989–2007. Its 19 annual returns have sample standard deviation \(s=11.28\%\), against the benchmark's known 11.67%. With \(H_0\colon\sigma^2=11.67^2\) and \(H_1\colon\sigma^2<11.67^2\), \(\alpha=0.05\), the cut-off is \(\chi^2_{.05,18}=9.390\) and \[ \chi^2=\frac{(19-1)(11.28)^2}{(11.67)^2}=16.82, \] which is not \(\le9.390\), so \(H_0\) is not rejected (Figure 7.5.3). The \(P\)-value is \(\P(\chi^2_{18}\le16.82)=0.464\). The data do not show that the fund is less volatile than the benchmark. Data: Case Study 7.5.2. Python: var_test in ch07_normal_inference.py.

The chi-square density with 18 degrees of freedom; the area to the left of 9.390 is shaded and labelled reject, and a vertical line at the observed value 16.82 lies well to the right of the rejection region.
Figure 7.5.3. The \(\chi^2_{18}\) density of Case Study 7.5.2: the rejection region is the left 5%, \(\chi^2\le9.390\); the observed \(\chi^2=16.82\) falls outside. Reproduces Larsen and Marx (2018), Figure 7.5.3. Code: ch07_normal_inference.py, fig_7_5_3.
▶ DemoTesting a variance (Case Study 7.5.2)The observed \(\chi^2=16.82\) against the cut-off 9.390, the \(P\)-value and the power curve of the test.

Filling the gap 7.16: the power of the chi-square test, and what "do not reject" means in Case Study 7.5.2 pp. 409–410

The book reports "do not reject" and stops. Fill the gap with the power function: for the left-sided test the probability of rejecting when \(\sigma^2=\theta\sigma_0^2\) is \(\pi(\theta)=\P\bigl(\chi^2_{n-1}\le\chi^2_{\alpha,n-1}/\theta\bigr)\), decreasing in \(\theta\) (so the size over \(H_0\colon\sigma^2\ge\sigma_0^2\) is \(\alpha\), attained at \(\theta=1\)); the right-sided test has \(\pi(\theta)=\P(\chi^2_{n-1}\ge\chi^2_{1-\alpha,n-1}/\theta)\). For Case Study 7.5.2 the observed ratio of variances is \(\theta=(11.28/11.67)^2=0.934\), at which the test with \(n=19\) has power only 0.070: it would almost never detect a reduction of this size. For power 0.8 against \(\theta=0.934\) one would need about 2700 years of returns (\(n=2674\) with \(\theta\) rounded to 0.934, \(n=2697\) with the unrounded ratio).

Hint 1 of 4: the key idea

Under \(\sigma^2=\theta\sigma_0^2\) the test statistic is a multiple of an exact chi-square variable. Rewrite the rejection event in terms of that variable.

Hint 2 of 4: tools you will need
  • \((n-1)S^2/\sigma^2\sim\chi^2_{n-1}\) (Theorem 7.3.2).
  • The chi-square cdf from tables or software.
  • The power function and the size of a composite test (gap 6.7).
Hint 3 of 4: step 1

Show \((n-1)S^2/\sigma_0^2=\theta\,\chi^2_{n-1}\) and rewrite \(\{\chi^2\le\chi^2_{\alpha,n-1}\}\). Aim for: \(\pi(\theta)=F_{\chi^2_{n-1}}(\chi^2_{\alpha,n-1}/\theta)\), decreasing in \(\theta\).

Hint 4 of 4: step 2

Evaluate at \(\theta=(11.28/11.67)^2\) for \(n=19\). Aim for: power about 0.07. What does that say about the verdict 'do not reject'?

Proof

When \(\sigma^2=\theta\sigma_0^2\), \((n-1)S^2/\sigma_0^2=\theta\cdot(n-1)S^2/\sigma^2=\theta\chi^2_{n-1}\) (Theorem 7.3.2). The left-sided rule rejects when this is at most \(\chi^2_{\alpha,n-1}\), that is when \(\chi^2_{n-1}\le\chi^2_{\alpha,n-1}/\theta\), with probability \(F_{\chi^2_{n-1}}(\chi^2_{\alpha,n-1}/\theta)\). This is decreasing in \(\theta\), equal to \(\alpha\) at \(\theta=1\) and tends to 1 as \(\theta\to0\). Similarly for the right-sided rule. Evaluating: with \(n=19\), \(\chi^2_{.05,18}=9.390\) and \(\theta=0.934\), \(\pi=F_{\chi^2_{18}}(10.05)=0.070\); with \(\theta=0.5\) (the standard deviation cut by 29%) the power is \(F_{\chi^2_{18}}(18.78)=0.59\), and \(n=30\) observations would give 80%. Finding the smallest \(n\) with \(\pi\ge0.8\) is a search over \(n\), as in Example 7.5.1 (chi2_power in the Python module). The moral is the one of Section 6.6: failing to reject is not evidence that the fund is no better than the benchmark, because with this sample size the test could not have found a modest improvement; the interval for \(\sigma\), which is wide, says the same thing more honestly. ∎

7.6 Taking a Second Look at Statistics (Type II Error)

pp. 412–414 For normal data with \(\sigma\) known, both error probabilities can be computed within the normal family (Example 6.4.1). When \(\sigma\) is not known the Type I error is still easy (the \(t\) cut-offs make it \(\alpha\)), but what is the Type II error? For \(H_0\colon\mu=\mu_0\) against \(H_1\colon\mu>\mu_0\) the test rejects when \((\bar Y-\mu_0)/(S/\sqrt n)\ge t_{\alpha,n-1}\), and the probability of a Type II error at a true mean \(\mu_1>\mu_0\) is \(\beta=\P\bigl(T_0<t_{\alpha,n-1}\bigr)\) with \(T_0=\frac{\bar Y-\mu_0}{S/\sqrt n}\). But \(\mu_0\) is not the mean of \(\bar Y\) under the alternative, so the ratio does not have the \(t\) law. The algebra that identifies its law: \[ \frac{\bar Y-\mu_0}{S/\sqrt n}=\frac{(\bar Y-\mu_1)+(\mu_1-\mu_0)}{S/\sqrt n}=\frac{\dfrac{\bar Y-\mu_1}{\sigma/\sqrt n}+\dfrac{\mu_1-\mu_0}{\sigma/\sqrt n}}{S/\sigma}=\frac{Z+\delta}{\sqrt{U/(n-1)}}, \] where \(Z=(\bar Y-\mu_1)/(\sigma/\sqrt n)\) is standard normal, \(U=(n-1)S^2/\sigma^2\) is chi-square with \(n-1\) degrees of freedom, independent of \(Z\), and \(\delta=(\mu_1-\mu_0)/(\sigma/\sqrt n)\) is a constant. It differs from a \(t\) variable only by the additive \(\delta\) in the numerator, but that changes the law considerably: it is called the noncentral \(t\) distribution with \(n-1\) degrees of freedom and noncentrality parameter \(\delta\). Its density is known but complicated; software (here scipy.stats.nct) provides its cdf. Because \(\sigma\) is unknown so is \(\delta\); one specifies the shift in standard-deviation units, \((\mu_1-\mu_0)/\sigma\), and may approximate it by \((\mu_1-\mu_0)/s\).

Example 7.6.1: the Type II error of a \(t\) test p. 413

Test \(H_0\colon\mu=\mu_0\) against \(H_1\colon\mu>\mu_0\) at \(\alpha=0.05\) with \(n=20\): reject if \((\bar y-\mu_0)/(s/\sqrt{20})\ge t_{.05,19}=1.7291\). What is \(\beta\) if the mean is half a standard deviation above \(\mu_0\)? Then \((\mu_1-\mu_0)/\sigma=0.5\), the noncentrality is \(\delta=0.5\sqrt{20}=2.236\), and \[ \beta=\P(T_{19,\,2.236}\le1.7291)=0.3048\approx0.305, \] from the cdf of the noncentral \(t\) with 19 degrees of freedom and noncentrality 2.236 (the book prints 0.304828, from 1.729). The power is \(0.695\). For comparison the \(z\) test with \(\sigma\) known and the same \(n\), \(\alpha\) and shift has \(\beta=0.277\): not knowing \(\sigma\) costs about 3 points of power. Python: t_beta and t_power in ch07_normal_inference.py.

▶ DemoPower and sample size (first-year demo)Set \(d=0.5\), \(n=20\), \(\alpha=0.05\), one-sided: the demonstration draws the power curve of the \(t\) test (noncentral \(t\)) beside the \(z\) test, and reports the sample sizes for a target power (\(n=25\) for \(z\), \(27\) for \(t\) at 80%). The default is \(n=25\); move the slider to 20 for Example 7.6.1.

Filling the gap 7.17: the noncentral \(t\) law, the power of the \(t\) test and the sample size pp. 412–413; Example 7.6.1

Claims. (a) Under \(\mu=\mu_1\), \(T=(\bar Y-\mu_0)/(S/\sqrt n)\) has the law of \((Z+\delta)/\sqrt{U/\nu}\), \(\nu=n-1\), \(\delta=\sqrt n(\mu_1-\mu_0)/\sigma\), and its cdf is \[ \P(T\le t)=\int_0^\infty\Phi\bigl(t\sqrt{u/\nu}-\delta\bigr)f_{\chi^2_\nu}(u)\,\d u. \] (b) Its mean is \(\delta\sqrt{\nu/2}\,\Gamma(\frac{\nu-1}2)/\Gamma(\frac\nu2)\) for \(\nu>1\). (c) The power of the \(t\) test depends on \((\mu_1,\sigma)\) only through \(d=(\mu_1-\mu_0)/\sigma\) and \(n\), and increases with \(d\). (d) The \(t\) test has less power than the \(z\) test at the same \(n\), \(\alpha\) and \(d\), so it needs a larger sample for a given power (numerically, not by a general proof). For Example 7.6.1, \(\beta=0.3048\); for power 0.80 at \(d=0.5\), \(\alpha=0.05\) (one-sided) the \(z\) test needs \(n=25\) and the \(t\) test \(n=27\).

Hint 1 of 5: the key idea

Under the alternative, the numerator of the \(t\) ratio is still normal but with a nonzero mean, while the denominator is unchanged. Condition on the denominator: what is left?

Hint 2 of 5: tools you will need
  • Independence of \(\bar Y\) and \(S^2\) (Theorem 7.3.2).
  • The conditional cdf \(\Phi(t\sqrt{u/\nu}-\delta)\).
  • \(\E U^{-1/2}\) for a chi-square variable (gamma integral).
  • The power of the \(z\) test (Theorem 5.2).
Hint 3 of 5: step 1

Write \(T=(Z+\delta)/\sqrt{U/\nu}\) and condition on \(U\). Aim for: \(\P(T\le t)=\int\Phi(t\sqrt{u/\nu}-\delta)f_U(u)\,\d u\).

Hint 4 of 5: step 2

Use the integral to show that the power depends only on \(\delta=\sqrt n\,d\) and \(n\), and increases with \(d\). Aim for: a monotone power function, so the size of \(H_0\colon\mu\le\mu_0\) is \(\alpha\).

Hint 5 of 5: step 3

Evaluate \(\P(T_{19,2.236}\le1.7291)\), then search over \(n\) for power 0.8. Aim for: \(\beta=0.305\), and \(n=27\) against \(n=25\) for the \(z\) test.

Proof

(a) The algebra on page 413 gives the representation; \(Z\) and \(U\) are independent by Theorem 7.3.2. Condition on \(U=u\): \(\P(T\le t\mid U=u)=\P(Z\le t\sqrt{u/\nu}-\delta)=\Phi(t\sqrt{u/\nu}-\delta)\); then average over the density of \(U\). With \(\delta=0\) it is the cdf of \(T_\nu\).

(b) \(\E T=\delta\,\E(U/\nu)^{-1/2}=\delta\sqrt\nu\,\E U^{-1/2}\) (the mean of \(Z\) is 0), and \(\E U^{-1/2}=\dfrac{2^{-1/2}\Gamma(\frac{\nu-1}2)}{\Gamma(\frac\nu2)}\) by the gamma integral, finite when \(\nu>1\). So the mean is larger than \(\delta\): the noncentral \(t\) is pushed a little beyond the shift.

(c) The representation involves only \(\delta=\sqrt n\,d\) and \(\nu\); the rule rejects when \(T\ge t_{\alpha,\nu}\), so \(\pi=1-\P(T\le t_{\alpha,\nu})\) depends on \(d\) and \(n\) alone. (Equivalently, \(t\) is unchanged if the data are multiplied by any \(c>0\), as is the shift.) For fixed \(u\), \(\Phi(t\sqrt{u/\nu}-\delta)\) decreases in \(\delta\), hence so does the cdf, and the power increases in \(\delta\), so in \(d\). In particular the power at \(\mu<\mu_0\) is below \(\alpha\) and the size of the right-sided test of \(H_0\colon\mu\le\mu_0\) is \(\alpha\), attained at \(\mu_0\) (used in Filling the gap 7.10).

(d) The \(z\) test has power \(\Phi(\delta-z_\alpha)\); the \(t\) test has power \(\P(T'\ge t_{\alpha,\nu})\) with a larger cut-off (\(t_{\alpha,\nu}>z_\alpha\)) and extra randomness in the denominator. The inequality is a numerical observation here, not a proved theorem: for \(d=0.5\), \(n=20\) the powers are 0.695 and 0.723. For sample size one searches: t_sample_size evaluates the power for \(n=2,3,\dots\) and returns the first \(n\) that reaches the target, \(n=27\) (power 0.812; \(n=26\) gives 0.798), against \(n=\lceil((z_\alpha+z_\beta)/d)^2\rceil=\lceil(1.645+0.842)^2/0.25\rceil=25\) for the \(z\) test (Theorem 5.2 of the first-year notes). The extra two observations are the price of estimating \(\sigma\). Two-sided tests at the same effect need 34 and 32.

Approximation. A good normal approximation to the cdf is \(\P(T\le t)\approx\Phi\bigl(\frac{t(1-1/(4\nu))-\delta}{\sqrt{1+t^2/(2\nu)}}\bigr)\) (Johnson and Welch); for Example 7.6.1 it gives 0.3050 against the exact 0.3048. ∎

Two rising power curves against the standardised shift d from 0 to 1.1 for n equal to 20: the z test curve lies slightly above the t test curve; a marked point on the t curve at d equal to 0.5 shows power 0.695.
Figure x7.2. Power of the one-sided 5% test of \(H_0\colon\mu=\mu_0\) as a function of \(d=(\mu_1-\mu_0)/\sigma\) for \(n=20\): the \(z\) test (\(\sigma\) known) and the \(t\) test (noncentral \(t\)). At \(d=0.5\) the \(t\) test has power 0.695 (\(\beta=0.305\), Example 7.6.1). Own figure. Code: ch07_normal_inference.py, fig_x7_2.

Simulations

pp. 413–414 The noncentral \(t\) result needs normal data. For other data, simulation can estimate the Type II error. The book repeats Example 7.6.1 with \(\mu_0=5\), \(\sigma=3\), \(n=20\) and \(\mu_1=6.5\) (so \(\delta=2.236\)): two hundred samples of size 20 are drawn from \(\N(6.5,9)\), the statistic \((\bar y-5)/(s/\sqrt{20})\) is computed for each, and the number that fall below 1.7291 is counted. With \(\beta=0.305\) we expect about \(200\times0.305=61\), and Minitab produced 64. The experiment is then repeated with gamma data of the same mean and variance (\(r=4.694\), \(\lambda=0.722\), so \(\mu=6.5\), \(\sigma^2=9\)), giving 60 errors. The book concludes that the test is robust for Type II errors, and that for very skewed or unknown laws the nonparametric tests of Chapter 14 are advisable.

▶ DemoType II error with gamma data (n = 20, shift 0.5σ)The same experiment as the book's, with as many samples as you like: the rejection rate under the shifted law, for normal data (preset 7, \(\beta\approx0.305\)) and for gamma data (preset 8, \(\beta\approx0.276\)).

Filling the gap 7.18: how much can two hundred samples show? p. 414

The count of Type II errors in \(N\) independent samples is binomial with \(N\) trials and probability \(\beta\), so its standard deviation is \(\sqrt{N\beta(1-\beta)}\): about 6.5 for \(N=200\) and \(\beta=0.305\). The book's counts, 64 and 60, are both within one standard deviation of 61, so the two experiments cannot be told apart from each other or from the theory, and "some robustness" is all they can say. A simulation with 400 000 samples gives \(\beta=0.276\) for the gamma data (against 0.305 for normal data): for this law the \(t\) test is actually more powerful at the same \(\mu_1\), by about three points, and only a simulation of several thousand samples could see it.

Hint 1 of 4: the key idea

The number of Type II errors among \(N\) independent samples is binomial. How large is its standard deviation, and how far from the expectation are 64 and 60?

Hint 2 of 4: tools you will need
  • The binomial mean and variance (Theorem 3.5.1).
  • The gamma mean \(r/\lambda\), variance \(r/\lambda^2\) (Theorem 4.6.3).
  • The standard error \(\sqrt{\beta(1-\beta)/N}\) of an estimated probability.
Hint 3 of 4: step 1

Compute the mean and standard deviation of the count for \(N=200\), \(\beta=0.305\). Aim for: 61 and 6.5; express 64 and 60 in standard deviations.

Hint 4 of 4: step 2

Estimate the sample size \(N\) needed to resolve \(0.305\) from \(0.276\) with a standard error of 0.01. Aim for: about 4000 samples per law.

Proof

If the \(N\) samples are independent and each produces a Type II error with probability \(\beta\), the count is \(\mathrm{Binomial}(N,\beta)\), with mean \(N\beta\) and variance \(N\beta(1-\beta)\). For \(N=200\), \(\beta=0.305\): mean 61, standard deviation 6.5, so \(|64-61|=3\) is 0.46 standard deviations. The gamma parameters satisfy \(r/\lambda=6.50\) and \(r/\lambda^2=9.0\), so the law has the same mean and variance as the normal one but skewness \(2/\sqrt r=0.92\). Its true \(\beta\) (estimated from 400 000 samples, standard error 0.0007) is 0.276, for which 200 samples give a mean of 55 and a standard deviation of 6.3; the observed 60 is 0.8 standard deviations above. To detect the difference \(0.305-0.276=0.03\) with a standard error of 0.01 for the difference one needs about \(2\beta(1-\beta)/0.01^2\approx4000\) samples per law. The lesson for any simulation study: report the Monte Carlo standard error \(\sqrt{\hat\beta(1-\hat\beta)/N}\) next to every estimated error probability, and choose \(N\) from the accuracy needed. Why the gamma law gives the smaller \(\beta\) is not obvious from the theory (the skewness affects both the numerator and the denominator of the \(t\) ratio); the simulation answers it directly. ∎

Notes on the book

Appendix 7.A.1: an orthogonal matrix has determinant \(\pm1\), not \(+1\) p. 415

Part (b) of the Lemma in Appendix 7.A.1 says "if a matrix \(A\) is orthogonal, then \(\det A=1\)". From \(AA^\T=I\) one gets \((\det A)^2=1\), so \(\det A=\pm1\), and both signs occur: the diagonal matrix \(\mathrm{diag}(-1,1,\dots,1)\) is orthogonal with determinant \(-1\), and so is the Helmert matrix with two rows swapped. What the proof needs is \(|\det A|=1\), because the change-of-variables formula uses the absolute value of the Jacobian; with that correction the proof is complete (Filling the gap 7.4).

Case Study 7.4.1: the upper endpoint is 60.5 p. 392

The interval \(\bar y\pm t_{.025,10}\,s/\sqrt{11}\) is printed as \((36.2,\,60.6)\). With the unrounded \(\bar y=48.364\) and \(s=18.085\) it is \((36.21,\,60.51)\); the 60.6 comes from using the rounded values 48.4 and 18.1. The conclusion is unchanged.

Case Study 7.4.2: \(t=2.055\), not 2.068, and the \(P\)-value is 0.054 p. 397

The table gives the ratios to three decimals, with mean 0.6605 and standard deviation 0.0925. The book rounds them to 0.661 and 0.093 before dividing, which gives \(t=2.068\); the unrounded value is \(2.055\) (critical value 2.0930, two-sided \(P=0.054\)). The decision, not to reject, is the same, but the evidence against \(H_0\) is slightly weaker than the printed numbers suggest.

Appendix 7.A.3: the equal-tailed chi-square test is not the likelihood ratio test p. 419

The book says the exact likelihood ratio test is "slightly" different from splitting \(\alpha\) equally between the two tails, and that the tail areas are "numerically close". For \(n=19\), \(\alpha=0.05\) the exact GLRT has tail areas 0.0395 and 0.0105 (cut-offs 8.97 and 34.65, against 8.23 and 31.53 for equal tails). Theorem 7.5.2(c) is a valid size-\(\alpha\) test but it is not the GLRT; see Filling the gap 7.15 for the exact test and the unbiased test.

Selected questions

Nine questions: eight of the book's, restated in my own words and covering Sections 7.3 to 7.5, with complete solutions (hidden), and one problem of my own for Section 7.6 (the book has no questions there). 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 7.3.3 (is this a sample from \(\N(50,10^2)\)?). Is it believable that 65, 30 and 55 are a random sample of size 3 from a normal law with \(\mu=50\) and \(\sigma=10\)? Answer with a chi-square distribution, using \(Z_i=(Y_i-50)/10\) and Theorem 7.3.1.

    Hint 1 of 4: the key idea

    If the sample really comes from \(\N(50,10^2)\), standardise each observation. What law does the sum of the three squares have, and how many degrees of freedom, given that \(\mu\) is known?

    Hint 2 of 4: tools you will need
    • Theorem 7.3.1: a sum of \(m\) squared standard normals is \(\chi^2_m\).
    • The chi-square table (Figure 7.5.2).
    Hint 3 of 4: step 1

    Compute \(Z_i=(Y_i-50)/10\) and \(\sum Z_i^2\). Aim for: 6.50.

    Hint 4 of 4: step 2

    Compare with the central 95% of \(\chi^2_3\) and find the tail probability. Aim for: inside \((0.216,9.348)\); \(\P(\chi^2_3\ge6.5)\approx0.09\). What does that say?

    Solution

    If the claim is true, \(Z_i=(Y_i-50)/10\) are independent standard normal, so by Theorem 7.3.1 \(\sum_{i=1}^3Z_i^2\sim\chi^2_3\). (The degrees of freedom are 3, not 2, because \(\mu\) is given and not estimated.) Here \(Z=(1.5,\,-2,\,0.5)\) and \[ \sum Z_i^2=2.25+4+0.25=6.50. \] From the table, \(\chi^2_{.025,3}=0.216\) and \(\chi^2_{.975,3}=9.348\); the central 95% of the \(\chi^2_3\) law is \((0.216,\,9.348)\) and 6.50 lies inside it. The upper-tail probability is \(\P(\chi^2_3\ge6.50)=0.090\), so a sum this large or larger occurs in 9% of samples from the claimed law (two-sided \(P\approx0.18\)). The data are therefore not inconsistent with \(\N(50,10^2)\). That is weak evidence for it, not strong: the test uses three observations, and \(30\) alone is \(2\sigma\) below the mean.

  2. Questions 7.3.11 and 7.3.12 (the reciprocal of an \(F\) variable). (a) If \(F\) has an \(F\) distribution with \(m\) and \(n\) degrees of freedom, show that \(1/F\) has an \(F\) distribution with \(n\) and \(m\) degrees of freedom. (b) If \(\P(a\le F_{m,n}\le b)=q\), which \(c,d\) satisfy \(\P(c\le F_{n,m}\le d)=q\)? Check with the table values of \(F_{.05,2,8}\), \(F_{.95,2,8}\), \(F_{.05,8,2}\), \(F_{.95,8,2}\).

    Hint 1 of 4: the key idea

    Write \(F\) as a ratio of two independent chi-squares over their degrees of freedom. What happens when you invert the ratio?

    Hint 2 of 4: tools you will need
    • Definition 7.3.2 of the \(F\) law.
    • Order reversal of inequalities between positive numbers under \(x\mapsto1/x\).
    • The table of \(F\) percentiles (Appendix Table A.4).
    Hint 3 of 4: part (a)

    Invert \(F=(V/m)/(U/n)\) and compare with Definition 7.3.2. Aim for: \(1/F\sim F_{n,m}\).

    Hint 4 of 4: part (b)

    Invert the inequality \(a\le F_{m,n}\le b\). Aim for: \(c=1/b\), \(d=1/a\), hence \(F_{p,n,m}=1/F_{1-p,m,n}\). Check with \(F_{.95,8,2}=19.37\).

    Solution

    (a) Write \(F=\dfrac{V/m}{U/n}\) with independent \(V\sim\chi^2_m\), \(U\sim\chi^2_n\). Then \(1/F=\dfrac{U/n}{V/m}\), which is a ratio of the same kind with the roles of the numerator and denominator exchanged: the numerator chi-square has \(n\) degrees of freedom and the denominator \(m\), so \(1/F\sim F_{n,m}\) (Definition 7.3.2).

    (b) \(a\le F_{m,n}\le b\iff1/b\le1/F_{m,n}\le1/a\) (all quantities positive), and \(1/F_{m,n}\sim F_{n,m}\). So \(\P(1/b\le F_{n,m}\le1/a)=q\), i.e. \(c=1/b\), \(d=1/a\). In terms of percentiles, \(F_{p,n,m}=1/F_{1-p,m,n}\): the lower \(p\) point of \(F_{n,m}\) is the reciprocal of the upper \(p\) point of \(F_{m,n}\). That is why tables list only the upper percentiles.

    Check: \(F_{.95,8,2}=19.37\) and \(F_{.05,2,8}=0.0516=1/19.37\); \(F_{.95,2,8}=4.459\) and \(F_{.05,8,2}=0.2243=1/4.459\).

  3. Question 7.3.14 (an integral from the \(t\) law). Evaluate \(\int_0^\infty\dfrac1{1+x^2}\,\d x\) using the Student \(t\) distribution.

    Hint 1 of 4: the key idea

    One special \(t\) density is \(c/(1+t^2)\). Which one, and what does the fact that a density integrates to 1 tell you about \(\int dx/(1+x^2)\)?

    Hint 2 of 4: tools you will need
    • The \(t\) density (Theorem 7.3.4) with \(\Gamma(1)=1\), \(\Gamma(\tfrac12)=\sqrt\pi\) (gap 4.18).
    • Symmetry of an even integrand.
    Hint 3 of 4: step 1

    Put \(n=1\) in the \(t\) density. Aim for: \(\dfrac1{\pi(1+t^2)}\).

    Hint 4 of 4: step 2

    Use total mass 1 and evenness. Aim for: \(\int_0^\infty\dfrac{\d x}{1+x^2}=\dfrac\pi2\).

    Solution

    The \(t\) density with \(n=1\) degree of freedom (Theorem 7.3.4) is \[ f_{T_1}(t)=\frac{\Gamma(1)}{\sqrt\pi\,\Gamma(\frac12)}\,\frac1{1+t^2}=\frac1{\pi(1+t^2)},\] using \(\Gamma(1)=1\) and \(\Gamma(\frac12)=\sqrt\pi\). It is a probability density (it was derived as the density of the ratio of a standard normal to the square root of an independent \(\chi^2_1\)), so \(\int_{-\infty}^\infty\frac{\d t}{\pi(1+t^2)}=1\), i.e. \(\int_{-\infty}^\infty\frac{\d t}{1+t^2}=\pi\). The integrand is even, so \[ \int_0^\infty\frac{\d x}{1+x^2}=\frac\pi2. \] Check: \(\arctan x\) has derivative \(1/(1+x^2)\), and \(\arctan(\infty)-\arctan(0)=\pi/2\).

  4. Question 7.4.9 (the age of great discoveries). The ages at which twelve famous scientists made their best-known discovery are 40 (Copernicus, 1543), 34 (Galileo, 1600), 23 (Newton, 1665), 40 (Franklin, 1746), 31 (Lavoisier, 1774), 33 (Lyell, 1830), 49 (Darwin, 1858), 33 (Maxwell, 1864), 34 (Curie, 1896), 43 (Planck, 1901), 26 (Einstein, 1905) and 39 (Schrödinger, 1926). (a) Construct a 95% confidence interval for the mean age at which scientists do their best work. (b) Plot date against age. Does the variability look random in time, so that a single mean \(\mu\) makes sense?

    Hint 1 of 4: the key idea

    A small sample from presumably normal data with unknown \(\sigma\): which interval? Part (b) asks whether one mean \(\mu\) makes sense for discoveries spread over four centuries.

    Hint 2 of 4: tools you will need
    • The \(t\) interval (Theorem 7.4.1) and the \(t\) table (Figure 7.4.1).
    • Sample mean and standard deviation.
    • A scatter plot of age against year, and the sample correlation.
    Hint 3 of 4: part (a)

    Compute \(\bar y\) and \(s\) for the twelve ages and use \(t_{.025,11}=2.2010\). Aim for: \(\bar y=35.4\), \(s=7.23\), interval \((30.8,\,40.0)\).

    Hint 4 of 4: part (b)

    Plot age against year and look for a trend; compute the correlation. Aim for: no visible pattern, \(r\approx0.13\). Why does this support one constant \(\mu\), and why can twelve points not prove it?

    Solution

    (a) The twelve ages sum to 425, so \(\bar y=35.42\), and \(s=7.23\). With \(n-1=11\) degrees of freedom \(t_{.025,11}=2.2010\), so \[ 35.42\pm2.2010\cdot\frac{7.23}{\sqrt{12}}=35.42\pm4.59=(30.8,\ 40.0)\ \text{years}. \] (This agrees with the book's answer.) The interpretation is for the mean age at the best work of scientists like these twelve: the sample is a famous, selected group, not a random sample of scientists.

    (b) Plotting age (vertical) against year (horizontal), the points show no pattern: early and late discoveries are spread over the same range of ages (23 to 49), and the correlation between year and age is \(r=0.13\); a least-squares line has slope 0.007 years of age per calendar year with \(P=0.69\), indistinguishable from a flat line. So the assumption of a constant \(\mu\) over four centuries is believable. A caution: with 12 points a flat-looking plot cannot rule out a modest trend; it only fails to show one. The \(t\) interval also assumes normality; the ages are roughly symmetric (a boxplot has no outliers), which is as much as 12 points can tell us.

  5. Question 7.4.15 (the confidence of four intervals). What confidence level goes with each of the following random intervals, assuming normal data? (a) \(\bigl(\bar Y-2.0930\,S/\sqrt{20},\ \bar Y+2.0930\,S/\sqrt{20}\bigr)\); (b) \(\bigl(\bar Y-1.345\,S/\sqrt{15},\ \bar Y+1.345\,S/\sqrt{15}\bigr)\); (c) \(\bigl(\bar Y-1.7056\,S/\sqrt{27},\ \bar Y+2.7787\,S/\sqrt{27}\bigr)\); (d) \(\bigl(-\infty,\ \bar Y+1.7247\,S/\sqrt{21}\bigr)\).

    Hint 1 of 4: the key idea

    In each interval, match the multipliers with entries of the \(t\) table for the right degrees of freedom. The confidence is then the area between the two cut-offs under \(f_{T_{n-1}}\).

    Hint 2 of 4: tools you will need
    • \(\P(-b\le T_{n-1}\le a)=F(a)-F(-b)\) (gap 7.9).
    • Symmetry of \(t_{n-1}\) and the \(t\) table.
    • One-sided intervals (take \(a=\infty\)).
    Hint 3 of 4: part (a) and (b)

    Use \(n-1=19\) and \(14\) degrees of freedom and identify \(2.0930\) and \(1.345\) in the table. Aim for: which right-tail area each multiplier cuts off; then the confidence of a symmetric interval.

    Hint 4 of 4: part (c) and (d)

    For (c) add the two tail areas that the multipliers cut off, with different values on the two sides; for (d) use one tail only. Aim for: \(0.945\) and \(0.95\).

    Solution

    By Filling the gap 7.9, \(\bar Y-a\,S/\sqrt n\le\mu\le\bar Y+b\,S/\sqrt n\) has probability \(F_{T_{n-1}}(a)-F_{T_{n-1}}(-b)\), and the multipliers can be matched to table entries.

    (a) \(n=20\), 19 df: \(2.0930=t_{.025,19}\), so the interval has two tails of 0.025: confidence \(1-2(0.025)=0.95\).

    (b) \(n=15\), 14 df: \(1.345=t_{.10,14}\), two tails of 0.10: confidence \(0.80\).

    (c) \(n=27\), 26 df: \(1.7056=t_{.05,26}\) and \(2.7787=t_{.005,26}\). The interval fails when \(T>1.7056\) (probability 0.05) or \(T<-2.7787\) (probability 0.005), so the confidence is \(1-0.05-0.005=0.945\).

    (d) \(n=21\), 20 df: \(1.7247=t_{.05,20}\). The one-sided interval is \(\{\mu\le\bar Y+1.7247S/\sqrt{21}\}=\{T\ge-1.7247\}\), with probability \(1-0.05=0.95\).

  6. Question 7.4.22 (is there a home-field advantage?). To avoid weak home opponents, a study looked only at college football games between teams ranked in the top twenty-five: for 317 such games the home team's margin of victory had \(\bar y=4.57\) and \(s=18.29\). Test \(H_0\colon\mu=0\) against \(H_1\colon\mu>0\) at \(\alpha=0.05\). Also give a 95% interval for \(\mu\) and comment on the assumptions.

    Hint 1 of 4: the key idea

    With \(n=317\) the standard error is tiny. What are the hypotheses, which tail matters, and how does \(\bar y=4.57\) compare with its standard error?

    Hint 2 of 4: tools you will need
    • The one-sample \(t\) test, Theorem 7.4.2(a).
    • \(t_{.05,316}\approx z_{.05}\) because the degrees of freedom are large (gap 7.7).
    • The \(t\) interval, and robustness for large \(n\) (gap 7.12).
    Hint 3 of 4: step 1

    Compute \(s/\sqrt n\) and \(t=(\bar y-0)/(s/\sqrt n)\). Aim for: \(t\approx4.45\), against a critical value near 1.65.

    Hint 4 of 4: step 2

    Build the 95% interval for \(\mu\) and comment on the assumptions (normality, independence of the 317 games). Aim for: an interval of about \((2.5,\,6.6)\) points.

    Solution

    The estimated standard error is \(s/\sqrt n=18.29/\sqrt{317}=1.027\), so \[ t=\frac{4.57-0}{1.027}=4.45,\qquad t_{.05,316}=1.650. \] Since \(4.45\ge1.650\), reject \(H_0\) (Theorem 7.4.2(a)); the one-sided \(P\)-value is about \(6\times10^{-6}\). The data confirm a home-field advantage. A 95% interval for the mean margin is \(4.57\pm1.968\cdot1.027=(2.55,\ 6.59)\) points: the advantage is somewhere between 2.5 and 6.6 points, a more useful summary than "significant" (Section 6.6).

    Assumptions: the \(t\) procedures need roughly normal margins of victory, and with \(n=317\) the sample mean is close to normal whatever the shape (Filling the gap 7.12), so the test is safe. They also need the 317 margins to be independent draws of one law; a team that plays several of the games, or a season-to-season change in the home advantage, would make that doubtful, so the \(P\)-value is probably too small, though the conclusion is not in danger at \(t=4.45\).

  7. Question 7.5.6 (how large must \(n\) be to estimate a variance within a factor 2?). For a sample from a normal law, what is the smallest \(n\) for which \(\P(S^2/\sigma^2<2)\ge0.95\)?

    Hint 1 of 4: the key idea

    Turn the event \(S^2/\sigma^2<2\) into an event for a chi-square variable with \(n-1\) degrees of freedom. Then you need a probability of at least 0.95: compare a table percentile with a number.

    Hint 2 of 4: tools you will need
    • \((n-1)S^2/\sigma^2\sim\chi^2_{n-1}\) (Theorem 7.3.2).
    • The chi-square table, the 0.95 column (Figure 7.5.2).
    Hint 3 of 4: step 1

    Show \(S^2/\sigma^2<2\iff\chi^2_{n-1}<2(n-1)\), so the condition is \(2(n-1)\ge\chi^2_{.95,n-1}\).

    Hint 4 of 4: step 2

    Try \(n=7,8,9\) from the table. Aim for: \(12<12.592\), \(14<14.067\), \(16>15.507\); the smallest \(n\) is 9.

    Solution

    Because \((n-1)S^2/\sigma^2\sim\chi^2_{n-1}\), \(S^2/\sigma^2<2\iff\chi^2_{n-1}<2(n-1)\). We need \(\P(\chi^2_{n-1}<2(n-1))\ge0.95\), that is \(2(n-1)\ge\chi^2_{.95,n-1}\). Try values with the chi-square table:

    \(n\)df \(n-1\)\(2(n-1)\)\(\chi^2_{.95,n-1}\)\(\P(\chi^2_{n-1}<2(n-1))\)
    761212.5920.938
    871414.0670.949
    981615.5070.958

    At \(n=8\) the bound 14 falls just short of 14.067; at \(n=9\) it is above 15.507. So the smallest sample size is \(n=9\). (For larger \(n\) the probability increases, since \(\chi^2_{n-1}/(n-1)\to1\) in probability and its spread shrinks.) With nine observations the sample variance exceeds twice the true variance only 4% of the time.

  8. Question 7.5.15 (is potassium–argon dating more precise than lead dating?). The older lead method has standard deviation 30.4 million years. The potassium–argon method of Case Study 7.5.1 has \(s^2=733.4\) from \(n=19\) readings (so \(s=27.1\)). Is this proof that the new method is more precise? Test \(H_0\colon\sigma^2=30.4^2\) against \(H_1\colon\sigma^2<30.4^2\) at the 0.05 level.

    Hint 1 of 4: the key idea

    This is a one-sided test for a variance with the benchmark treated as known. Which direction is the alternative, and which tail of \(\chi^2_{18}\) is the rejection region?

    Hint 2 of 4: tools you will need
    • Theorem 7.5.2(b) and the chi-square table.
    • The P-value as a chi-square left tail.
    • Power of the chi-square test (gap 7.16).
    Hint 3 of 4: step 1

    Compute \(\chi^2=(n-1)s^2/\sigma_0^2\) with \(s^2=733.4\), \(\sigma_0=30.4\). Aim for: \(14.28\); compare with \(\chi^2_{.05,18}=9.390\).

    Hint 4 of 4: step 2

    State the decision, and say what 'not proof' means here. Aim for: do not reject (\(P\approx0.29\)); low power against modest improvements.

    Solution

    The test statistic is \[ \chi^2=\frac{(n-1)s^2}{\sigma_0^2}=\frac{18(733.4)}{30.4^2}=14.28. \] By Theorem 7.5.2(b) we reject if \(\chi^2\le\chi^2_{.05,18}=9.390\). Since \(14.28>9.390\), we do not reject; the \(P\)-value is \(\P(\chi^2_{18}\le14.28)=0.29\). The difference between 27.1 and 30.4 is within what chance gives with 19 observations, so it is not proof that the new method is more precise. (This is the book's answer.)

    Two remarks. First, "do not reject" does not say the methods are equally precise: the power of this test against a modest improvement is small (Filling the gap 7.16: for a 10% reduction in the standard deviation, \(\theta=0.81\), power is about 0.13). Second, the value 30.4 was itself estimated from data in the lead studies; treating it as a known constant ignores its uncertainty, and comparing the two methods properly calls for the \(F\) test for two variances, which uses the \(F\) law of Section 7.3.

  9. Problem 7.6.1 (the Type II error of a \(t\) test, and a sample size; own problem). A one-sided \(t\) test of \(H_0\colon\mu=\mu_0\) against \(H_1\colon\mu>\mu_0\) at \(\alpha=0.05\) is based on \(n=12\) observations. (a) What is the probability of a Type II error when \(\mu_1-\mu_0=0.8\sigma\)? Compare with the \(z\) test that knows \(\sigma\). (b) What is the smallest \(n\) for which the \(t\) test has power at least 0.90 at this shift, and what does the \(z\) formula give? (c) Why can \(\beta\) not be read from the \(t\) table?

    Hint 1 of 5: the key idea

    When \(\mu_1\neq\mu_0\) the \(t\) ratio is a noncentral \(t\) variable. What is its noncentrality parameter in terms of \(n\) and \((\mu_1-\mu_0)/\sigma\), and which cut-off defines the Type II error?

    Hint 2 of 5: tools you will need
    • The noncentral \(t\) law (gap 7.17) and its cdf from software.
    • \(t_{.05,11}\) from the table, and the power of the \(z\) test.
    • A search over \(n\) as in Example 7.5.1.
    Hint 3 of 5: part (a)

    Compute \(\delta=0.8\sqrt{12}\) and \(\beta=\P(T_{11,\delta}\le t_{.05,11})\); then \(\beta_z=\Phi(z_{.05}-\delta)\). Aim for: \(\beta\approx0.17\) against \(\beta_z\approx0.13\).

    Hint 4 of 5: part (b)

    Evaluate the power for \(n=13,14,15\). Aim for: the first \(n\) with power at least 0.90 is 15; the \(z\) formula gives 14.

    Hint 5 of 5: part (c)

    Think about what is central and what is not in \(Z+\delta\) over \(\sqrt{U/\nu}\). Aim for: the \(t\) table is for \(\delta=0\) only, and \(\delta\) contains the unknown \(\sigma\).

    Solution

    (a) With \(\nu=11\), \(t_{.05,11}=1.7959\) and noncentrality \(\delta=0.8\sqrt{12}=2.771\), \(\beta=\P(T_{11,\,2.771}\le1.7959)=0.171\) (power 0.829) from software (scipy.stats.nct). The Johnson–Welch approximation gives \(\Phi\bigl(\frac{1.7959(1-1/44)-2.771}{\sqrt{1+1.7959^2/22}}\bigr)=\Phi(-0.949)=0.171\). The \(z\) test would have \(\beta=\Phi(1.645-2.771)=\Phi(-1.126)=0.130\); knowing \(\sigma\) is worth four points of power here.

    (b) The power of the \(t\) test is 0.858 for \(n=13\), 0.882 for \(n=14\) and 0.903 for \(n=15\): the smallest \(n\) is 15. The \(z\) formula \(n\ge\bigl((z_{.05}+z_{.10})/d\bigr)^2=\bigl((1.645+1.282)/0.8\bigr)^2=13.4\) gives 14, one observation fewer.

    (c) The \(t\) table gives percentiles of the (central) \(t\) law, which is the law of the ratio only when \(H_0\) is true. When \(\mu=\mu_1\neq\mu_0\) the ratio has the noncentral \(t\) law with noncentrality \(\delta=\sqrt n(\mu_1-\mu_0)/\sigma\) (Section 7.6, Filling the gap 7.17), which depends on a second parameter and is not tabulated in the book. And \(\delta\) involves \(\sigma\), which is unknown, so the effect has to be specified in units of \(\sigma\).

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
How robust is the \(t\) test?Thousands of seeded samples from a chosen population (normal, uniform, exponential, Poisson, lognormal, the book's gamma), the histogram of \(t\) ratios against the \(t_{n-1}\) curve with the nominal rejection region shaded, the true level in each tail and in total, and the power of the test at a chosen shift. Presets: 1 normal, \(n=6\); 2 uniform (Figure 7.4.6a); 3 exponential (7.4.6b); 4 Poisson (7.4.6c); 5 exponential with \(n=15\) (7.4.6d); 6 lognormal with \(n=30\); 7 Type II error, normal data (Example 7.6.1); 8 Type II error, gamma data.Section 7.4 (robustness), Section 7.6 (simulations); 7.12, 7.18; Question 7.4.22
Inference about a varianceThe \(\chi^2_{n-1}\) curve with the cut-offs of the equal-tailed, exact likelihood ratio, unbiased or shortest rule; the interval for \(\sigma^2\) and \(\sigma\) from \(n\) and \(s^2\); the test of \(\sigma_0^2\) with its \(P\)-value and power curve; and the expected width of the interval against \(n\). Presets: 1 Case Study 7.5.1; 2 Case Study 7.5.2; 3 Example 7.5.1 (\(n=39\)); 4 three ways to choose the cut-offs; 5 the shortest interval.Section 7.5; 7.13 to 7.16; Question 7.5.6, 7.5.15

Related first-year and graduate demonstrations: Why Student's t? Inside the normal-sample theorem (Sections 7.2, 7.3 and 7.5: heavy tails of \(T\) for small \(n\), independence of \(\bar x\) and \(s\), the chi-square pivot), Confidence intervals: does the method catch the truth? (Section 7.2: coverage of the interval with \(\sigma\) replaced by \(s\)), Power and sample size (Section 7.6: the noncentral \(t\) power curve) and Tests and intervals (Filling the gap 7.10).

References

  1. Casella, G. and Berger, R. L. (2002). Statistical Inference, 2nd edition. Duxbury, Pacific Grove.
  2. Hall, P. (1992). The Bootstrap and Edgeworth Expansion. Springer, New York.
  3. Johnson, N. L. and Welch, B. L. (1940). Applications of the non-central t-distribution. Biometrika, 31(3–4), 362–389.
  4. Larsen, R. J. and Marx, M. L. (2018). An Introduction to Mathematical Statistics and Its Applications, 6th edition. Pearson, Boston. Chapter 7, pp. 380–420.
  5. Lehmann, E. L. and Romano, J. P. (2005). Testing Statistical Hypotheses, 3rd edition. Springer, New York.
  6. Student (W. S. Gosset) (1908). The probable error of a mean. Biometrika, 6(1), 1–25.
  7. Tate, R. F. and Klett, G. W. (1959). Optimal confidence intervals for the variance of a normal distribution. Journal of the American Statistical Association, 54(287), 674–682.
  8. Wendel, J. G. (1948). Note on the gamma function. American Mathematical Monthly, 55(9), 563–564.
  9. Wilson, E. B. and Hilferty, M. M. (1931). The distribution of chi-square. Proceedings of the National Academy of Sciences, 17(12), 684–688.