A probability model has parameters, and data are the only route to their values. This chapter is where the book turns from probability to statistics: two recipes for turning a sample into a number (maximum likelihood and the method of moments), intervals that say how far that number can be trusted, and the properties that separate a good estimator from a poor one: unbiasedness, small variance, the Cramér-Rao floor under that variance, sufficiency, consistency, and the Bayesian alternative in which the parameter itself has a distribution. The book states several of these results without proof or proves them only in examples; these notes add the missing arguments (when a stationary point really is the maximum, why the Wald interval works, why the Cramér-Rao bound holds and when it is attained, the factorization theorem in the continuous case, the Rao-Blackwell theorem, consistency of the maximum likelihood estimator, the Bayes estimate under the book's inventory loss), and correct three errors 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
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.
They follow the book. Sections carry the book's numbers (5.1 to 5.9) and numbered items keep theirs (Definition 5.2.1, Theorem 5.5.1, Example 5.4.6, Case Study 5.8.1). 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. \((5.2.1)\).
Filling the gaps. Wherever the book says "it can be shown", refers to another text for a proof, leaves an exercise to the reader or works an example too fast to follow, an orange Filling the gap box gives the full argument. Where the first-year notes already prove a result in full (the Cramér-Rao bound, the normal maximum likelihood estimates, the Wald interval, Chebyshev's inequality), the box gives the statement, a short sketch and a link. 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. Eleven figures of the chapter (5.1.1, 5.1.2, 5.2.1, 5.2.2, 5.3.1 to 5.3.4, 5.4.1, 5.7.1 and 5.8.1) are reproduced, Figure 5.3.2 with the book's own simulated intervals of Table 5.3.1; three own figures (x5.1 to x5.3) set the fitted count models against their tables, compare two unbiased estimators with the Cramér-Rao "bound" they beat, and show a prior becoming a posterior and a parametric bootstrap. The two schematic drawings of estimator densities (Figures 5.4.2 and 5.4.3) are not redrawn. All are computed by the Python code. The ▶ Demo boxes open an interactive demonstration already set to the case being discussed.
R. J. Larsen and M. L. Marx, An Introduction to Mathematical Statistics and Its Applications, 6th edition, Pearson (2018), Chapter 5, pages 278–342. 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.
Estimation is developed, at other levels and in other words, in three companion courses of this site. Where a proof there is complete, these notes give the statement and a short argument and link to it.
New here: a usable test for "the stationary point is the maximum" (Filling the gap 5.1), the zero-truncated Poisson equation (5.2), Max's chances as a posterior probability (5.8), when the Cramér-Rao bound is attained and a best estimator that is not efficient (5.13, 5.14), why Example 5.5.2 escapes the bound (5.15), the factorization theorem for densities (5.16), a corrected account of what sufficiency buys (5.19), consistency of the maximum likelihood estimator (5.20), the inventory loss of Example 5.8.5 solved (5.23) and what the bootstrap of Section 5.9 actually estimates (5.24).
Notation. A random sample \(Y_1,\dots,Y_n\) (or \(X_1,\dots,X_n\) when discrete) has density \(f_Y(y;\theta)\) (or probability function \(p_X(k;\theta)\)); the book calls both "pdf". \(L(\theta)\) is the likelihood, \(\ell(\theta)=\ln L(\theta)\), an estimator is \(\hat\theta=h(Y_1,\dots,Y_n)\) and its value on the data, the estimate, is \(\theta_e\). \(\bar Y\) is the sample mean, \(Y_{\min}\) and \(Y_{\max}\) the extreme order statistics, \(z_{\alpha/2}\) the upper \(\alpha/2\) point of the standard Normal, \(\Phi\) its cdf and \(\varphi\) its density.
Prerequisites. Chapter 3 (expectations, variance of sums, order statistics, conditional densities) and Chapter 4 of the book (the Poisson, Normal, geometric, negative binomial and gamma families and the central limit theorem).
pp. 278–280 Every model of Chapter 4 is really a family indexed by parameters: the Poisson by its rate \(\lambda\), the binomial by \(p\), the Normal by \(\mu\) and \(\sigma\). Changing the parameter changes every probability (Figure 5.1.1), so before a model can predict anything its parameters must be estimated from a sample.
fig_5_1_1.A coin with unknown \(p=\P(\text{heads})\) shows H, H, T. With \(X_i=1\) for heads, the three tosses are independent with \(p_X(k)=p^k(1-p)^{1-k}\), so the probability of what was seen is \(p^2(1-p)\). Its largest value over \(0\le p\le1\) is at \(p=2/3\) (Figure 5.1.2): of all coins, the one that makes HHT most probable has \(p=2/3\). For \(n\) tosses with \(s=\sum k_i\) heads the same reasoning gives \(p^s(1-p)^{n-s}\), whose derivative vanishes at \(p=s/n\) (equation (5.1.1) of the book). That this stationary point is the maximum is checked in Filling the gap 5.1.
fig_5_1_2.Vocabulary. Any function of the sample meant to approximate a parameter is a statistic or estimator, written \(\hat\theta=h(Y_1,\dots,Y_n)\); it is a random variable, with a distribution, a mean and a variance. Its numerical value on the observed data is an estimate, written \(\theta_e\). In Example 5.1.1, \(\hat p=\frac1n\sum X_i\) is the maximum likelihood estimator and \(2/3\) the maximum likelihood estimate.
See also (companion courses): Section 6.3.1 of the graduate course (point estimation); the likelihood demo (preset 1) climbs the likelihood of a proportion.
For a random sample \(k_1,\dots,k_n\) from \(p_X(k;\theta)\), or \(y_1,\dots,y_n\) from \(f_Y(y;\theta)\), the likelihood is
\[ L(\theta)=\prod_{i=1}^n p_X(k_i;\theta)\qquad\text{or}\qquad L(\theta)=\prod_{i=1}^n f_Y(y_i;\theta). \]A value \(\theta_e\) with \(L(\theta_e)\ge L(\theta)\) for every admissible \(\theta\) is a maximum likelihood estimate; the corresponding function of the sample is the maximum likelihood estimator (MLE).
The formula is the joint probability (or density) of the sample, but read in the other direction: the data are fixed and \(\theta\) varies. Because \(\ln\) is strictly increasing, \(L\) and \(\ell=\ln L\) have the same maximisers, and \(\ell\) turns the product into a sum.
For a Poisson sample, \(\ell(\lambda)=-n\lambda+\big(\sum k_i\big)\ln\lambda-\ln\prod k_i!\) and \(\ell'(\lambda)=-n+\sum k_i/\lambda\), which vanishes at \(\lambda_e=\bar k\). This justifies the sample mean 3.87 used for the alpha particles of Case Study 4.2.2. The book notes that \(\ell''(\lambda)=-\sum k_i/\lambda^2<0\).
The sum of two independent exponential lifetimes with mean \(\theta\) has the gamma density \(f_Y(y;\theta)=ye^{-y/\theta}/\theta^2\), \(y\ge0\). Then \(\ell(\theta)=-2n\ln\theta+\sum\ln y_i-\frac1\theta\sum y_i\) and \(\ell'(\theta)=-\frac{2n}\theta+\frac{1}{\theta^2}\sum y_i\), so
\[ \theta_e=\frac{1}{2n}\sum_{i=1}^n y_i=\frac{56.0}{10}=5.6 \]for the five failure times 9.2, 5.6, 18.4, 12.1, 10.7.
The book solves \(\ell'(\theta)=0\) and, apart from the Comment after Example 5.2.1, does not check that the root is a global maximum, nor what happens when the data sit at the edge of the parameter space. A simple sufficient condition settles all the one-parameter examples of the section.
Lemma. Let \(\ell\) be differentiable on an open interval \((a,b)\), and suppose there is \(\theta^*\in(a,b)\) with \(\ell'(\theta)>0\) for \(a<\theta<\theta^*\) and \(\ell'(\theta)<0\) for \(\theta^*<\theta<b\). Then \(\theta^*\) is the unique maximiser of \(\ell\) (hence of \(L\)) on \((a,b)\). In particular this holds if \(\ell'(\theta^*)=0\) and \(\ell''<0\) on \((a,b)\).
A function that rises and then falls has its peak where it turns. How can the sign of \(\ell'\) on each side of \(\theta^*\) be turned into a comparison of \(\ell(\theta)\) with \(\ell(\theta^*)\)?
For \(\theta<\theta^*\) write \(\ell(\theta^*)-\ell(\theta)=\ell'(\xi)(\theta^*-\theta)\). Aim for: a product of two positive numbers; then the mirror case.
Bernoulli and Poisson: compute \(\ell''\). Aim for: a negative expression whenever \(0<s<n\) (or \(s>0\)).
Gamma: \(\ell''\) changes sign, so use the sign of \(\ell'=(\sum y_i-2n\theta)/\theta^2\) directly. Geometric: rewrite it as the Bernoulli case.
If \(a<\theta<\theta^*\), the mean value theorem gives \(\ell(\theta^*)-\ell(\theta)=\ell'(\xi)(\theta^*-\theta)\) for some \(\xi\in(\theta,\theta^*)\), and both factors are positive, so \(\ell(\theta)<\ell(\theta^*)\). If \(\theta^*<\theta<b\), the same identity has \(\ell'(\xi)<0\) and \(\theta^*-\theta<0\), so again \(\ell(\theta)<\ell(\theta^*)\). When \(\ell''<0\), \(\ell'\) is strictly decreasing, so it is positive before its zero and negative after it. ∎
The examples. (i) Bernoulli (Example 5.1.1) with \(s=\sum k_i\): \(\ell(p)=s\ln p+(n-s)\ln(1-p)\) and \(\ell''(p)=-s/p^2-(n-s)/(1-p)^2<0\) on \((0,1)\) when \(0<s<n\), so \(p_e=s/n\) is the unique maximum. If \(s=0\), \(L(p)=(1-p)^n\) decreases and its largest value on \([0,1]\) is at \(p=0=s/n\); if \(s=n\) it is at \(p=1\). The formula \(s/n\) survives, but only because the endpoints are allowed.
(ii) Poisson (Example 5.2.1): for \(s=\sum k_i>0\), \(\ell''(\lambda)=-s/\lambda^2<0\) on \((0,\infty)\) and \(\ell'(\bar k)=0\). If every count is 0, \(L(\lambda)=e^{-n\lambda}\) has no maximum on \((0,\infty)\): the supremum is approached as \(\lambda\to0\).
(iii) Gamma (Example 5.2.2): here \(\ell''(\theta)=2n/\theta^2-2\sum y_i/\theta^3\) is positive for \(\theta>\sum y_i/n\), so \(\ell\) is not concave. The lemma still applies, because \[\ell'(\theta)=\frac{\sum y_i-2n\theta}{\theta^2}\] is positive for \(\theta<\sum y_i/(2n)\) and negative after. So \(\theta_e=\bar y/2\) is the unique maximum.
(iv) Geometric (Case Study 5.2.1): \(\ell(p)=n\ln p+(\sum k_i-n)\ln(1-p)\) is case (i) with \(n\) successes and \(\sum k_i-n\) failures, so \(p_e=n/\sum k_i=1/\bar k\), equal to 1 when every \(k_i=1\). ∎
If daily rises and falls of the market were independent with a fixed chance \(p\) of a rise, the number \(X\) of days until the next rise, counted from a fall, would be geometric, \(p_X(k)=(1-p)^{k-1}p\). For 128 such runs of the 2006–2007 Dow Jones closing average (Table 5.2.1), \(\sum k_i=221\), so \(p_e=128/221=0.5792\) and the expected frequencies \(128(1-p_e)^{k-1}p_e\) are 74.14, 31.20, 13.13, 5.52, 2.32 and (the remainder) 1.69, close to the observed 72, 35, 11, 6, 2, 2 (Figure x5.1a). A formal test of fit is in Chapter 10 of the book.
If the value 0 cannot be observed, the Poisson probabilities of \(k\ge1\) are renormalised by \(1-e^{-\lambda}\):
\[ p_{X_T}(k)=\frac{\lambda^k}{(e^\lambda-1)\,k!},\qquad k=1,2,\dots \]The log-likelihood is \(\ell(\lambda)=(\sum k_i)\ln\lambda-n\ln(e^\lambda-1)-\ln\prod k_i!\), and \(\ell'(\lambda)=0\) reads
\[ \frac{\lambda e^\lambda}{e^\lambda-1}=\bar k. \tag{5.2.1} \]For the 49 years from 1950 to 2012 with at least one hurricane (Table 5.2.2), \(\bar k=91/49=1.857\), and the root is \(\lambda_e=1.398\) (the book's 1.40). With \(\lambda=1.40\) the expected numbers of years with 1, 2, 3 and 4 or more hurricanes are 22.45, 15.72, 7.33 and 3.50 (Table 5.2.3), against 27, 10, 8 and 4 observed (Figure x5.1b).
The book states without proof that the left side of (5.2.1) is the mean of the truncated Poisson, and solves the equation by trial and error. Here: (a) \(\E X_T=\lambda e^\lambda/(e^\lambda-1)\); (b) \(g(\lambda)=\lambda e^\lambda/(e^\lambda-1)\) increases strictly from 1 (as \(\lambda\to0\)) to \(\infty\); hence (c) (5.2.1) has a root exactly when \(\bar k>1\), the root is unique, and it is the maximum likelihood estimate.
(a) is a series with a shifted index; (b) is about the sign of a derivative; (c) then follows from Filling the gap 5.1. Which function of \(\lambda\) is \(\ell'(\lambda)\) proportional to?
Drop the \(k=0\) term and pull out \(\lambda/(e^\lambda-1)\). Aim for: \(\sum_{k\ge1}\lambda^{k-1}/(k-1)!\).
The numerator of \(g'\) is \(h(\lambda)=1-e^{-\lambda}-\lambda e^{-\lambda}\). Aim for: \(h(0)=0\) and \(h'(\lambda)=\lambda e^{-\lambda}\). Also find \(g(0+)\) and \(g(\infty)\).
Show \(\ell'(\lambda)=\frac n\lambda(\bar k-g(\lambda))\) and read off its sign on each side of the root.
(a) Drop the \(k=0\) term and shift the index:
\[ \E X_T=\sum_{k\ge1}\frac{k\lambda^k}{(e^\lambda-1)k!}=\frac{\lambda}{e^\lambda-1}\sum_{k\ge1}\frac{\lambda^{k-1}}{(k-1)!}=\frac{\lambda e^\lambda}{e^\lambda-1}. \](b) Write \(g(\lambda)=\lambda/(1-e^{-\lambda})\). Then
\[ g'(\lambda)=\frac{h(\lambda)}{(1-e^{-\lambda})^2},\qquad h(\lambda)=1-e^{-\lambda}-\lambda e^{-\lambda}. \]Now \(h(0)=0\) and \(h'(\lambda)=e^{-\lambda}-e^{-\lambda}+\lambda e^{-\lambda}=\lambda e^{-\lambda}>0\) for \(\lambda>0\), so \(h>0\) and \(g\) is strictly increasing on \((0,\infty)\). As \(\lambda\to0\), \(1-e^{-\lambda}=\lambda+O(\lambda^2)\), so \(g(\lambda)\to1\); as \(\lambda\to\infty\), \(g(\lambda)\ge\lambda\to\infty\).
(c) Since \(g\) is continuous and strictly increasing from 1 to \(\infty\), \(g(\lambda)=\bar k\) has exactly one root \(\lambda^*\) when \(\bar k>1\) and none when \(\bar k=1\) (every observation equal to 1). Moreover
\[ \ell'(\lambda)=\frac{\sum k_i}{\lambda}-\frac{ne^\lambda}{e^\lambda-1}=\frac n\lambda\big(\bar k-g(\lambda)\big), \]which is positive for \(\lambda<\lambda^*\) and negative for \(\lambda>\lambda^*\), so \(\lambda^*\) is the unique maximum by the lemma of Filling the gap 5.1. When \(\bar k=1\), \(\ell'<0\) everywhere and there is no maximum. Equation (5.2.1) says "model mean = sample mean": the maximum likelihood and moment estimates coincide here, a property of exponential families. The precise root for the hurricane data is \(\lambda_e=1.3985\); with it the expected counts are 22.47, 15.72, 7.33 and 3.48. ∎
For \(f_Y(y;\theta)=e^{-(y-\theta)}\), \(y\ge\theta\), the likelihood is \(e^{-\sum y_i+n\theta}\) provided every \(y_i\ge\theta\), and 0 otherwise. Its derivative in \(\theta\) is never zero; the likelihood simply increases with \(\theta\) until \(\theta\) reaches the smallest observation, where it drops to 0. So \(\theta_e=y_{\min}\) (Figure 5.2.1). Writing the support condition with an indicator, \(L(\theta)=e^{-\sum y_i+n\theta}\,\one\{\theta\le y_{\min}\}\), makes this explicit; the same device reappears in Section 5.6.
fig_5_2_1.With \(\ell(\mu,\sigma^2)=-\frac n2\ln(2\pi\sigma^2)-\frac1{2\sigma^2}\sum(y_i-\mu)^2\), setting both partial derivatives to zero gives \(\sum(y_i-\mu)=0\) (5.2.2) and \(-n\sigma^2+\sum(y_i-\mu)^2=0\) (5.2.3), so
\[ \mu_e=\bar y,\qquad \sigma^2_e=\frac1n\sum_{i=1}^n(y_i-\bar y)^2. \]The book stops at the stationary point. If \(\sum(y_i-\bar y)^2>0\), the pair \((\bar y,\sigma^2_e)\) is the unique global maximiser of \(L(\mu,\sigma^2)\) over \(\R\times(0,\infty)\); if all observations are equal there is no maximum. The first-year notes prove this in full (Theorem 2.3); here is the sketch.
Maximise in two stages: first over \(\mu\) with \(\sigma^2\) fixed, then over \(\sigma^2\). Why is the best \(\mu\) the same for every \(\sigma^2\)?
Expand around \(\bar y\). Aim for: the cross term vanishes, so \(\mu=\bar y\) minimises the sum of squares.
With \(S=\sum(y_i-\bar y)^2\), maximise \(m(v)=-\frac n2\ln(2\pi v)-\frac S{2v}\). Aim for: \(m'(v)=(S-nv)/(2v^2)\); then treat \(S=0\).
For every \(\mu\), \(\sum(y_i-\mu)^2=\sum(y_i-\bar y)^2+n(\bar y-\mu)^2\) (expand around \(\bar y\); the cross term is \(2(\bar y-\mu)\sum(y_i-\bar y)=0\)). So for any fixed \(\sigma^2\) the log-likelihood is largest at \(\mu=\bar y\), whatever \(\sigma^2\) is. Put \(S=\sum(y_i-\bar y)^2\) and \(v=\sigma^2\); it remains to maximise \(m(v)=-\frac n2\ln(2\pi v)-\frac{S}{2v}\). Its derivative \(m'(v)=\frac{S-nv}{2v^2}\) is positive for \(v<S/n\) and negative after, so the lemma of Filling the gap 5.1 gives the unique maximum at \(v=S/n\). If \(S=0\), \(m(v)=-\frac n2\ln(2\pi v)\to\infty\) as \(v\to0\) and there is no maximum. ∎
See also: Section 9.3 of the graduate course and Section 4.2.5 of the machine-learning course.
For a model with \(s\) unknown parameters \(\theta_1,\dots,\theta_s\), the method-of-moments estimates solve the \(s\) equations
\[ \E(Y^j)=\frac1n\sum_{i=1}^n y_i^j,\qquad j=1,\dots,s, \]with the moments \(\E(Y^j)\) computed from the model as functions of the parameters (sums in the discrete case).
For \(f_Y(y;\theta)=\theta y^{\theta-1}\) on \([0,1]\), \(\E Y=\theta/(\theta+1)\). Setting this equal to \(\bar y\) gives \(\theta_e=\bar y/(1-\bar y)\); for the sample 0.42, 0.10, 0.65, 0.23, \(\bar y=0.35\) and \(\theta_e=0.54\).
For \(p_X(k;p,r)=\binom{k+r-1}{k}(1-p)^kp^r\), \(k=0,1,\dots\), the book uses \(\E X=r(1-p)/p\) and \(\V X=r(1-p)/p^2\) and solves \(r(1-p)/p=\bar k\), \(r(1-p)/p^2=\hat\sigma^2\), where \(\hat\sigma^2=\frac1n\sum(k_i-\bar k)^2\):
\[ p_e=\frac{\bar k}{\hat\sigma^2},\qquad r_e=\frac{\bar k^2}{\hat\sigma^2-\bar k}. \]The yearly numbers of earthquakes of magnitude above 7 from 1900 to 1999 (Table 5.2.4) have \(\bar k=19.83\) and \(\hat\sigma^2=50.69\), so \(p_e=0.391\) and \(r_e=12.74\). The fitted probabilities of the classes 0–5, 6–10, \(\dots\) give expected numbers of years 0.5, 7.1, 21.5, 28.4, 22.4, 12.3, 5.2, 1.8, 0.7 against the observed 0, 10, 20, 23, 27, 12, 5, 2, 1 (Figure 5.2.2; the book's first two entries are discussed in the notes on the book).
fig_5_2_2.Example 5.2.7 relies on three facts the book leaves to questions: (a) solving \(\E Y=\bar y\), \(\V Y=\hat\sigma^2\) is the same as Definition 5.2.3 with \(s=2\); (b) the negative binomial has mean \(r(1-p)/p\) and variance \(r(1-p)/p^2\) for every real \(r>0\); (c) the solution is a valid parameter (\(0<p_e<1\), \(r_e>0\)) exactly when \(\hat\sigma^2>\bar k\).
(a) Variance is a second moment minus a squared first moment. (b) Shift the summation index to recognise another negative binomial series. (c) Solve the two equations and ask when the answers are valid parameters.
Subtract \((\E Y)^2=\bar y^2\) from both sides of the second raw-moment equation. Aim for: \(\V Y=\hat\sigma^2\).
Compute \(\E X\) and then \(\E X(X-1)\) with the identity. Aim for: \(r(1-p)/p\) and \(r(r+1)(1-p)^2/p^2\).
Divide the equations to get \(p\), then \(r\). Aim for: both valid exactly when \(\hat\sigma^2>\bar k\).
(a) Since \(\V Y=\E(Y^2)-(\E Y)^2\) and \(\hat\sigma^2=\frac1n\sum y_i^2-\bar y^2\), the pair of equations \(\E Y=\bar y\), \(\E(Y^2)=\frac1n\sum y_i^2\) and the pair \(\E Y=\bar y\), \(\V Y=\hat\sigma^2\) differ by subtracting the equal quantities \((\E Y)^2\) and \(\bar y^2\) from the second equation; each pair implies the other.
(b) Use \(k\binom{k+r-1}{k}=r\binom{k+r-1}{k-1}\) (both equal \((k+r-1)\cdots(r+1)\,r/(k-1)!\)) and the negative binomial series \(\sum_{j\ge0}\binom{j+m-1}{j}x^j=(1-x)^{-m}\) for \(|x|<1\), \(m>0\). With \(q=1-p\),
\[ \E X=\sum_{k\ge1}r\binom{k+r-1}{k-1}q^kp^r=rq\,p^r\sum_{j\ge0}\binom{j+r}{j}q^j=rq\,p^r\,p^{-(r+1)}=\frac{r(1-p)}{p}. \]Applying the identity twice, \(k(k-1)\binom{k+r-1}{k}=r(r+1)\binom{k+r-1}{k-2}\), and the same series with \(m=r+2\) give \(\E X(X-1)=r(r+1)q^2/p^2\). Hence
\[ \V X=\frac{r(r+1)q^2}{p^2}+\frac{rq}{p}-\frac{r^2q^2}{p^2}=\frac{rq^2}{p^2}+\frac{rq}{p}=\frac{rq}{p^2}(q+p)=\frac{r(1-p)}{p^2}. \](c) Dividing the two equations gives \(p=\bar k/\hat\sigma^2\), and then \(r=\bar kp/(1-p)=\bar k^2/(\hat\sigma^2-\bar k)\). Both are valid parameters iff \(\bar k/\hat\sigma^2<1\), that is \(\hat\sigma^2>\bar k\). The model itself always has variance larger than its mean (\(\V X=\E X/p\)), so the method can only fit overdispersed data; Poisson-like data with \(\hat\sigma^2\le\bar k\) give no solution. The earthquakes pass (50.69 against 19.83). ∎
fig_x5_1.See also: Section 9.2 of the graduate course (moment estimators and their asymptotic normality) and Section 4.4.1 of the machine-learning course.
pp. 293–294 A point estimate says nothing about its own precision: \(\lambda_e=6.8\) from six Poisson counts could be off by 0.1 or by 5. A confidence interval attaches that precision, using the sampling distribution of the estimator.
Four observations 6.5, 9.2, 9.9, 12.4 come from \(\N(\mu,0.8^2)\). Since \((\bar Y-\mu)/(0.8/\sqrt4)\) is standard Normal whatever \(\mu\) is,
\[ 0.95=\P\Big(-1.96\le\frac{\bar Y-\mu}{0.8/\sqrt4}\le1.96\Big)=\P\Big(\bar Y-1.96\tfrac{0.8}{\sqrt4}\le\mu\le\bar Y+1.96\tfrac{0.8}{\sqrt4}\Big). \]The random interval \(\bar Y\pm1.96(0.8)/\sqrt4\) contains \(\mu\) with probability 0.95; on these data, \(\bar y=9.50\) and the 95% confidence interval is \((8.72,\ 10.28)\). In general \(\bar y\pm z_{\alpha/2}\sigma/\sqrt n\) is a \(100(1-\alpha)\%\) interval.
fig_5_3_1.pp. 295–297 The "95%" belongs to the procedure, not to one interval. The book shows fifty intervals computed from samples of size 4 with \(\mu=10\) (Table 5.3.1): 47 contain 10, samples 8 and 33 lie wholly above it and sample 42 wholly below (Figure 5.3.2).
fig_5_3_2.The book says that "in the long run" 95% of the intervals contain \(\mu\), and that 47 of 50 (94%) did. The precise statement: if \(m\) independent studies each compute an exact \(100(1-\alpha)\%\) interval, the number \(M\) of intervals that miss is \(\Bin(m,\alpha)\), and \(M/m\to\alpha\) in probability. For \(m=50\), \(\alpha=0.05\): \(\E M=2.5\), \(\P(M=3)=0.220\) and \(\P(M\le3)=0.760\), so three misses is entirely typical. The first-year notes prove the general statement (Theorem 3.2).
Each interval either catches the truth or not, independently, with the same probability. What distribution counts the misses?
Define \(I_j=1\) if interval \(j\) misses. Aim for: \(\P(I_j=1)=0.05\) exactly, whatever \(\mu\) is.
Sum the indicators and evaluate. Aim for: \(M\sim\Bin(50,0.05)\), \(\E M=2.5\), and \(\P(M=3)\) from the binomial formula.
Let \(I_j=1\) if interval \(j\) misses \(\mu\). By the pivot argument of Example 5.3.1, \(\P(I_j=1)=\alpha\) exactly, for every \(\mu\). Different studies use independent samples, so \(I_1,\dots,I_m\) are independent Bernoulli(\(\alpha\)) and \(M=\sum I_j\sim\Bin(m,\alpha)\) by Theorem 3.2.1. Then \(\E M=m\alpha=2.5\), \[\P(M=3)=\binom{50}3(0.05)^3(0.95)^{47}=0.220,\] and summing \(k=0,\dots,3\) gives 0.760. The weak law (Example 5.7.2 below) gives \(M/m\to\alpha\). Each miss is on the high side or the low side with probability 0.025 each, so the book's split of two above and one below is also unremarkable. ∎
The 84 maximum head breadths of Table 5.3.2 have \(\bar y=143.8\) mm. Taking \(\sigma=6.0\) mm from modern Italian males, the 95% interval is \(143.8\pm1.96(6.0)/\sqrt{84}=(142.5,\ 145.1)\) mm, far above the modern mean 132.4 mm: the data are hard to reconcile with Etruscans and modern Italians sharing one skull-size distribution. (The interval assumes the Etruscan standard deviation is also 6.0.)
Any split of \(\alpha\) into a lower tail \(a\) and an upper tail \(\alpha-a\) gives a valid interval \(\big(\bar y-z_{\alpha-a}\sigma/\sqrt n,\ \bar y+z_{a}\sigma/\sqrt n\big)\) (Question 5.3.6 asks for the confidence of such intervals). Among them, for \(0<\alpha\le1/2\), the equal split \(a=\alpha/2\) gives the unique shortest one; this is the property Question 5.3.8 asks for.
The width is proportional to \(z_a+z_{\alpha-a}\). Is this function of \(a\) convex, and where is its derivative zero?
Show \(\frac{\d z_c}{\d c}=-1/\varphi(z_c)\). Aim for: \(w'(a)=-1/\varphi(z_a)+1/\varphi(z_{\alpha-a})\).
Argue that each term of \(w'\) increases with \(a\). Aim for: \(w\) strictly convex.
Solve \(w'(a)=0\) using that \(\varphi\) is one-to-one on \([0,\infty)\).
The width is \(\frac{\sigma}{\sqrt n}w(a)\) with \(w(a)=z_a+z_{\alpha-a}\), \(0<a<\alpha\), where \(z_c=\Phi^{-1}(1-c)\). Because \(a\) and \(\alpha-a\) are below \(1/2\), both \(z\)'s are positive. Differentiating \(\Phi(z_c)=1-c\) gives \(\frac{\d z_c}{\d c}=-\frac{1}{\varphi(z_c)}\), so
\[ w'(a)=-\frac1{\varphi(z_a)}+\frac1{\varphi(z_{\alpha-a})}. \]As \(a\) increases, \(z_a\) decreases towards 0, so \(\varphi(z_a)\) increases and \(-1/\varphi(z_a)\) increases; at the same time \(z_{\alpha-a}\) increases, \(\varphi(z_{\alpha-a})\) decreases and \(1/\varphi(z_{\alpha-a})\) increases. Hence \(w'\) is strictly increasing: \(w\) is strictly convex, with a single critical point where \(\varphi(z_a)=\varphi(z_{\alpha-a})\). Since \(\varphi\) is strictly decreasing on \([0,\infty)\), this means \(z_a=z_{\alpha-a}\), i.e. \(a=\alpha/2\), and this is the global minimum. The argument uses only that \(\varphi\) is symmetric and decreasing away from 0, so it holds for any symmetric unimodal pivot (for example Student's \(t\)). ∎
If \(k\) successes are seen in \(n\) independent trials and \(n\) is large, an approximate \(100(1-\alpha)\%\) confidence interval for \(p\) is
\[ \frac kn\pm z_{\alpha/2}\sqrt{\frac{(k/n)(1-k/n)}{n}}. \]The book says it "is also true" that \((X/n-p)/\sqrt{(X/n)(1-X/n)/n}\) is approximately standard Normal. The reason is Slutsky's theorem: if \(p\) is fixed in \((0,1)\), the coverage probability of Theorem 5.3.1 tends to \(1-\alpha\) as \(n\to\infty\). The first-year notes give the complete proof (Theorem 3.9); Slutsky's theorem itself is Theorem 5.5 of the graduate course.
Split the studentised ratio into the ratio with the true standard error, times a correction factor. What does each factor converge to?
Write the ratio as \(\frac{\hat p-p}{\sqrt{p(1-p)/n}}\cdot\sqrt{\frac{p(1-p)}{\hat p(1-\hat p)}}\). Aim for: limits \(\N(0,1)\) and 1.
Apply Slutsky, then rewrite the event \(|\text{ratio}|\le z_{\alpha/2}\) as an interval for \(p\).
With \(\hat p=X/n\), split the studentised ratio into two factors:
\[ \frac{\hat p-p}{\sqrt{\hat p(1-\hat p)/n}}=\underbrace{\frac{\hat p-p}{\sqrt{p(1-p)/n}}}_{\convd\ \N(0,1)}\ \cdot\ \underbrace{\sqrt{\frac{p(1-p)}{\hat p(1-\hat p)}}}_{\convp\ 1}. \]The first factor tends in distribution to \(\N(0,1)\) by the De Moivre-Laplace theorem (Theorem 4.3.1 of the book). By the weak law, \(\hat p\convp p\), and \(x\mapsto\sqrt{p(1-p)/(x(1-x))}\) is continuous at \(x=p\), so the second factor tends to 1 in probability. Slutsky's theorem says the product tends in distribution to \(\N(0,1)\), so \(\P(-z_{\alpha/2}\le\text{ratio}\le z_{\alpha/2})\to1-\alpha\). Since the denominator does not involve \(p\), the event inside is exactly \(\{\hat p-z_{\alpha/2}\sqrt{\hat p(1-\hat p)/n}\le p\le\hat p+z_{\alpha/2}\sqrt{\hat p(1-\hat p)/n}\}\). The convergence is pointwise in \(p\): for any fixed \(n\) there are values of \(p\) near 0 or 1 where the coverage is far below \(1-\alpha\). ∎
Of 2002 people surveyed, 1281 used smartphones: \(\hat p=0.640\) and the 95% interval is \((0.619,\ 0.661)\). The "95%" again describes the method; \(p\) itself is fixed and either is or is not in the interval.
Example 5.3.2. Of 60 values meant to come from \(f_Y(y)=e^{-y}\) (Table 5.3.3), \(k=26\) fall below the median \(\ln2=0.69315\). The interval for the probability of falling below the median is \[\frac{26}{60}\pm1.96\sqrt{\frac{(26/60)(34/60)}{60}}=(0.308,\ 0.559),\] which contains 0.5: the sample passes this median test.
The width of the interval in Theorem 5.3.1 is \(2z_{\alpha/2}\sqrt{(k/n)(1-k/n)/n}\), largest when \(k/n=1/2\). The margin of error is half that largest width, \(d=z_{\alpha/2}/(2\sqrt n)\); for 95%, \(d=1.96/(2\sqrt n)\), often quoted as \(100d\%\).
A poll of 1000 voters gives 48% to Max: \(d=1.96/(2\sqrt{1000})=0.031\). The book places a Normal curve with mean 0.48 and standard deviation \(\sigma_p=d/1.96=0.0158\) over the possible values of the true proportion \(p\) (Figure 5.3.3) and finds \(\P(p>0.5)=\P(Z>1.27)=0.1020\): about a 10% chance of winning, nothing like the "statistical dead heat" of press reports. Pooling five such polls (2400 of 5000) shrinks \(d\) to 0.014 and the chance to 0.0024 (Figure 5.3.4).
fig_5_3_3.fig_5_3_4.In the frequentist framework of Section 5.3, \(p\) is a constant and "the chance that \(p>0.5\)" is either 0 or 1, as the book itself stresses after Case Study 5.3.2. The calculation of Example 5.3.3 makes sense in the Bayesian framework of Section 5.8: with a flat prior on \(p\), the posterior after \(k\) votes in \(n\) is \(\Beta(k+1,n-k+1)\), which for large \(n\) is close to \(\N\big(\hat p,\hat p(1-\hat p)/n\big)\), essentially the book's curve. For the 1000-voter poll the exact posterior probability is \(\P(p>0.5)=0.1031\); for 5000 voters, 0.00234.
A fixed \(p\) has no probability distribution, but a posterior does. Which prior makes the posterior close to the book's Normal curve?
Use the prior \(\Beta(1,1)\) and the data 480 of 1000. Aim for: \(\Beta(481,521)\).
Compute its mean and standard deviation. Aim for: about 0.48 and 0.0158, the book's values.
Evaluate \(\P(p>0.5)\) under this posterior, exactly or with the Normal approximation, and compare with 0.1020.
A flat prior is \(\Beta(1,1)\). By Example 5.8.2 (conjugacy), \(k\) successes in \(n\) trials turn it into \(\Beta(k+1,n-k+1)\); for \(k=480\), \(n=1000\) this is \(\Beta(481,521)\). Its mean is \(481/1002=0.4800\) and, by Filling the gap 5.21, its variance is \(ab/((a+b)^2(a+b+1))\) with \(a=481\), \(b=521\), so its standard deviation is 0.01578, the same as \(\sqrt{0.48\cdot0.52/1000}=0.01580\) and as the book's \(1/(2\sqrt{1000})=0.01581\) to three figures (because \(0.48\cdot0.52=0.2496\) is so close to \(1/4\)). A Beta law with both parameters large is approximately Normal (it is the law of a ratio of gamma sums, to which the central limit theorem applies), so the book's Normal curve is a very good approximation to this posterior. The exact tail is \(\P(p>0.5)=1-I_{0.5}(481,521)=0.1031\), with \(I\) the regularised incomplete beta function; the Normal value with the unrounded \(z=0.02/0.01581=1.265\) is 0.1030.
Two caveats. The answer depends on the prior: with the informative prior \(\Beta(135,135)\) of Question 5.8.3, which says the race is close, the posterior is \(\Beta(615,655)\) and \(\P(p>0.5)=0.131\). And, as the book says, a posterior from one poll describes sampling variation only, not later changes of opinion. ∎
For \(X/n\) to lie within \(d\) of \(p\) with probability at least \(1-\alpha\) (Normal approximation), whatever \(p\) is, it suffices that
\[ n\ \ge\ \frac{z_{\alpha/2}^2}{4d^2}. \]A 95% margin of error of 1% needs \(n\ge1.96^2/(4\cdot0.01^2)=9604\). If it is known that \(p\le0.22\), \(p(1-p)\le0.22\cdot0.78\) and \(n\ge1.96^2(0.22)(0.78)/0.01^2=6592.2\), so 6593 suffice, 31% fewer.
(a) \(p(1-p)\le1/4\) on \([0,1]\), with equality only at \(p=1/2\), and \(p(1-p)\) increases on \([0,1/2]\). (b) The approximate probability \(\P(|X/n-p|\le d)\) is smallest at \(p=1/2\), so the sample size that works there works for every \(p\); with a known bound \(p\le p_0\le1/2\), \(n=z^2p_0(1-p_0)/d^2\) suffices. (c) If the \(n\) people are drawn without replacement from a population of \(N\), the margin of error becomes \(d=\frac{z_{\alpha/2}}{2\sqrt n}\sqrt{\frac{N-n}{N-1}}\), and the sample size for a target \(d\) is \(n=n_0N/(N-1+n_0)\) with \(n_0=z^2/(4d^2)\).
The approximate probability \(2\Phi(d\sqrt n/\sqrt{p(1-p)})-1\) is smallest when \(p(1-p)\) is largest. Where is that, and what does it give?
Complete the square. Aim for: the maximum \(1/4\) at \(p=\frac12\) only.
Set the worst-case probability equal to \(1-\alpha\). Aim for: \(2d\sqrt n=z_{\alpha/2}\).
Multiply the variance by \((N-n)/(N-1)\), redo Definition 5.3.1 and solve \(d^2=\frac{z^2}{4n}\frac{N-n}{N-1}\) for \(n\).
(a) \(p(1-p)=\frac14-\big(p-\frac12\big)^2\), so the maximum \(1/4\) is attained only at \(1/2\), and the function increases on \([0,1/2]\) (its derivative \(1-2p\) is positive there). Question 5.3.18 asks for the same with derivatives: \(g'(p)=1-2p\), \(g''=-2<0\).
(b) By the Normal approximation, \(\P(|X/n-p|\le d)\approx2\Phi\big(d\sqrt n/\sqrt{p(1-p)}\big)-1\), which decreases as \(p(1-p)\) increases. By (a) its smallest value over \(p\) is \(2\Phi(2d\sqrt n)-1\), and this equals \(1-\alpha\) exactly when \(2d\sqrt n=z_{\alpha/2}\), i.e. \(n=z^2_{\alpha/2}/(4d^2)\). Larger \(n\) only increases it. If \(p\le p_0\le\frac12\), then \(p(1-p)\le p_0(1-p_0)\) by monotonicity, and the same argument gives \(n=z^2p_0(1-p_0)/d^2\) (Example 5.3.4). If only \(p\le p_0\) with \(p_0>1/2\) is known, nothing is gained, since \(p=1/2\) is still possible.
(c) Without replacement \(X\) is hypergeometric and \(\V(X/n)=\frac{p(1-p)}n\cdot\frac{N-n}{N-1}\) (Example 3.9.10; Filling the gap 3.20 of Chapter 3). Repeating Definition 5.3.1 with this variance multiplies \(d\) by \(\sqrt{(N-n)/(N-1)}\) (Question 5.3.21). Solving \(d^2=\frac{z^2}{4n}\frac{N-n}{N-1}\) for \(n\): \(4d^2n(N-1)=z^2(N-n)\), so \(n\big(4d^2(N-1)+z^2\big)=z^2N\), and dividing by \(4d^2\) gives \(n=n_0N/(N-1+n_0)\). For an audit of \(N=1586\) files with 85% confidence and \(d=0.03\) (Question 5.3.28), \(n_0=1.44^2/(4\cdot0.03^2)=576\) and the correction gives \(n=423\). ∎
See also: Section 3 of the first-year advanced notes (intervals by pivots), Section 6.3.2 of the graduate course (confidence sets) and its Theorem 4.5 (a Hoeffding interval valid for every \(n\)).
pp. 308–310 The two methods of Section 5.2 can disagree: for \(f_Y(y;\theta)=2y/\theta^2\) on \([0,\theta]\), maximum likelihood gives \(Y_{\max}\) and moments give \(\frac32\bar Y\) (Questions 5.2.12, 5.2.17). To choose, one studies each estimator as a random variable: its distribution, mean and variance.
With \(p=0.6\), the estimator \(X/10\) lies within 0.10 of \(p\) when \(5\le X\le7\), with probability \(\sum_{k=5}^7\binom{10}k0.6^k0.4^{10-k}=0.6665\). For \(n=100\), the Normal approximation gives \[\P(|X/100-0.6|\le0.1)=\P(|Z|\le2.04)=0.9586\] (0.9588 without rounding) (Figure 5.4.1).
fig_5_4_1.An estimator \(\hat\theta=h(Y_1,\dots,Y_n)\) is unbiased for \(\theta\) if \(\E(\hat\theta)=\theta\) for every value of \(\theta\). It is asymptotically unbiased if \(\E(\hat\theta_n)\to\theta\) (Question 5.4.15).
For \(f_Y(y;\theta)=2y/\theta^2\), \(\E Y=\frac23\theta\), so \(\frac32\bar Y\) is unbiased. By Theorem 3.10.1, \(Y_{\max}\) has density \(nF_Y(y)^{n-1}f_Y(y)=2ny^{2n-1}/\theta^{2n}\) and \(\E Y_{\max}=\frac{2n}{2n+1}\theta\): biased low (0.89\(\theta\) for \(n=4\)) but asymptotically unbiased, and \(\frac{2n+1}{2n}Y_{\max}\) is unbiased.
If \(\E X_i=\theta\), then \(\E\sum a_iX_i=\theta\sum a_i\), so \(\sum a_iX_i\) is unbiased exactly when \(\sum a_i=1\).
(a) If \(X_1,\dots,X_n\) are uncorrelated with common mean \(\theta\) and variance \(\sigma^2\), then among all unbiased \(\sum a_iX_i\) the sample mean has the smallest variance, \(\sigma^2/n\) (it is the "best linear unbiased" estimator). (b) For independent unbiased \(W_1,W_2\) with variances \(\sigma_1^2,\sigma_2^2\), the variance of \(cW_1+(1-c)W_2\) is smallest at \(c=\sigma_2^2/(\sigma_1^2+\sigma_2^2)\), where it equals \(\sigma_1^2\sigma_2^2/(\sigma_1^2+\sigma_2^2)\), smaller than either variance.
The variance of \(\sum a_iX_i\) is \(\sigma^2\sum a_i^2\), with the constraint \(\sum a_i=1\). Which inequality links \(\sum a_i\) and \(\sum a_i^2\)?
Apply Cauchy-Schwarz to \((a_i)\) and \((1,\dots,1)\). Aim for: \(\sum a_i^2\ge1/n\), equality iff all \(a_i=1/n\).
Differentiate \(v(c)=c^2\sigma_1^2+(1-c)^2\sigma_2^2\). Aim for: \(c^*=\sigma_2^2/(\sigma_1^2+\sigma_2^2)\), then substitute.
(a) \(\V\sum a_iX_i=\sigma^2\sum a_i^2\) (Theorem 3.9.5; the covariances vanish). By the Cauchy-Schwarz inequality, \(1=\big(\sum a_i\cdot1\big)^2\le\big(\sum a_i^2\big)\big(\sum1^2\big)=n\sum a_i^2\), so \(\sum a_i^2\ge1/n\), with equality iff \((a_i)\) is proportional to \((1,\dots,1)\), i.e. every \(a_i=1/n\). Example 5.4.5 is the case \(n=3\): the weights \((\frac14,\frac12,\frac14)\) give \(\frac38\sigma^2\) against \(\frac13\sigma^2\).
(b) \(v(c)=c^2\sigma_1^2+(1-c)^2\sigma_2^2\) is a parabola with \(v'(c)=2c\sigma_1^2-2(1-c)\sigma_2^2\), zero at \(c^*=\sigma_2^2/(\sigma_1^2+\sigma_2^2)\), and \(v''=2(\sigma_1^2+\sigma_2^2)>0\). Substituting, \(v(c^*)=\frac{\sigma_2^4\sigma_1^2+\sigma_1^4\sigma_2^2}{(\sigma_1^2+\sigma_2^2)^2}=\frac{\sigma_1^2\sigma_2^2}{\sigma_1^2+\sigma_2^2}\), and this is below \(\min(\sigma_1^2,\sigma_2^2)\) because \(\sigma_2^2/(\sigma_1^2+\sigma_2^2)<1\). Each estimate is weighted by the inverse of its variance, the rule behind pooling polls in Example 5.3.3. ∎
For any sample with mean \(\mu\) and variance \(\sigma^2\), \(\E\frac1n\sum(Y_i-\bar Y)^2=\frac{n-1}n\sigma^2\): the maximum likelihood estimator of a Normal variance is biased low. Multiplying by \(n/(n-1)\) gives the unbiased sample variance \(S^2=\frac1{n-1}\sum(Y_i-\bar Y)^2\). The first-year notes prove this and explain the \(n-1\) geometrically (Theorem 1.3, why \(n-1\)?).
The book remarks that \(\E(S)\ne\sigma\) although \(\E(S^2)=\sigma^2\). In fact \(\E(S)<\sigma\) for any distribution with \(\sigma>0\) (as long as \(S\) is not constant), and for Normal data \(\E(S)=c_4\sigma\) with
\[ c_4=\sqrt{\frac2{n-1}}\ \frac{\Gamma(n/2)}{\Gamma((n-1)/2)}, \]for example \(c_4=0.798\) for \(n=2\) and \(0.940\) for \(n=5\).
A variance is never negative. What does \(\V(S)\ge0\) say about \((\E S)^2\) and \(\E S^2\)?
Deduce \(\E S\le\sigma\) and say when equality could hold.
For Normal data compute \(\E\sqrt U\) for \(U\sim\chi^2_k\). Aim for: \(\sqrt2\,\Gamma(\frac{k+1}2)/\Gamma(\frac k2)\); then rescale by \(\sigma/\sqrt{n-1}\).
Since \(\V(S)=\E(S^2)-(\E S)^2\ge0\), \((\E S)^2\le\E S^2=\sigma^2\), so \(\E S\le\sigma\), with equality only if \(\V(S)=0\), i.e. \(S\) is almost surely constant. For a continuous distribution and \(n\ge2\), \(S\) takes a continuum of values, so the inequality is strict.
For Normal data, \(U=(n-1)S^2/\sigma^2\) has the \(\chi^2_{k}\) density \(u^{k/2-1}e^{-u/2}/(2^{k/2}\Gamma(k/2))\), \(k=n-1\) (the normal-sample theorem, Theorem 0.9 of the first-year notes). Then
\[ \E\sqrt U=\int_0^\infty\frac{u^{(k+1)/2-1}e^{-u/2}}{2^{k/2}\Gamma(k/2)}\,\d u=\frac{2^{(k+1)/2}\Gamma((k+1)/2)}{2^{k/2}\Gamma(k/2)}=\sqrt2\,\frac{\Gamma((k+1)/2)}{\Gamma(k/2)}, \]using \(\int_0^\infty u^{a-1}e^{-u/2}\d u=2^a\Gamma(a)\). As \(S=\sigma\sqrt{U/(n-1)}\), \(\E S=\frac{\sigma}{\sqrt{n-1}}\sqrt2\,\frac{\Gamma(n/2)}{\Gamma((n-1)/2)}=c_4\sigma\). For \(n=2\): \(\sqrt2\,\Gamma(1)/\Gamma(1/2)=\sqrt{2/\pi}=0.798\). ∎
If \(\hat\theta_1\) and \(\hat\theta_2\) are both unbiased and \(\V\hat\theta_1<\V\hat\theta_2\), \(\hat\theta_1\) is more efficient; the relative efficiency of \(\hat\theta_1\) with respect to \(\hat\theta_2\) is \(\V(\hat\theta_2)/\V(\hat\theta_1)\).
For three Normal observations, \(\V(\frac14Y_1+\frac12Y_2+\frac14Y_3)=\frac38\sigma^2\) and \(\V\bar Y=\frac13\sigma^2\): relative efficiency 1.125 in favour of \(\bar Y\).
Example 5.4.6. For \(2y/\theta^2\), \(\V(\frac32\bar Y)=\frac{\theta^2}{8n}\), while \(\V Y_{\max}=\frac{n}{(n+1)(2n+1)^2}\theta^2\) gives
\[ \V\Big(\frac{2n+1}{2n}Y_{\max}\Big)=\frac{\theta^2}{4n(n+1)}, \]so for \(n>1\) the maximum-based estimator wins, with relative efficiency \((n+1)/2\), which grows without bound (Figure x5.2).
fig_x5_2.See also: Section 1 of the first-year advanced notes (bias, standard error and mean squared error, Theorem 1.1) and Theorem 6.9 of the graduate course.
Let \(f_Y(y;\theta)\) have continuous first and second derivatives in \(\theta\), and suppose the set where \(f_Y(y;\theta)\ne0\) does not depend on \(\theta\). If \(\hat\theta=h(Y_1,\dots,Y_n)\) is unbiased for \(\theta\), then
\[ \V(\hat\theta)\ \ge\ \Big\{n\,\E\Big[\Big(\frac{\partial\ln f_Y(Y;\theta)}{\partial\theta}\Big)^2\Big]\Big\}^{-1} \] \[ =\Big\{-n\,\E\Big[\frac{\partial^2\ln f_Y(Y;\theta)}{\partial\theta^2}\Big]\Big\}^{-1}. \]The same holds for a probability function \(p_X(k;\theta)\). The quantity \(I(\theta)=\E[(\partial_\theta\ln f_Y(Y;\theta))^2]\) is the Fisher information in one observation; the bound is \(1/(nI(\theta))\).
The book's proof is "see (101)". The bound holds under these conditions: (R1) the support \(A=\{y:f_Y(y;\theta)>0\}\) is the same for all \(\theta\) in an open interval; (R2) \(f_Y\) is differentiable in \(\theta\) on \(A\); (R3) differentiation in \(\theta\) may be taken inside the integrals \(\int f_Y\,\d y\) and \(\int h(\bm y)\prod f_Y(y_i;\theta)\,\d\bm y\); (R4) \(0<I(\theta)<\infty\). The second form needs, in addition, that \(\int f_Y\,\d y\) can be differentiated twice under the integral sign. The first-year notes prove the bound in full (Theorem 2.4); here is the sketch, and a full proof that the two forms agree.
The score has mean 0 and covariance 1 with every unbiased estimator. What does Cauchy-Schwarz then say? For the second part, differentiate \(\ln f\) twice.
Differentiate \(\int f\,\d y=1\) and \(\int h\prod f\,\d\bm y=\theta\). Aim for: \(\E U=0\) and \(\Cov(\hat\theta,U)=1\).
Combine with \(\V U=nI(\theta)\) in Cauchy-Schwarz.
For the two forms: expand \(\partial^2_\theta\ln f=f''/f-(f'/f)^2\), integrate against \(f\), and use \(\int f''\,\d y=0\).
The bound (sketch). Let \(U=\sum_{i=1}^n\partial_\theta\ln f_Y(Y_i;\theta)\), the score. Differentiating \(\int_Af_Y\,\d y=1\) under the integral (R3) gives \(\int_A\partial_\theta f_Y\,\d y=0\), that is \(\E[\partial_\theta\ln f_Y(Y;\theta)]=0\) (because \(\partial_\theta\ln f=\partial_\theta f/f\)). So \(\E U=0\) and, the terms being independent, \(\V U=nI(\theta)\). Differentiating \(\theta=\E\hat\theta=\int h\prod f_Y\,\d\bm y\) under the integral gives \(1=\int h\,U\prod f_Y\,\d\bm y=\E(\hat\theta U)=\Cov(\hat\theta,U)\). The Cauchy-Schwarz inequality \(\Cov(\hat\theta,U)^2\le\V(\hat\theta)\V(U)\) then reads \(1\le\V(\hat\theta)\,nI(\theta)\).
The two forms agree. Write \(f=f_Y(y;\theta)\) and \(f',f''\) for its \(\theta\)-derivatives. Then
\[ \frac{\partial^2\ln f}{\partial\theta^2}=\frac{\partial}{\partial\theta}\Big(\frac{f'}{f}\Big)=\frac{f''}{f}-\Big(\frac{f'}{f}\Big)^2. \]Multiply by \(f\) and integrate over \(A\): \(\E[\partial^2_\theta\ln f]=\int_Af''\,\d y-\E[(\partial_\theta\ln f)^2]\). Differentiating \(\int_Af\,\d y=1\) twice under the integral gives \(\int_Af''\,\d y=0\). Hence \(-\E[\partial_\theta^2\ln f(Y;\theta)]=I(\theta)\), and the two expressions in Theorem 5.5.1 are equal. In the discrete case replace the integrals by sums over the support. ∎
For Bernoulli trials, \[\partial^2_p\ln p_X(X;p)=-\frac{X}{p^2}-\frac{1-X}{(1-p)^2},\] whose mean is \(-1/(p(1-p))\). The bound is \(p(1-p)/n\), exactly \(\V(X/n)\): no unbiased estimator of \(p\) is more precise than the sample proportion.
An unbiased \(\hat\theta^*\) is best (minimum-variance unbiased) if \(\V\hat\theta^*\le\V\hat\theta\) for every unbiased \(\hat\theta\). An unbiased \(\hat\theta\) is efficient if its variance equals the Cramér-Rao bound, and its efficiency is the bound divided by \(\V\hat\theta\). Efficient implies best; the converse fails (Filling the gap 5.14).
The book says that sometimes no unbiased estimator attains the bound, without saying which. Under the conditions of Filling the gap 5.12, an unbiased \(\hat\theta\) is efficient if and only if the score is a linear function of it:
\[ \frac{\partial}{\partial\theta}\ln L(\theta)=nI(\theta)\,(\hat\theta-\theta)\qquad\text{for all }\theta\text{ (with probability 1)}. \]So the Bernoulli proportion, the Poisson and Normal means and the exponential mean \(\bar Y\) are efficient, but no unbiased estimator of an exponential rate \(\lambda\) is.
The bound came from Cauchy-Schwarz. When is Cauchy-Schwarz an equality?
Write \(\hat\theta-\theta=cU\) and take the covariance with \(U\). Aim for: \(c=1/(nI(\theta))\).
Compute the score for Bernoulli, Poisson and the exponential mean. Aim for: each is \(nI(\theta)(\text{estimator}-\theta)\).
Exponential rate: suppose \(n/\lambda-s=a(\lambda)(T-\lambda)\) for all \(\lambda\) and compare two values of \(\lambda\) as functions of \(s\).
In the proof of the bound, equality holds iff equality holds in Cauchy-Schwarz, \(\Cov(\hat\theta,U)^2=\V(\hat\theta)\V(U)\). Since \(\V U=nI>0\), this happens iff \(\hat\theta-\E\hat\theta=c\,(U-\E U)\) with probability 1 for some constant \(c\) (which may depend on \(\theta\)), i.e. \(\hat\theta-\theta=cU\). Taking the covariance of both sides with \(U\) gives \(1=c\,nI(\theta)\), so \(U=nI(\theta)(\hat\theta-\theta)\).
Examples. Bernoulli: \(U=\sum\big(\frac{X_i}p-\frac{1-X_i}{1-p}\big)=\frac{n}{p(1-p)}(\hat p-p)\). Poisson: \(U=\sum\big(\frac{X_i}\lambda-1\big)=\frac n\lambda(\bar X-\lambda)\). Exponential with mean \(\theta\), \(f=e^{-y/\theta}/\theta\): \(U=\sum\big(-\frac1\theta+\frac{Y_i}{\theta^2}\big)=\frac n{\theta^2}(\bar Y-\theta)\). Each has the required form with \(nI\) in front.
Exponential with rate \(\lambda\), \(f=\lambda e^{-\lambda y}\): \(U=\frac n\lambda-s\) with \(s=\sum y_i\). If some statistic \(T\) had \(U=a(\lambda)(T-\lambda)\) for all \(\lambda\), then \(T=\lambda+\big(\frac n\lambda-s\big)/a(\lambda)\) for every \(\lambda\). Comparing two values \(\lambda_1\ne\lambda_2\) as functions of \(s\), the coefficients of \(s\) force \(a(\lambda_1)=a(\lambda_2)=a\), a constant, and then the constant terms force \(\lambda_1+\frac n{a\lambda_1}=\lambda_2+\frac n{a\lambda_2}\) for all pairs, which is false since \(\lambda+n/(a\lambda)\) is not constant. So no unbiased estimator of \(\lambda\) attains \(\lambda^2/n\). ∎
For an exponential sample with rate \(\lambda\) and \(n\ge3\), \(T=(n-1)/\sum Y_i\) is unbiased with
\[ \V(T)=\frac{\lambda^2}{n-2}\ >\ \frac{\lambda^2}n=\text{Cram\'er-Rao bound}, \]so its efficiency is \((n-2)/n<1\). Yet \(T\) is the best unbiased estimator of \(\lambda\) (a consequence of the Rao-Blackwell theorem of Filling the gap 5.19 and the completeness of \(\sum Y_i\), a notion beyond the book). By Filling the gap 5.13 nothing attains the bound, so "best" is the most one can ask for.
The sum \(S\) is gamma, so the moments \(\E S^{-1}\) and \(\E S^{-2}\) are gamma integrals. Compare the resulting variance with \(\lambda^2/n\).
Compute \(\E(S^{-m})\) for \(m<n\). Aim for: \(\lambda^m\Gamma(n-m)/\Gamma(n)\).
Use \(m=1,2\) to get \(\E T\) and \(\V T\). Aim for: \(\lambda\) and \(\lambda^2/(n-2)\).
Compute \(I(\lambda)\) from \(\ln f=\ln\lambda-\lambda y\) and compare.
\(S=\sum Y_i\) has the gamma density \(\lambda^ns^{n-1}e^{-\lambda s}/\Gamma(n)\) (Theorem 4.6.4 of the book). For \(m<n\),
\[ \E(S^{-m})=\frac{\lambda^n}{\Gamma(n)}\int_0^\infty s^{n-m-1}e^{-\lambda s}\d s=\frac{\lambda^n\,\Gamma(n-m)}{\Gamma(n)\,\lambda^{n-m}}=\lambda^m\frac{\Gamma(n-m)}{\Gamma(n)}. \]With \(m=1\): \(\E(1/S)=\lambda/(n-1)\), so \(\E T=\lambda\). With \(m=2\) (needs \(n\ge3\)): \(\E(1/S^2)=\lambda^2/((n-1)(n-2))\), so \(\E T^2=(n-1)\lambda^2/(n-2)\) and \(\V T=\lambda^2\big(\frac{n-1}{n-2}-1\big)=\frac{\lambda^2}{n-2}\). The information is \(I(\lambda)=-\E\,\partial^2_\lambda(\ln\lambda-\lambda Y)=1/\lambda^2\), so the bound is \(\lambda^2/n\). Note that the maximum likelihood estimator \(1/\bar Y=n/S\) is biased: \(\E(n/S)=\frac{n}{n-1}\lambda\). ∎
For \(f_Y(y;\theta)=2y/\theta^2\) on \([0,\theta]\), \(\partial_\theta\ln f=-2/\theta\), so \(\E[(\partial_\theta\ln f)^2]=4/\theta^2\) and the formula gives \(\theta^2/(4n)\). But \(\V(\frac32\bar Y)=\theta^2/(8n)\) is smaller. There is no contradiction: the support \([0,\theta]\) depends on \(\theta\), violating the hypotheses of Theorem 5.5.1.
The book attributes the failure to the moving support. The precise point: the score has mean \(-2/\theta\), not 0, because differentiating \(\int_0^\theta f_Y\,\d y=1\) produces a boundary term. The score is even a constant, so it carries no information about where \(\hat\theta\) falls, and the Cauchy-Schwarz step yields nothing. Estimators based on \(Y_{\max}\) then reach variances of order \(1/n^2\), far below any \(c/n\).
The identity \(\E(\text{score})=0\) came from differentiating \(\int f=1\) under the integral. What extra term appears when the upper limit of the integral is \(\theta\) itself?
Differentiate \(\int_0^\theta 2y/\theta^2\,\d y\). Aim for: the boundary term \(f(\theta;\theta)=2/\theta\) plus \(\int\partial_\theta f=-2/\theta\).
Note that the total score \(-2n/\theta\) is a constant. Aim for: its covariance with any \(\hat\theta\) is 0, not 1.
Compare \(\theta^2/(4n(n+1))\) with \(\theta^2/(4n)\) as \(n\) grows.
By Leibniz's rule for an integral with a variable upper limit,
\[ 0=\frac{\d}{\d\theta}\int_0^\theta\frac{2y}{\theta^2}\d y=\underbrace{f_Y(\theta;\theta)}_{=2/\theta}+\int_0^\theta\frac{\partial}{\partial\theta}\frac{2y}{\theta^2}\d y=\frac2\theta+\int_0^\theta\Big(-\frac{4y}{\theta^3}\Big)\d y=\frac2\theta-\frac2\theta. \]So \(\int\partial_\theta f\,\d y=-2/\theta\ne0\): the interchange (R3) fails because the density does not vanish at the moving end point. Accordingly \(\E[\partial_\theta\ln f(Y;\theta)]=-2/\theta\). The total score \(U=-2n/\theta\) is non-random, so \(\Cov(\hat\theta,U)=0\) for every \(\hat\theta\) and the identity \(\Cov(\hat\theta,U)=1\) of the proof is false. By Example 5.4.6, \(\V\big(\frac{2n+1}{2n}Y_{\max}\big)=\theta^2/(4n(n+1))\), which is of order \(1/n^2\); the "bound" \(\theta^2/(4n)\) is beaten by a factor \(n+1\) (Figure x5.2b). Question 5.5.4 shows the same for Uniform(0, \(\theta\)). ∎
See also: Section 2.3 of the first-year advanced notes, and Theorem 9.17 and Theorem 9.23 of the graduate course (information identities, asymptotic efficiency of the MLE).
pp. 319–320, (5.6.1) A statistic is sufficient if, once its value is known, the rest of the data carry no further information about \(\theta\): the conditional distribution of the sample given the statistic does not involve \(\theta\). For Bernoulli trials and \(\hat p=\frac1n\sum X_i\), every sequence with \(\sum k_i=t\) has probability \(p^t(1-p)^{n-t}\) and there are \(\binom nt\) of them, so
\[ \P\Big(X_1=k_1,\dots,X_n=k_n\ \Big|\ \sum X_i=t\Big)=\frac{p^t(1-p)^{n-t}}{\binom nt p^t(1-p)^{n-t}}=\binom nt^{-1}, \tag{5.6.1} \]free of \(p\): given the number of successes, every arrangement is equally likely whatever \(p\) is. With \(\hat p^*=X_1\) instead, the conditional probability is \(p^{\sum_{i\ge2}k_i}(1-p)^{n-1-\sum_{i\ge2}k_i}\), which still depends on \(p\): \(X_1\) is not sufficient.
pp. 320–321 Two illustrations from the book. Dice: told only that a sum of two dice is at most 7, the chance that it is even is \(9/21\); told that it is odd, the question is settled. And for \(2y/\theta^2\), the samples \((3,4,5)\) and \((1,3,8)\) both give \(\frac32\bar y=6\), but only the first allows \(\theta=4\): the moment estimator forgets the largest observation, which matters. It is not sufficient.
\(\hat\theta=h(X_1,\dots,X_n)\) is sufficient for \(\theta\) if the likelihood factors as
\[ L(\theta)=\prod_{i=1}^np_X(k_i;\theta)=p_{\hat\theta}(\theta_e;\theta)\,b(k_1,\dots,k_n), \]where \(p_{\hat\theta}\) is the probability function of \(\hat\theta\), \(\theta_e=h(k_1,\dots,k_n)\), and \(b\) does not involve \(\theta\). This is equation (5.6.2) cross-multiplied: \(b\) is the conditional probability of the sample given \(\hat\theta=\theta_e\). Any one-to-one function of a sufficient statistic is sufficient (Question 5.6.3).
\(\hat\lambda=\sum X_i\) is Poisson with mean \(n\lambda\), and
\[ L(\lambda)=\frac{e^{-n\lambda}\lambda^{t}}{\prod k_i!}=\underbrace{\frac{e^{-n\lambda}(n\lambda)^t}{t!}}_{p_{\hat\lambda}(t;\lambda)}\cdot\underbrace{\frac{t!}{n^t\prod k_i!}}_{b(k_1,\dots,k_n)},\qquad t=\sum k_i, \]so the sum is sufficient; so is the unbiased \(\bar X=\hat\lambda/n\). The factor \(b\) is the multinomial probability of splitting \(t\) among \(n\) equally likely cells: given the total, the counts are \(\mathrm{Multinomial}(t;\frac1n,\dots,\frac1n)\), whatever \(\lambda\) is.
\(\hat\theta=h(X_1,\dots,X_n)\) is sufficient for \(\theta\) if and only if there are functions \(g\) and \(b\), with \(b\) free of \(\theta\), such that
\[ L(\theta)=g\big[h(k_1,\dots,k_n);\theta\big]\cdot b(k_1,\dots,k_n). \]The book proves the discrete case (summing the factorization over the set \(h^{-1}(c)\) shows that \(g(c;\theta)\) is the probability function of \(\hat\theta\) up to a factor free of \(\theta\)) and states that a similar statement holds for densities.
For continuous data, "the conditional distribution given \(\hat\theta\)" needs care, because \(\{\hat\theta=t\}\) has probability 0. A clean version at the level of the book: suppose there are functions \(u(\bm y)\) (with values in \(\R^{n-1}\)) such that \(\bm y\mapsto(t,\bm u)=(h(\bm y),u(\bm y))\) is one-to-one and differentiable with non-zero Jacobian \(J(\bm y)\), free of \(\theta\). Then the conditional density of \(\bm U\) given \(T=t\) is free of \(\theta\) if and only if \(L(\theta)=g(h(\bm y);\theta)\,b(\bm y)\).
Complete \(T\) by auxiliary variables \(\bm u\) and change variables. A joint density that factors as \(g(t;\theta)\times\)(something free of \(\theta\)) has a conditional density free of \(\theta\).
Write \(f_{T,\bm U}=L(\theta;\bm y)/|J(\bm y)|\).
(\(\Leftarrow\)) Insert \(L=g\,b\), integrate out \(\bm u\). Aim for: \(f_T=g(t;\theta)B(t)\) and a conditional density \(\beta/B\).
(\(\Rightarrow\)) Write \(f_{T,\bm U}=f_T\cdot c(\bm u\mid t)\) and multiply back by \(|J|\).
By the change-of-variables formula for joint densities, \(f_{T,\bm U}(t,\bm u;\theta)=L(\theta;\bm y)/|J(\bm y)|\) evaluated at the \(\bm y\) with \(h(\bm y)=t\), \(u(\bm y)=\bm u\).
(\(\Leftarrow\)) If \(L=g(t;\theta)b(\bm y)\), then \(f_{T,\bm U}=g(t;\theta)\,\beta(t,\bm u)\) with \(\beta=b/|J|\) free of \(\theta\). Integrating out \(\bm u\): \(f_T(t;\theta)=g(t;\theta)B(t)\) with \(B(t)=\int\beta(t,\bm u)\d\bm u\). Where \(f_T>0\), the conditional density \(f_{\bm U\mid T}(\bm u\mid t)=f_{T,\bm U}/f_T=\beta(t,\bm u)/B(t)\) does not involve \(\theta\).
(\(\Rightarrow\)) If \(f_{\bm U\mid T}(\bm u\mid t)=c(\bm u\mid t)\) is free of \(\theta\), then \(L(\theta;\bm y)=|J(\bm y)|\,f_T(h(\bm y);\theta)\,c(u(\bm y)\mid h(\bm y))\), which is the factorization with \(g=f_T\) (so it is even the form of Definition 5.6.1) and \(b=|J|\,c\). For a general proof without the auxiliary \(\bm u\) one needs measure-theoretic conditional probability; see the references. ∎
Example: for \(n\) exponential observations with mean \(\theta\), \(L=\theta^{-n}e^{-\sum y_i/\theta}\), so \(T=\sum Y_i\) is sufficient; with \(u_i=y_i/\sum y_j\) (\(i<n\)) the conditional law of the proportions given the total is uniform on the simplex for every \(\theta\).
With the indicator \(I_{[0,\theta]}(y)\) the density is \(\frac{2y}{\theta^2}I_{[0,\theta]}(y)\) for all \(y\), and \(\prod_iI_{[0,\theta]}(y_i)=I_{[0,\theta]}(y_{\max})\) for non-negative data. So
\[ L(\theta)=\frac{I_{[0,\theta]}(y_{\max})}{\theta^{2n}}\cdot\prod_{i=1}^n2y_i, \]which is of the form of Theorem 5.6.1: \(Y_{\max}\) is sufficient. The book asks why the argument fails for \(Y_{\min}\).
A practical test: if \(T\) is sufficient and two samples \(\bm y,\bm y'\) have \(T(\bm y)=T(\bm y')\), then \(L(\theta;\bm y)\) and \(L(\theta;\bm y')\) are proportional as functions of \(\theta\) (their ratio is \(b(\bm y)/b(\bm y')\), free of \(\theta\)). Two samples with the same \(T\) but non-proportional likelihoods prove that \(T\) is not sufficient.
If \(T\) were sufficient, two samples with the same \(T\) would have proportional likelihoods. Can you find two samples with the same \(T\) whose likelihoods are not proportional?
For \(Y_{\min}\): take two samples with the same minimum but different maxima. Aim for: a \(\theta\) where one likelihood is 0 and the other is not.
Turn that into a contradiction with \(L=g(y_{\min};\theta)b(\bm y)\).
For \(X_1+2X_2+3X_3\): find two samples with \(T=3\) and compute the ratio of their likelihoods.
\(Y_{\min}\) for \(2y/\theta^2\). Take \(n=2\), \(\bm y=(1,2)\) and \(\bm y'=(1,3)\), both with \(y_{\min}=1\). Then \(L(\theta;\bm y)=\frac{8}{\theta^4}\one\{\theta\ge2\}\) and \(L(\theta;\bm y')=\frac{12}{\theta^4}\one\{\theta\ge3\}\). Suppose \(L=g(y_{\min};\theta)b(\bm y)\). Since \(L(4;\bm y')>0\), \(b(\bm y')>0\); since \(L(2.5;\bm y')=0\), \(g(1;2.5)=0\); but then \(L(2.5;\bm y)=g(1;2.5)b(\bm y)=0\), whereas in fact \(L(2.5;\bm y)=8/2.5^4>0\). Contradiction. The smallest observation cannot tell whether \(\theta\) is at least as large as the others.
\(X_1+2X_2+3X_3\) for Bernoulli trials. The samples \((1,1,0)\) and \((0,0,1)\) both give \(T=3\). Their likelihoods are \(p^2(1-p)\) and \(p(1-p)^2\), with ratio \(p/(1-p)\), which varies with \(p\). Equivalently, \(\P\big((1,1,0)\mid T=3\big)=\frac{p^2(1-p)}{p^2(1-p)+p(1-p)^2}=p\): the conditional law still contains \(p\). ∎
p. 325 The book draws two consequences: maximum likelihood estimators are functions of sufficient statistics, and the search for efficient estimators may be restricted to functions of sufficient statistics. The first needs a qualification, the second a correction.
If \(T\) is sufficient and the maximum likelihood estimate is unique, it is a function of \(T\). If the maximiser is not unique, it is always possible to choose one that is a function of \(T\), but not every choice is.
The factor \(b(\bm y)\) does not involve \(\theta\), so it does not move the maximiser. On what does the maximiser of \(g(T(\bm y);\theta)\) depend?
Show the set of maximisers of \(L(\cdot;\bm y)\) equals that of \(g(T(\bm y);\cdot)\). Aim for: a set depending on \(\bm y\) only through \(T\).
For a non-unique maximum, give one choice that is a function of \(T\) and one that is not.
By Theorem 5.6.1, \(L(\theta;\bm y)=g(T(\bm y);\theta)b(\bm y)\). For a sample with \(b(\bm y)>0\) (otherwise \(L\equiv0\)), the maximisers of \(L(\cdot;\bm y)\) are exactly the maximisers of \(\theta\mapsto g(T(\bm y);\theta)\), a set \(M(T(\bm y))\) that depends on \(\bm y\) only through \(T\). If it is a single point, \(\theta_e=\phi(T(\bm y))\). If not, choosing (say) the smallest element of \(M(t)\) gives a maximiser that is a function of \(T\).
Non-uniqueness happens: for Uniform\((\theta-\frac12,\theta+\frac12)\), \(L(\theta)=\one\{y_{\max}-\frac12\le\theta\le y_{\min}+\frac12\}\), so every point of that interval is a maximum likelihood estimate and \(T=(Y_{\min},Y_{\max})\) is sufficient. The choice "\(\bar y\) moved into the interval if it lies outside" is a maximum likelihood estimate that depends on all of the data, not only on \(T\). The moment estimator \(\frac32\bar Y\) of the \(2y/\theta^2\) model, by contrast, is not a function of the sufficient \(Y_{\max}\), which is the book's argument for preferring maximum likelihood. ∎
The book states that every unbiased estimator based on a sufficient statistic has smaller variance than every unbiased estimator that is not. Taken literally this cannot be right (the whole sample is always sufficient, so every estimator is "based on a sufficient statistic"), and it is false even for a minimal sufficient statistic (counterexample below). The correct statement is the Rao-Blackwell theorem: if \(T\) is sufficient and \(\hat\theta\) is unbiased with finite variance, then \(\theta^*=\E(\hat\theta\mid T)\) is a statistic, is unbiased, and \(\V\theta^*\le\V\hat\theta\), with equality only if \(\hat\theta\) is already a function of \(T\). Conditioning on a sufficient statistic can only help. The graduate course proves it as Theorem 9.42.
Averaging \(\hat\theta\) over the samples that share the value of \(T\) keeps the mean and removes the within-group spread. Why is the result still a statistic?
Prove \(\theta^*=\E(\hat\theta\mid T)\) is unbiased and has variance at most \(\V\hat\theta\).
Bernoulli example: compute \(\E(X_1\mid\sum X_i=t)\) from (5.6.1). Aim for: \(t/n\).
Counterexample: for Uniform\((\theta,\theta+1)\), \(n=3\), compare the variances of \(Y_{\min}-\frac14\) and \(\bar Y-\frac12\). Aim for: \(3/80\) against \(1/36\).
(i) \(\theta^*\) is a statistic: the conditional distribution of the sample given \(T\) does not involve \(\theta\) (sufficiency), so neither does the conditional mean of \(\hat\theta=h(\text{sample})\). (ii) Unbiased: by iterated expectation (Filling the gap 3.23), \(\E\theta^*=\E[\E(\hat\theta\mid T)]=\E\hat\theta=\theta\). (iii) By the total-variance formula,
\[ \V\hat\theta=\E\big[\V(\hat\theta\mid T)\big]+\V\big[\E(\hat\theta\mid T)\big]\ \ge\ \V\theta^*, \]with equality iff \(\V(\hat\theta\mid T)=0\) with probability 1, i.e. \(\hat\theta\) is a function of \(T\). (The formula follows from \(\E(\hat\theta-\theta)^2=\E\big[(\hat\theta-\theta^*)+(\theta^*-\theta)\big]^2\), where the cross term \(\E[(\hat\theta-\theta^*)(\theta^*-\theta)]\) vanishes after conditioning on \(T\).)
Example. For Bernoulli trials, \(\hat p=X_1\) is unbiased with variance \(p(1-p)\). Given \(\sum X_i=t\), all arrangements are equally likely (5.6.1), so \(\E(X_1\mid\sum X_i=t)=t/n\): Rao-Blackwellising \(X_1\) gives \(\bar X\), with variance \(p(1-p)/n\).
Counterexample to the book's claim. Let \(Y_1,Y_2,Y_3\) be Uniform\((\theta,\theta+1)\). The pair \(T=(Y_{\min},Y_{\max})\) is sufficient (the likelihood is \(\one\{y_{\max}-1\le\theta\le y_{\min}\}\)). Since \(Y_{\min}-\theta\) is the minimum of three Uniform(0,1) variables, a \(\Beta(1,3)\) variable with mean \(\frac14\) and variance \(\frac{3}{80}\), the estimator \(Y_{\min}-\frac14\) is an unbiased function of \(T\) with variance \(3/80=0.0375\). The estimator \(\bar Y-\frac12\) is unbiased with variance \(1/36=0.0278\) and is not a function of \(T\) (two samples with the same extremes can have different middle values). So a function of the sufficient statistic loses. Rao-Blackwellising \(\bar Y-\frac12\) instead gives the midrange \(\frac12(Y_{\min}+Y_{\max})-\frac12\), with variance \(1/40=0.025\): better than both. What makes the book's conclusion true in its examples is completeness of \(T\), under which there is only one unbiased function of \(T\), and it is the best unbiased estimator (the Lehmann-Scheffé theorem; see the references). ∎
See also: Section 9.13.2 of the graduate course (sufficiency, the factorization theorem as Theorem 9.40, minimal sufficiency) and Section 9.13.3 (exponential families, Question 5.6.9).
p. 326 Unbiasedness and sufficiency concern a fixed \(n\). Consistency concerns the sequence \(\hat\theta_n\) as \(n\) grows: the distribution of \(\hat\theta_n\) should pile up at \(\theta\).
\(\hat\theta_n\) is consistent for \(\theta\) if it converges in probability to \(\theta\): for every \(\varepsilon>0\), \(\lim_{n\to\infty}\P(|\hat\theta_n-\theta|<\varepsilon)=1\). Equivalently, for all \(\varepsilon,\delta>0\) there is \(n(\varepsilon,\delta)\) with \(\P(|\hat\theta_n-\theta|<\varepsilon)>1-\delta\) for \(n>n(\varepsilon,\delta)\).
For Uniform(0, \(\theta\)), \(\P(|Y_{\max}-\theta|<\varepsilon)=1-\big(\frac{\theta-\varepsilon}\theta\big)^n\to1\): \(Y_{\max}\) is biased but consistent. For \(\theta=4\), \(\varepsilon=0.1\), \(\delta=0.2\): \(0.975^n\le0.2\) needs \(n\ge\ln0.2/\ln0.975=63.6\), so \(n(\varepsilon,\delta)=64\) (Figure 5.7.1).
fig_5_7_1.For any \(W\) with mean \(\mu\) and variance \(\sigma^2\), and any \(\varepsilon>0\), \(\P(|W-\mu|\ge\varepsilon)\le\sigma^2/\varepsilon^2\). The book proves it by dropping the middle part of the variance integral; the first-year notes derive it from Markov's inequality (Theorem 0.4).
Applied to \(\bar X_n\), with variance \(\sigma^2/n\): \(\P(|\bar X_n-\mu|<\varepsilon)\ge1-\sigma^2/(n\varepsilon^2)\to1\). The sample mean is consistent for the mean of any distribution with finite variance: the weak law of large numbers (Theorem 0.5 of the first-year notes). More generally, an estimator whose bias and variance both tend to 0 is consistent (Question 5.7.4; Theorem 1.2 of the first-year notes).
The book cites (101) for "under very general conditions maximum likelihood estimators are consistent". Here is a complete proof in a common special case. Let \(Y_1,Y_2,\dots\) be independent with density (or probability function) \(f(y;\theta_0)\), and let \(\psi(y;\theta)=\partial_\theta\ln f(y;\theta)\) be strictly decreasing in \(\theta\) for every \(y\) (strictly concave log-likelihood; true for the Bernoulli, Poisson, Normal-mean and exponential-rate models). Assume \(m(\theta)=\E_{\theta_0}\psi(Y;\theta)\) and \(\V_{\theta_0}\psi(Y;\theta)\) are finite and \(m(\theta_0)=0\) (the score has mean 0, Filling the gap 5.12). If, for each \(n\), the likelihood equation has a root \(\hat\theta_n\), then \(\hat\theta_n\convp\theta_0\).
The score is decreasing in \(\theta\). If the score is positive at \(\theta_0-\varepsilon\) and negative at \(\theta_0+\varepsilon\), where must its root be?
Show \(m(\theta_0-\varepsilon)>0>m(\theta_0+\varepsilon)\) from monotonicity of \(\psi\).
Use the weak law to show the event \(E_n\) (score signs as in step 1) has probability tending to 1.
On \(E_n\), locate the root using monotonicity of \(\ell_n'\). Aim for: \(|\hat\theta_n-\theta_0|<\varepsilon\).
Fix \(\varepsilon>0\). Because \(\psi\) is strictly decreasing in \(\theta\), so is \(m\), hence \(m(\theta_0-\varepsilon)>0>m(\theta_0+\varepsilon)\). Write \(\ell_n'(\theta)=\sum_{i=1}^n\psi(Y_i;\theta)\). By the weak law (Example 5.7.2), \(\frac1n\ell_n'(\theta_0-\varepsilon)\convp m(\theta_0-\varepsilon)\) and \(\frac1n\ell_n'(\theta_0+\varepsilon)\convp m(\theta_0+\varepsilon)\). So the event
\[ E_n=\big\{\ell_n'(\theta_0-\varepsilon)>0\big\}\cap\big\{\ell_n'(\theta_0+\varepsilon)<0\big\} \]has \(\P(E_n)\to1\) (each of the two events has probability tending to 1, and \(\P(A\cap B)\ge1-\P(A^c)-\P(B^c)\)). On \(E_n\), since \(\ell'_n\) is strictly decreasing, \(\ell_n'>0\) on \((-\infty,\theta_0-\varepsilon]\) and \(\ell_n'<0\) on \([\theta_0+\varepsilon,\infty)\) within the parameter interval, so the root \(\hat\theta_n\) lies in \((\theta_0-\varepsilon,\theta_0+\varepsilon)\). Hence \(\P(|\hat\theta_n-\theta_0|<\varepsilon)\ge\P(E_n)\to1\). By the lemma of Filling the gap 5.1 this root is the maximum likelihood estimate.
Example: exponential rate, \(\psi(y;\lambda)=1/\lambda-y\), decreasing in \(\lambda\), \(m(\lambda)=1/\lambda-1/\lambda_0\); the estimator \(1/\bar Y\) is consistent although biased. The general theorem, without concavity, is Theorem 9.13 of the graduate course. ∎
pp. 329–330 In a Bayesian analysis the parameter is a random variable \(\Theta\) with a prior distribution, and Bayes' theorem (Section 2.4 of the book) turns the prior and the data into a posterior distribution. The search for the submarine Scorpion in 1968 is the book's example: the search area was divided into cells with prior probabilities from expert opinion, and after each unsuccessful search of a cell \(k\) its probability was lowered by Bayes' theorem,
\[ P^*(A_k)=\frac{\P(B_k^c\mid A_k)\P(A_k)}{\P(B_k^c\mid A_k)\P(A_k)+\P(A_k^c)}, \](where \(B_k\) is "found when cell \(k\) is searched"; \(\P(B_k^c\mid A_k^c)=1\)), the other cells were renormalised, and the most probable cell was searched next.
A Poisson call rate is 8 with prior probability 0.25 and 10 with probability 0.75. One five-minute count gives \(X=7\). Then
\[ \P(\Lambda=10\mid X=7)=\frac{e^{-10}\frac{10^7}{7!}(0.75)}{e^{-8}\frac{8^7}{7!}(0.25)+e^{-10}\frac{10^7}{7!}(0.75)}=\frac{0.0901(0.75)}{0.1396(0.25)+0.0901(0.75)}=0.659, \]and \(\P(\Lambda=8\mid X=7)=0.341\): the observation, more typical of rate 8, moved weight towards 8.
If a statistic \(W\) has probability function \(p_W(w\mid\theta)\) (or density \(f_W(w\mid\theta)\)) and \(\Theta\) has prior density \(f_\Theta(\theta)\), the posterior density of \(\Theta\) given \(W=w\) is
\[ g_\Theta(\theta\mid W=w)=\frac{p_W(w\mid\theta)f_\Theta(\theta)}{\int p_W(w\mid\theta)f_\Theta(\theta)\,\d\theta}, \]with sums for a discrete prior. A uniform prior, used when nothing is known, is called noninformative.
With \(X\sim\Bin(n,\theta)\) and the beta prior \(f_\Theta(\theta)=\frac{\Gamma(r+s)}{\Gamma(r)\Gamma(s)}\theta^{r-1}(1-\theta)^{s-1}\) (Figure 5.8.1 shows \(r=2\), \(s=4\)), the numerator of the posterior is a constant times \(\theta^{k+r-1}(1-\theta)^{n-k+s-1}\), so the posterior is \(\Beta(k+r,\,n-k+s)\). A prior centred near 0.035 with almost all its mass below 0.07 is obtained with \(r=4\), \(s=102\), giving the posterior \(\Beta(k+4,\,n-k+102)\).
fig_5_8_1.The book argues that "there can be only one" beta density with given powers of \(\theta\) and \((1-\theta)\), and cites (100) for \(\E\Theta=r/(r+s)\). (a) If a density is proportional to a non-negative function \(h\) with \(0<\int h<\infty\), it equals \(h/\int h\). (b) For \(\Theta\sim\Beta(r,s)\), \(\E\Theta=\frac r{r+s}\) and \(\V\Theta=\frac{rs}{(r+s)^2(r+s+1)}\). (c) A prior mean 0.035 forces \(s=27.6r\); the book's \(r=4\), \(s=102\) has mean 0.0377, median 0.0349 and \(\P(\Theta<0.07)=0.941\).
A density is pinned down by its shape: the constant is whatever makes the integral 1. For the moments, write \(\theta\cdot\)(beta density) as a ratio of beta functions.
If \(f=ch\) integrates to 1, solve for \(c\).
Compute \(B(r+1,s)/B(r,s)\) and \(B(r+2,s)/B(r,s)\). Aim for: \(r/(r+s)\) and \(r(r+1)/((r+s)(r+s+1))\).
Solve \(r/(r+s)=0.035\) for \(s\), then check the mean and the cdf at 0.07 for \(r=4\), \(s=102\).
(a) If \(f=ch\) is a density, \(1=\int f=c\int h\), so \(c=1/\int h\) is determined. Hence the posterior, being proportional to \(\theta^{k+r-1}(1-\theta)^{n-k+s-1}\), must be the \(\Beta(k+r,n-k+s)\) density, which has that kernel. The same argument identifies the gamma posterior of Example 5.8.3.
(b) The normalising constant gives \(\int_0^1\theta^{a-1}(1-\theta)^{b-1}\d\theta=B(a,b)=\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}\) for all \(a,b>0\). So \(\E\Theta=\frac{B(r+1,s)}{B(r,s)}=\frac{\Gamma(r+1)\Gamma(r+s)}{\Gamma(r)\Gamma(r+s+1)}=\frac r{r+s}\), using \(\Gamma(x+1)=x\Gamma(x)\). Similarly \(\E\Theta^2=\frac{B(r+2,s)}{B(r,s)}=\frac{r(r+1)}{(r+s)(r+s+1)}\), and
\[ \V\Theta=\frac{r(r+1)}{(r+s)(r+s+1)}-\frac{r^2}{(r+s)^2}=\frac{r(r+1)(r+s)-r^2(r+s+1)}{(r+s)^2(r+s+1)}=\frac{rs}{(r+s)^2(r+s+1)}. \](c) \(r/(r+s)=0.035\) gives \(s=r(1/0.035-1)=27.57\,r\). With \(r=4\), \(s=102\) the mean is \(4/106=0.0377\) (the median, 0.0349, is the quantity close to 0.035), and the cdf at 0.07 is 0.941: "almost all" of the mass, 94%, is below 0.07. Writing \(\Gamma(m)=(m-1)!\) gives the book's form \(\frac{(n+105)!}{(k+3)!(n-k+101)!}\theta^{k+3}(1-\theta)^{n-k+101}\) of the posterior. ∎
If \(W=\sum X_i\) for a Poisson sample of size \(n\), so \(W\sim\Pois(n\theta)\), and the prior is \(\Gam(s,\mu)\), \(f_\Theta(\theta)=\frac{\mu^s}{\Gamma(s)}\theta^{s-1}e^{-\mu\theta}\), the posterior is proportional to \(\theta^{w+s-1}e^{-(\mu+n)\theta}\), hence
\[ g(\theta\mid W=w)=\frac{(\mu+n)^{w+s}}{\Gamma(w+s)}\theta^{w+s-1}e^{-(\mu+n)\theta}, \]the \(\Gam(w+s,\mu+n)\) density: the shape adds the total count, the rate adds the number of periods.
The 88 hurricanes of 1851–1900, the least reliable period, set the prior: mean \(s/\mu=88/50\), so \(\Gam(88,50)\). The later 100 years had \(w=92+72=164\), so the posterior is \(\Gam(252,150)\), with mean 1.68 hurricanes per year and 95% of its mass between 1.48 and 1.89 (Figure x5.3a).
If each person's error rate \(\Theta\) is \(\Gam(s,\mu)\) and, given \(\Theta=\theta\), the count \(W\) is Poisson(\(\theta\)), integrating \(\theta\) out gives
\[ p_W(w)=\frac{\Gamma(w+s)}{w!\,\Gamma(s)}\Big(\frac\mu{\mu+1}\Big)^s\Big(\frac1{\mu+1}\Big)^w=\binom{w+s-1}{w}p^s(1-p)^w,\qquad p=\frac{\mu}{\mu+1}: \]a negative binomial. Case Study 5.8.2 fits this to the errors of 504 subjects on a coordination test (Table 5.8.2) with \(s=0.8\), and the fit is very good (Figure x5.1c). The formula the book gives for \(p\) is not the maximum likelihood estimate; see the notes on the book.
A loss function \(L(\hat\theta,\theta)\ge0\), with \(L(\theta,\theta)=0\), measures the cost of estimating \(\theta\) by \(\hat\theta\). The risk of an estimate is its expected loss under the posterior, \(\int L(\hat\theta,\theta)g(\theta\mid W=w)\d\theta\), and a Bayes estimate minimises the risk. Common choices are \(|\hat\theta-\theta|\) and \((\hat\theta-\theta)^2\).
Max stocks \(n\hat\theta\) copies when a proportion \(\theta\) of his \(n\) customers will buy. Each lost sale costs \(c\) and each unsold copy costs \(d\):
\[ L(\hat\theta,\theta)=\begin{cases}cn(\theta-\hat\theta),&\hat\theta<\theta,\\ dn(\hat\theta-\theta),&\hat\theta>\theta.\end{cases} \]The book does not compute the Bayes estimate for this loss; Filling the gap 5.23 does.
(a) Under \(L=|\hat\theta-\theta|\) the Bayes estimate is the posterior median. (b) Under \(L=(\hat\theta-\theta)^2\) it is the posterior mean, because \(\E(W-b)^2=\V W+(\E W-b)^2\) is smallest at \(b=\E W\).
The book's proof of part (a) goes through the special case \(E|W-m|\le E|W|\) for \(m\ge0\), leaves \(m<0\) as "similar", and assumes a continuous \(W\) whose median splits the mass exactly in half. Here is a short proof that works for any \(W\) with \(\E|W|<\infty\), discrete or continuous, and any median \(m\) (a number with \(\P(W\le m)\ge\frac12\) and \(\P(W\ge m)\ge\frac12\)): \(\E|W-b|\ge\E|W-m|\) for every \(b\).
Compare \(|w-b|\) with \(|w-m|\) pointwise. The difference is at least \(b-m\) times \(\pm1\), with the sign decided by which side of \(m\) the point \(w\) lies.
For \(b>m\), compute \(|w-b|-|w-m|\) for \(w\le m\), \(m<w<b\), \(w\ge b\). Aim for: a lower bound \((b-m)[\one\{w\le m\}-\one\{w>m\}]\).
Take expectations and use \(\P(W\le m)\ge\frac12\). Then treat \(b<m\) by symmetry.
Take \(b>m\). Compare \(|w-b|\) and \(|w-m|\) in three ranges: for \(w\le m\), \(|w-b|-|w-m|=b-m\); for \(m<w<b\), it is \((b-w)-(w-m)=b+m-2w\), which lies between \(-(b-m)\) and \(b-m\); for \(w\ge b\), it is \(-(b-m)\). In every case
\[ |w-b|-|w-m|\ \ge\ (b-m)\big[\one\{w\le m\}-\one\{w>m\}\big]. \]Taking expectations, \(\E|W-b|-\E|W-m|\ge(b-m)\big[\P(W\le m)-\P(W>m)\big]=(b-m)\big[2\P(W\le m)-1\big]\ge0\), since \(\P(W\le m)\ge\frac12\). For \(b<m\) the mirror-image argument uses \(\P(W\ge m)\ge\frac12\). ∎
Under squared loss, the gamma-Poisson Bayes estimate is the posterior mean
\[ \frac{w+s}{\mu+n}=\frac{n}{\mu+n}\Big(\frac wn\Big)+\frac{\mu}{\mu+n}\Big(\frac s\mu\Big), \]a weighted average of the maximum likelihood estimate \(w/n\) and the prior mean \(s/\mu\), the weight on the data tending to 1 as \(n\to\infty\). In Case Study 5.8.1: \(\frac{100}{150}(1.64)+\frac{50}{150}(1.76)=1.68\). The beta-binomial analogue (Question 5.8.2) is \(\frac{k+r}{n+r+s}=\frac{n}{n+r+s}\frac kn+\frac{r+s}{n+r+s}\frac r{r+s}\).
For the loss of Example 5.8.5 and a continuous posterior with cdf \(G\), the risk is minimised where \(G(\hat\theta)=\frac{c}{c+d}\): the Bayes estimate is the \(c/(c+d)\) quantile of the posterior. With \(c=d\) this is the median (Theorem 5.8.1a). If a lost sale costs three times a storage cost, stock to the 75% point of the posterior: for the prior \(\Beta(4,102)\) and 7 buyers among 100 potential customers, the posterior is \(\Beta(11,195)\), with mean 0.0534, median 0.0520 and 75% quantile 0.0630.
Differentiate the expected loss in the estimate \(t\). What do the derivatives of \(\E(\Theta-t)^+\) and \(\E(t-\Theta)^+\) turn out to be?
Show \(\frac{\d}{\d t}\E(\Theta-t)^+=-(1-G(t))\) and \(\frac{\d}{\d t}\E(t-\Theta)^+=G(t)\).
Combine. Aim for: \(R'(t)=n[(c+d)G(t)-c]\).
Set \(R'(t)=0\) and evaluate for \(\Beta(11,195)\) with \(c=3\), \(d=1\).
Write \(x^+=\max(x,0)\). The risk of \(t=\hat\theta\) is \(R(t)=n\big[c\,\E(\Theta-t)^++d\,\E(t-\Theta)^+\big]\) under the posterior. Now \(\E(\Theta-t)^+=\int_t^\infty(\theta-t)g(\theta)\d\theta\), and by Leibniz's rule its derivative is \(-(t-t)g(t)-\int_t^\infty g(\theta)\d\theta=-(1-G(t))\). Likewise \(\frac{\d}{\d t}\E(t-\Theta)^+=G(t)\). Hence
\[ R'(t)=n\big[-c(1-G(t))+dG(t)\big]=n\big[(c+d)G(t)-c\big]. \]Since \(G\) is non-decreasing, \(R'\) is non-decreasing, so \(R\) is convex, and \(R'(t)\) changes sign where \(G(t)=c/(c+d)\). That point minimises the risk. For \(\Beta(11,195)\) (the posterior \(\Beta(k+4,n-k+102)\) with \(k=7\), \(n=100\)), \(G^{-1}(0.75)=0.0630\): Max should stock about 6.3% of his customer count, more than the posterior mean, because running short costs more than overstocking. ∎
See also: Section 11.2 (the Bayesian method) and Section 12.3 (Bayes estimators) of the graduate course; Section 4.6.2 of the machine-learning course (the beta-binomial model, posterior mean as a compromise); the graduate course's credible interval demo.
pp. 341–342 The book closes with the bootstrap, a computer-intensive way to estimate a standard error, the standard deviation \(\sqrt{\V\hat\theta}\) of an estimator, when no formula is available. Its test case does have a formula: for \(f_Y(y;\theta)=ye^{-y/\theta}/\theta^2\) the maximum likelihood estimator \(\frac12\bar Y\) (Example 5.2.2) has variance \(\frac14\cdot\frac{2\theta^2}n=\frac{\theta^2}{2n}\), so its standard error is \(\theta/\sqrt{2n}\). The parametric bootstrap goes as follows: (1) from the sample of Table 5.9.1 (\(n=15\), sum 285.955) compute \(\theta_e=9.5318\); (2) draw 200 samples of size 15 from \(f_Y(y;9.5318)\); (3) re-estimate \(\theta\) on each; (4) report the standard deviation of the 200 re-estimates. The book obtains 1.835, against the true standard error \(10/\sqrt{30}=1.826\) (the sample was drawn with \(\theta=10\)).
fig_x5_3.The bootstrap does not estimate the standard error at the true \(\theta\); it estimates it at \(\theta_e\). As the number \(B\) of bootstrap samples grows, the bootstrap standard error tends to \(\theta_e/\sqrt{2n}=9.5318/\sqrt{30}=1.740\), not to 1.826. With \(B=200\) it carries a Monte Carlo error of about 0.09, so the book's 1.835 is about one Monte Carlo standard deviation above its target: its closeness to the true 1.826 is partly luck.
Each bootstrap sample comes from \(f(y;\theta_e)\), not from \(f(y;\theta)\). What, then, is the exact standard deviation of a bootstrap re-estimate?
Find the limit of the bootstrap standard error as \(B\to\infty\). Aim for: \(\theta_e/\sqrt{2n}=1.740\).
Estimate the Monte Carlo error for \(B=200\) and compare 1.835 with the target.
Each bootstrap sample is drawn from \(f_Y(y;\theta_e)\), so each re-estimate \(\theta^*_b=\frac12\bar Y^*_b\) has exactly the distribution of \(\hat\theta\) when the parameter is \(\theta_e\): variance \(\theta_e^2/(2n)\). The \(B\) re-estimates are independent, so by the weak law applied to \(\theta^*_b\) and \((\theta^*_b)^2\), their sample variance tends in probability to \(\theta_e^2/(2n)\), and their sample standard deviation to \(\theta_e/\sqrt{2n}=1.740\). The bootstrap standard error therefore inherits the error of \(\theta_e\) itself (9.53 against 10, a relative error of 4.7%, carried over exactly) plus a Monte Carlo error. For approximately Normal re-estimates, the sample standard deviation of \(B\) values has standard deviation about \(\sigma/\sqrt{2(B-1)}=1.74/\sqrt{398}=0.087\); repeating the whole bootstrap many times gives about 0.09. In applications the plug-in error matters more than the Monte Carlo error, which can always be reduced by increasing \(B\). Here \(\frac12\bar Y\) has an exact gamma law at \(\theta_e\) (shape \(2n\), scale \(\theta_e/(2n)\)), drawn in Figure x5.3b. ∎
See also: Section 8.2 (bootstrap variance estimation) and the supplement on the parametric bootstrap of the graduate course, and its demo on the number of bootstrap replications.
The book states that the maximum likelihood estimate of \(p\) in the negative binomial \(\binom{w+s-1}{w}p^s(1-p)^w\) with \(s\) known is \(ns/\sum w_i\), and uses \(p=(504)(0.8)/3821=0.106\). The log-likelihood is \(ns\ln p+(\sum w_i)\ln(1-p)+\text{const}\), whose derivative \(ns/p-\sum w_i/(1-p)\) vanishes at
\[ p_e=\frac{ns}{ns+\sum w_i}=\frac{403.2}{403.2+3821}=0.0955. \](Equivalently, the model mean \(s(1-p)/p\) equals \(\bar w\).) Moreover the printed column of predicted frequencies does not come from \(p=0.106\): that value gives 83.7, 59.9, 48.2 for \(w=0,1,2\) instead of the printed 79.2, 57.1, 46.3. The printed column agrees, within 0.06 in every one of its 32 cells, with \(p=0.0989\), close to the correct estimate (Figure x5.1c). The conclusion that the negative binomial fits well stands.
The book says the variance of every unbiased estimator based on a sufficient statistic is less than that of every unbiased estimator that is not. This is false: with \(Y_1,Y_2,Y_3\) from Uniform\((\theta,\theta+1)\), \(Y_{\min}-\frac14\) is an unbiased function of the sufficient \((Y_{\min},Y_{\max})\) with variance \(3/80\), and \(\bar Y-\frac12\), not a function of it, has the smaller variance \(1/36\). What is true is the Rao-Blackwell theorem; see Filling the gap 5.19.
The figure is labelled "\(n=3{,}000\)", but the text, the margin \(d=0.014\) and the interval \((0.466,0.494)\) are for the pooled poll of \(n=5000\) (for \(n=3000\), \(d\) would be 0.018). Its peak height 56.98 corresponds to \(\sigma_p=0.0070\); with the unrounded \(\sigma_p=1/(2\sqrt{5000})=0.00707\) the peak is 56.42.
(1) Case Study 5.3.2 announces the believable values "from 0.618 to 0.662" and then computes \((0.619,0.661)\); the latter is right. (2) In Example 5.3.2 the upper limit is \(0.4333+0.1254=0.5587\), which rounds to 0.559, not 0.558. (3) In Table 5.2.4 the expected frequency 7.7 for the class 6–10 is \(100F_X(10)\), which includes the class 0–5; the class probabilities give 0.5 for 0–5 and 7.1 for 6–10 (the table prints 0 and 7.7). (4) The Comment after Theorem 5.3.2 refers to "Section 3.3" for the hypergeometric law, which is in Section 3.2. (5) In the proof of Theorem 5.6.1, "\(g[b(k_1,\dots,k_n);\theta]\)" should read \(g[h(k_1,\dots,k_n);\theta]\). (6) The book's answer to Question 5.4.19(c) gives the relative efficiency of \(\hat\theta_2=\bar Y\) to \(\hat\theta_3=nY_{\min}\) as \(\V(\hat\theta_3)/\V(\hat\theta_2)=(\theta^2/n)/\theta^2=1/n\); the ratio is \(\theta^2/(\theta^2/n)=n\) (see the solution).
Twelve of the book's questions, restated in my own words and covering every main section, with complete solutions (hidden). Numbers were cross-checked with the book's answers to the odd-numbered questions; the one disagreement is explained in the solution.
Question 5.2.9 (no-hitters per season). In the 59 Major League seasons 1950–2008 the numbers of seasons with 0, 1, 2, 3 and 4 or more no-hit games were 6, 19, 12, 13 and 9. (a) Fit a Poisson model by maximum likelihood (count "4 or more" as 4) and compare observed and expected frequencies. (b) Is the agreement surprising?
The Poisson maximum likelihood estimate is the sample mean; expected frequencies are 59 times the Poisson probabilities, with the last class taking the remainder.
Compute \(\bar k\) with 4+ counted as 4. Aim for: 118/59.
Compute \(59p(k)\) for \(k=0,\dots,3\) and the remainder for 4+. Aim for: 7.99, 15.97, 15.97, 10.65 and 8.43.
Look at the largest discrepancies and think about what could make the rate vary between seasons.
(a) By Example 5.2.1, \(\lambda_e=\bar k=\frac{0(6)+1(19)+2(12)+3(13)+4(9)}{59}=\frac{118}{59}=2.00\). Expected frequencies \(59e^{-2}2^k/k!\): 7.99, 15.97, 15.97, 10.65 for \(k=0,\dots,3\), and the remainder 8.43 for "4 or more". Observed: 6, 19, 12, 13, 9.
(b) The agreement is fair: the largest discrepancies are \(-4\) at \(k=2\) and \(+3\) at \(k=1\), modest for counts of this size (a formal test is in Chapter 10). Some misfit is to be expected, because the rate is unlikely to be constant over 59 seasons (rule changes such as the height of the pitcher's mound alter it), and a mixture of Poisson rates is more spread out than one Poisson. Note also that counting "4 or more" as 4 understates \(\bar k\): maximising the likelihood with that class treated as \(\P(X\ge4)\) gives \(\lambda=2.08\).
Question 5.2.13 (Pareto's law of incomes). Incomes follow \(f_Y(y;\theta)=\theta k^\theta y^{-(\theta+1)}\), \(y\ge k\), \(\theta\ge1\), with \(k\) known. Find the maximum likelihood estimator of \(\theta\) from a random sample of 25 incomes.
Take logs: the likelihood becomes linear in \(\theta\) apart from \(n\ln\theta\). Set the derivative to zero and check it is a maximum.
Write \(\ell(\theta)=n\ln\theta+n\theta\ln k-(\theta+1)\sum\ln y_i\).
Solve \(\ell'(\theta)=0\). Aim for: \(\hat\theta=n/\sum\ln(y_i/k)\).
Check \(\ell''<0\) and decide what happens if the formula gives a value below 1.
For a sample of size \(n\), \(L(\theta)=\theta^nk^{n\theta}\prod y_i^{-(\theta+1)}\) (all \(y_i\ge k\), so no indicator depends on \(\theta\)), and
\[ \ell(\theta)=n\ln\theta+n\theta\ln k-(\theta+1)\sum\ln y_i,\qquad \ell'(\theta)=\frac n\theta-\sum_{i=1}^n\ln\frac{y_i}k. \]Since \(\ell'\) is strictly decreasing (\(\ell''=-n/\theta^2\)), the lemma of Filling the gap 5.1 gives the unique maximiser over \(\theta>0\):
\[ \hat\theta=\frac{n}{\sum_{i=1}^n\ln(Y_i/k)}=\frac{25}{\sum_{i=1}^{25}\ln Y_i-25\ln k}. \]This agrees with the book's answer. One refinement: the model requires \(\theta\ge1\). If the formula gives a value below 1, then \(\ell'<0\) on \([1,\infty)\) and the maximum over the allowed range is \(\theta_e=1\).
Question 5.2.17 (moments against likelihood). For \(f_Y(y;\theta)=2y/\theta^2\), \(0\le y\le\theta\), find the method-of-moments estimator of \(\theta\). Compare it with the maximum likelihood estimate for the sample 17, 92, 46, 39, 56.
Match \(\E Y\) to \(\bar y\) for the moment estimate. For the likelihood, ask on which \(\theta\) it is non-zero.
Compute \(\E Y\) and solve \(\E Y=\bar y\). Aim for: \(\frac32\bar y\).
Write \(L(\theta)\) with \(\one\{\theta\ge y_{\max}\}\) and find its maximiser.
Evaluate both on the data and ask whether the moment estimate is a possible value of the parameter.
\(\E Y=\int_0^\theta y\cdot2y/\theta^2\,\d y=\frac23\theta\). Setting \(\frac23\theta=\bar y\) gives \(\theta_e=\frac32\bar y\); here \(\bar y=250/5=50\), so \(\theta_e=75\).
The likelihood is \(L(\theta)=\frac{2^n\prod y_i}{\theta^{2n}}\one\{\theta\ge y_{\max}\}\), which is 0 for \(\theta<y_{\max}\) and decreasing for \(\theta\ge y_{\max}\) (Question 5.2.12), so the maximum likelihood estimate is \(y_{\max}=92\).
The moment estimate 75 is impossible: an observation of 92 cannot come from a density that vanishes beyond 75. The moment equation uses only \(\bar y\) and ignores the constraint \(\theta\ge y_{\max}\); the maximum likelihood estimate respects it (and \(Y_{\max}\) is sufficient, Example 5.6.2). Both answers agree with the book.
Question 5.3.7 (lopsided intervals). Five independent samples of size \(n\) from a Normal law with known \(\sigma\) each give the interval \(\big(\bar y-0.96\frac\sigma{\sqrt n},\ \bar y+1.06\frac\sigma{\sqrt n}\big)\). What is the probability that at least four of the five intervals contain \(\mu\)?
Translate 'the interval contains mu' into an event for a standard Normal variable, then count successes over five independent intervals.
Show the interval covers \(\mu\) iff \(-1.06<Z<0.96\). Aim for: \(p\approx0.687\).
The number of covering intervals is \(\Bin(5,p)\): add the probabilities of 4 and 5.
The interval contains \(\mu\) iff \(\bar y-0.96\sigma/\sqrt n<\mu<\bar y+1.06\sigma/\sqrt n\), i.e. iff \(-1.06<Z<0.96\) with \(Z=(\bar Y-\mu)/(\sigma/\sqrt n)\) standard Normal. So each interval covers with probability
\[ p=\Phi(0.96)-\Phi(-1.06)=\Phi(1.06)-\Phi(-0.96)=0.8554-0.1685=0.6869. \]The number of covering intervals is \(\Bin(5,p)\), so
\[ \P(\text{at least 4})=5p^4(1-p)+p^5=0.3485+0.1529=0.501, \]as in the book's answer: a coin toss, although each interval has confidence 69%.
Question 5.3.16 (the absentee ballots). With 99% of precincts counted, Foley trailed Nethercutt by 2174 votes and about 14 000 absentee ballots remained. Let \(p\) be the probability that an absentee voter prefers Foley. How small could \(p\) have been while still giving Foley a 20% chance of winning?
Foley wins if his absentee share \(X\) beats his opponent's by more than 2174. Turn that into \(X\ge\) some number and require probability 0.20.
From \(2X-14000>2174\), find the smallest winning \(X\). Aim for: 8088.
Write \(\P(X\ge8088)\approx\P(Z>(8087.5-mp)/\sqrt{mp(1-p)})\) and set the cut-off equal to 0.8416.
Solve for \(p\) by iteration, starting from \(p=8087.5/14000\).
Let \(X\) be Foley's share of the \(m=14000\) absentee votes (assume each goes to one of the two candidates, independently, \(X\sim\Bin(m,p)\)). Foley gains \(X-(m-X)=2X-m\) on the margin, so he wins if \(2X-14000>2174\), i.e. \(X>8087\), \(X\ge8088\).
With the Normal approximation and a continuity correction, \(\P(X\ge8088)\approx\P\big(Z>\frac{8087.5-mp}{\sqrt{mp(1-p)}}\big)\). This equals 0.20 when the standardised value is \(z_{0.20}=0.8416\):
\[ 14000p=8087.5-0.8416\sqrt{14000\,p(1-p)}. \]Solving (one or two iterations starting from \(p=8087.5/14000=0.5777\), where \(\sqrt{mp(1-p)}=58.4\)) gives \(p=0.574\). The exact binomial gives the same, 0.5742. Since the chance of winning increases with \(p\), any \(p\) below about 0.574 gives Foley less than a 20% chance: he needed to win more than 57% of the absentee vote just to have a one-in-five chance. (The book gives no answer for this even-numbered question.)
Question 5.4.19 (three unbiased estimators of an exponential mean). For a sample from \(f_Y(y;\theta)=\frac1\theta e^{-y/\theta}\), \(y>0\): (a) show that \(\hat\theta_1=Y_1\), \(\hat\theta_2=\bar Y\) and \(\hat\theta_3=nY_{\min}\) are unbiased; (b) find their variances; (c) find the relative efficiencies of \(\hat\theta_1\) to \(\hat\theta_3\) and of \(\hat\theta_2\) to \(\hat\theta_3\).
The minimum of independent exponentials is again exponential. What does that make \(nY_{\min}\)?
Find the law of \(Y_{\min}\). Aim for: exponential with mean \(\theta/n\).
Write down the three variances. Aim for: \(\theta^2\), \(\theta^2/n\), \(\theta^2\).
Form the ratios with the variance of the comparison estimator on top. Aim for: 1 for \(\hat\theta_1\) to \(\hat\theta_3\), and a ratio that grows with \(n\) for \(\hat\theta_2\) to \(\hat\theta_3\).
(a) \(\E Y_1=\theta\) and \(\E\bar Y=\theta\). For the minimum, \(\P(Y_{\min}>y)=\prod\P(Y_i>y)=e^{-ny/\theta}\), so \(Y_{\min}\) is exponential with mean \(\theta/n\) (Theorem 3.10.1), and \(nY_{\min}\) is exponential with mean \(\theta\): it has exactly the law of one observation. All three are unbiased.
(b) An exponential with mean \(\theta\) has variance \(\theta^2\), so \(\V\hat\theta_1=\V\hat\theta_3=\theta^2\), and \(\V\hat\theta_2=\theta^2/n\).
(c) By Definition 5.4.2 the relative efficiency of \(\hat\theta_a\) with respect to \(\hat\theta_b\) is \(\V\hat\theta_b/\V\hat\theta_a\). So \(\hat\theta_1\) to \(\hat\theta_3\): \(\theta^2/\theta^2=1\) (the two are equally good, or equally bad); \(\hat\theta_2\) to \(\hat\theta_3\): \(\V\hat\theta_3/\V\hat\theta_2=\theta^2/(\theta^2/n)=n\). The book's answer prints \(\V(\hat\theta_3)/\V(\hat\theta_2)=(\theta^2/n)/\theta^2=1/n\), which is the reciprocal (the efficiency of \(\hat\theta_3\) with respect to \(\hat\theta_2\)); with the definition the answer is \(n\): \(\bar Y\) is \(n\) times as efficient as \(nY_{\min}\). By Question 5.5.1, \(\bar Y\) attains the Cramér-Rao bound \(\theta^2/n\).
Question 5.5.5 (a geometric model). Let \(p_X(k;\theta)=(\theta-1)^{k-1}/\theta^k\), \(k=1,2,\dots\), \(\theta>1\) (geometric with \(p=1/\theta\)), for which \(\E X=\theta\) and \(\V X=\theta(\theta-1)\). Is \(\bar X\) an efficient estimator of \(\theta\)?
Compute the Fisher information from the score, then compare \(1/(nI)\) with \(\V\bar X\).
Differentiate \(\ln p_X=(k-1)\ln(\theta-1)-k\ln\theta\). Aim for: \((k-\theta)/(\theta(\theta-1))\).
Square and take expectations. Aim for: \(I(\theta)=1/(\theta(\theta-1))\).
Compare the bound with \(\V\bar X\).
The support \(\{1,2,\dots\}\) does not depend on \(\theta\). From \(\ln p_X=(k-1)\ln(\theta-1)-k\ln\theta\),
\[ \frac{\partial\ln p_X}{\partial\theta}=\frac{k-1}{\theta-1}-\frac k\theta=\frac{(k-1)\theta-k(\theta-1)}{\theta(\theta-1)}=\frac{k-\theta}{\theta(\theta-1)}. \]So \(I(\theta)=\E\big[(X-\theta)^2\big]/\big(\theta(\theta-1)\big)^2=\V X/(\theta^2(\theta-1)^2)=1/(\theta(\theta-1))\), and the Cramér-Rao bound is \(\theta(\theta-1)/n\). Since \(\bar X\) is unbiased with \(\V\bar X=\V X/n=\theta(\theta-1)/n\), it attains the bound: \(\bar X\) is efficient, as in the book's answer. Consistent with Filling the gap 5.13, the score of the sample is \(\sum\frac{X_i-\theta}{\theta(\theta-1)}=\frac{n}{\theta(\theta-1)}(\bar X-\theta)=nI(\theta)(\bar X-\theta)\).
Question 5.6.7 (the threshold model). For \(f_Y(y;\theta)=e^{-(y-\theta)}\), \(y\ge\theta\): (a) show that \(Y_{\min}\) is sufficient for \(\theta\); (b) show that \(Y_{\max}\) is not.
(a) Write the support condition as an indicator and see which order statistic it involves. (b) Use the proportional-likelihood test of Filling the gap 5.17.
Factor \(L(\theta)=e^{-\sum y_i}\cdot e^{n\theta}\one\{y_{\min}\ge\theta\}\).
Find two samples with the same maximum, and a \(\theta\) at which exactly one of the likelihoods is 0. Derive a contradiction.
(a) With the indicator \(\one\{y\ge\theta\}\), \(L(\theta)=\prod e^{-(y_i-\theta)}\one\{y_i\ge\theta\}=e^{-\sum y_i}\cdot e^{n\theta}\one\{y_{\min}\ge\theta\}\), because all \(y_i\ge\theta\) iff the smallest is. This is \(g(y_{\min};\theta)b(\bm y)\) with \(g(t;\theta)=e^{n\theta}\one\{t\ge\theta\}\) and \(b=e^{-\sum y_i}\), so \(Y_{\min}\) is sufficient by Theorem 5.6.1.
(b) Use the test of Filling the gap 5.17. Take \(n=3\), \(\bm y=(1,2,5)\) and \(\bm y'=(3,4,5)\), both with \(y_{\max}=5\). If \(L=g(y_{\max};\theta)b(\bm y)\), then: \(L(0.5;\bm y)>0\) forces \(b(\bm y)>0\); \(L(2;\bm y)=0\) (the observation 1 is below 2) forces \(g(5;2)=0\); hence \(L(2;\bm y')=g(5;2)b(\bm y')=0\). But \(L(2;\bm y')=e^{-12+6}>0\) since all of 3, 4, 5 exceed 2. Contradiction, so \(Y_{\max}\) is not sufficient: it cannot tell how close to \(\theta\) the smallest observation came.
Question 5.6.9 (exponential form). A density is in exponential form if \(g_W(w;\theta)=e^{K(w)p(\theta)+S(w)+q(\theta)}\), with a range of \(w\) that does not depend on \(\theta\). Show that \(\sum_{i=1}^nK(W_i)\) is sufficient for \(\theta\), and apply this to \(\lambda e^{-\lambda y}\) and to the Pareto density \(\theta/(1+y)^{\theta+1}\), \(y\ge0\) (Questions 5.6.10, 5.6.11).
The product of exponentials is the exponential of a sum. Which part of that sum involves both the data and the parameter?
Multiply the \(n\) densities. Aim for: \(\exp(p(\theta)\sum K(w_i)+nq(\theta))\exp(\sum S(w_i))\).
Read off \(K\) for \(\lambda e^{-\lambda y}\) and for \(\theta/(1+y)^{\theta+1}\).
For a sample \(w_1,\dots,w_n\) in the (fixed) range,
\[ L(\theta)=\prod_{i=1}^ne^{K(w_i)p(\theta)+S(w_i)+q(\theta)}=\underbrace{\exp\Big(p(\theta)\sum K(w_i)+nq(\theta)\Big)}_{g(\sum K(w_i);\,\theta)}\cdot\underbrace{\exp\Big(\sum S(w_i)\Big)}_{b(w_1,\dots,w_n)}, \]so \(\sum K(W_i)\) is sufficient by Theorem 5.6.1. The fixed range matters: otherwise an indicator depending on \(\theta\) and on individual \(w_i\) would appear (as in Question 5.6.7).
Exponential: \(\lambda e^{-\lambda y}=e^{y(-\lambda)+\ln\lambda}\), with \(K(y)=y\), \(p=-\lambda\), \(S=0\), \(q=\ln\lambda\): \(\sum Y_i\) is sufficient. Pareto: \(\theta(1+y)^{-(\theta+1)}=e^{\ln(1+y)\,(-\theta-1)+\ln\theta}\), with \(K(y)=\ln(1+y)\): \(\sum\ln(1+Y_i)\) is sufficient, as in the book's answer to Question 5.6.11.
Question 5.7.3 (two inconsistent estimators). For a sample from \(f_Y(y;\lambda)=\lambda e^{-\lambda y}\), \(y>0\), show that neither \(\hat\lambda_n=Y_1\) nor \(\hat\lambda_n=\sum_{i=1}^nY_i\) is consistent for \(\lambda\).
(a) The law of Y1 does not change with n. (b) The sum grows like n/lambda, far from lambda.
Compute \(\P(|Y_1-\lambda|<\lambda/2)\). Aim for: a constant below 1.
Bound \(\P(|S_n-\lambda|<\varepsilon)\) by \(\P(|S_n-n/\lambda|>n/\lambda-\lambda-\varepsilon)\) and apply Chebyshev.
(a) \(Y_1\) has the same law for every \(n\). Take \(\varepsilon=\lambda/2\):
\[ \P(|Y_1-\lambda|<\lambda/2)=\P(\lambda/2<Y_1<3\lambda/2)=e^{-\lambda^2/2}-e^{-3\lambda^2/2}, \]a fixed number strictly less than 1 (indeed less than \(e^{-\lambda^2/2}\le1\)). It does not tend to 1, so \(Y_1\) is not consistent.
(b) \(S_n=\sum Y_i\) has mean \(n/\lambda\) and variance \(n/\lambda^2\). For \(n\) so large that \(n/\lambda>\lambda+\varepsilon\), the event \(|S_n-\lambda|<\varepsilon\) forces \(S_n<\lambda+\varepsilon\), hence \(|S_n-n/\lambda|>n/\lambda-\lambda-\varepsilon\), and Chebyshev's inequality gives
\[ \P(|S_n-\lambda|<\varepsilon)\le\frac{n/\lambda^2}{(n/\lambda-\lambda-\varepsilon)^2}\ \longrightarrow\ 0. \]So the probability tends to 0, not 1: \(S_n\) runs off to infinity. (The book's answer bounds the probability below 1 by comparing with \(Y_1\), which also suffices.) The consistent choice is the maximum likelihood estimator \(n/S_n=1/\bar Y\) (Filling the gap 5.20).
Question 5.8.3 (a pollster's prior). In a binomial poll, the pollster believes the election is close and uses the prior \(\Beta(135,135)\), for which \(\P(0.45<\theta<0.55)\approx0.90\). (a) Find the posterior after \(k\) of \(n\) votes for the candidate. (b) Find the squared-loss Bayes estimate as a weighted average of the maximum likelihood estimate and the prior mean. Evaluate for 480 of 1000.
Beta prior, binomial data: the posterior adds successes and failures to the two parameters. The squared-loss estimate is the posterior mean.
Add \(k\) and \(n-k\) to 135 and 135.
Write \((k+135)/(n+270)\) as a weighted average of \(k/n\) and \(\frac12\). Aim for: weights \(n/(n+270)\) and \(270/(n+270)\).
Evaluate for 480 of 1000.
First the claim about the prior: by Filling the gap 5.21 it has mean \(1/2\) and standard deviation \(\sqrt{135^2/(270^2\cdot271)}=0.0304\), and its exact probability of \((0.45,0.55)\) is 0.900.
(a) By Example 5.8.2 with \(r=s=135\), the posterior is \(\Beta(k+135,\,n-k+135)\).
(b) By Theorem 5.8.1(b) the Bayes estimate is the posterior mean,
\[ \frac{k+135}{n+270}=\frac{n}{n+270}\cdot\frac kn+\frac{270}{n+270}\cdot\frac12, \]as in the book's answer: the prior counts as 270 extra voters split evenly. For \(k=480\), \(n=1000\): \(\Beta(615,655)\), estimate \(615/1270=0.4843\), with weight \(1000/1270=0.787\) on \(k/n=0.48\). The posterior probability that the candidate's true share exceeds \(1/2\) is 0.131, larger than the 0.103 of a flat prior (Filling the gap 5.8), because the prior pulls towards a tie.
Question 5.8.9 (the beta-binomial law). If \(X\mid\theta\sim\Bin(n,\theta)\) and \(\Theta\sim\Beta(r,s)\) with integer \(r,s\), show that the marginal probability function of \(X\) is
\[ p_X(k)=\frac{\binom{k+r-1}{k}\binom{n-k+s-1}{n-k}}{\binom{n+r+s-1}{n}},\qquad k=0,1,\dots,n. \]Integrate the joint law over theta: the integral is a beta function. Then convert the gamma functions to factorials and regroup.
Write \(p_X(k)=\int_0^1\binom nk\theta^k(1-\theta)^{n-k}f_\Theta(\theta)\d\theta\). Aim for: a product of gamma functions.
Replace each gamma function by a factorial and group the factors into three binomial coefficients.
Integrate the joint law over \(\theta\), using \(\int_0^1\theta^{a-1}(1-\theta)^{b-1}\d\theta=\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}\):
\[ p_X(k)=\binom nk\frac{\Gamma(r+s)}{\Gamma(r)\Gamma(s)}\int_0^1\theta^{k+r-1}(1-\theta)^{n-k+s-1}\d\theta=\binom nk\frac{\Gamma(r+s)}{\Gamma(r)\Gamma(s)}\cdot\frac{\Gamma(k+r)\Gamma(n-k+s)}{\Gamma(n+r+s)}. \]With integer arguments, \(\Gamma(m)=(m-1)!\), and regrouping the factorials,
\[ p_X(k)=\frac{n!}{k!(n-k)!}\cdot\frac{(r+s-1)!}{(r-1)!(s-1)!}\cdot\frac{(k+r-1)!(n-k+s-1)!}{(n+r+s-1)!}=\frac{(k+r-1)!}{k!(r-1)!}\cdot\frac{(n-k+s-1)!}{(n-k)!(s-1)!}\cdot\frac{n!(r+s-1)!}{(n+r+s-1)!}, \]which is the stated formula since \(\frac{n!(r+s-1)!}{(n+r+s-1)!}=1\big/\binom{n+r+s-1}{n}\). A check: with \(r=s=1\) (flat prior) every \(k\) has probability \(\binom{n+1}{n}^{-1}=\frac1{n+1}\), Bayes' own uniform result. The probabilities sum to 1 automatically, since they form the marginal law of \(X\).
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.
| Demonstration | What you can see | Sections and results |
|---|---|---|
| Which unbiased estimator? | Simulated sampling distributions of competing unbiased estimators, their exact and simulated variances, relative efficiencies and the Cramér-Rao bound (or why it does not apply). Presets: 1 Example 5.4.6; 2 Example 5.5.2, \(n=20\); 3 uniform, Questions 5.4.18 and 5.4.21; 4 exponential, Question 5.4.19; 5 Example 5.4.5. | Sections 5.4, 5.5; 5.10, 5.13, 5.15; Question 5.4.19 |
| What does a statistic remember? | The conditional law of a Bernoulli or Poisson sample given a statistic, under two values of the parameter side by side, and the largest gap between them (zero exactly for a sufficient statistic). Presets: 1 the sum, (5.6.1); 2 \(X_1\) alone; 3 \(X_1+2X_2+3X_3\), Question 5.6.2; 4 Poisson sum, Example 5.6.1; 5 the maximum. | Section 5.6; 5.17, 5.19 |
| Prior plus data | Conjugate updating (beta-binomial and gamma-Poisson), the posterior mean as a weighted average, the posterior median and the cost-ratio quantile of Max's inventory loss, a 95% credible interval. Presets: 1 Case Study 5.8.1; 2 Example 5.8.2; 3 Example 5.8.5; 4 Question 5.8.3 and Max's poll; 5 a flat prior, Question 5.8.4. | Section 5.8; 5.8, 5.21–5.23; Question 5.8.3 |
Related demonstrations elsewhere: the first-year likelihood demo (Section 5.2), confidence interval demo and proportions demo (Section 5.3), estimators demo (Section 5.4); in the graduate course, the interval coverage, efficiency, consistency, Bayes loss and bootstrap replications demos.