Lecture 25 Likelihood-Ratio Tests

Lecture 23 ended with a gap: the Neyman–Pearson lemma covers only simple hypotheses, and for the two-sided alternative no uniformly most powerful test exists. In this lecture we extend the likelihood ratio to composite hypotheses by comparing maximised likelihoods. We will see that the large-sample behaviour of the resulting test, described by Wilks’ theorem, follows from the asymptotic theory of lecture 17.

25.1 The Generalised Likelihood Ratio

As in lecture 23, we write L⁢(θ)L(\theta) for the likelihood of the data X=(X1,…,Xn)X=(X_{1},\dots,X_{n}) and ℓ⁢(θ)=log⁡L⁢(θ)\ell(\theta)=\log L(\theta) for the log-likelihood, where the parameter space Θ\Theta is now allowed to be a subset of ℝk\mathbb{R}^{k}. We consider the following testing problem:

H0:θ∈Θ0againstH1:θ∈Θ1:=Θ∖Θ0H_{0}\colon\theta\in\Theta_{0}\qquad\text{against}\qquad H_{1}\colon\theta\in% \Theta_{1}:=\Theta\setminus\Theta_{0}

for a subset Θ0⊆Θ\Theta_{0}\subseteq\Theta, where both hypotheses can be composite.

The Neyman–Pearson test compares the likelihoods of two parameter values. A composite hypothesis contains many parameter values, and the natural extension is to represent each hypothesis by the value in it which fits the data best, i.e. by the maximum of the likelihood over the hypothesis. For the alternative we use a small modification of this idea, which we explain after the definition.

Definition 25.1.

The generalised likelihood ratio for testing H0:θ∈Θ0H_{0}\colon\theta\in\Theta_{0} against H1:θ∈Θ1H_{1}\colon\theta\in\Theta_{1} is given by

Λ⁢(x)=supθ∈Θ0L⁢(θ)supθ∈ΘL⁢(θ).\Lambda(x)=\frac{\sup_{\theta\in\Theta_{0}}L(\theta)}{\sup_{\theta\in\Theta}L(% \theta)}.

The generalised likelihood-ratio test at level α\alpha rejects H0H_{0}, if Λ⁢(X)≤c\Lambda(X)\leq c, where the constant cc is chosen so that the size

supθ∈Θ0ℙθ⁢(Λ⁢(X)≤c)\sup_{\theta\in\Theta_{0}}\mathbb{P}_{\theta}\bigl{(}\Lambda(X)\leq c\bigr{)}

is as large as possible without exceeding α\alpha.

The definition contains one choice which may look surprising: the denominator maximises the likelihood over all of Θ\Theta, rather than only over the alternative Θ1\Theta_{1}. With this choice the denominator is L⁢(θ^)L(\hat{\theta}), the likelihood at the maximum likelihood estimator θ^\hat{\theta} from lecture 5. Also, since the numerator maximises over the smaller set Θ0\Theta_{0}, we always have 0≤Λ≤10\leq\Lambda\leq 1.

Maximising over the alternative Θ1\Theta_{1} instead would lead to the same test. To see this, let Λ~\tilde{\Lambda} be the ratio with the supremum over Θ1\Theta_{1} in the denominator. The supremum over Θ\Theta is the larger of the suprema over Θ0\Theta_{0} and Θ1\Theta_{1}, and thus Λ=min⁡(Λ~,1)\Lambda=\min(\tilde{\Lambda},1). Since Λ≤1\Lambda\leq 1, a critical value c≥1c\geq 1 would reject H0H_{0} for every dataset, and thus only c<1c<1 is of interest. For every c<1c<1 the events Λ≤c\Lambda\leq c and Λ~≤c\tilde{\Lambda}\leq c coincide.

The ratio Λ~\tilde{\Lambda} also shows how the new test relates to the test from lecture 23. If we restrict the model to the two parameter values of that lecture, the generalised likelihood-ratio test becomes the Neyman–Pearson test. Indeed, for Θ={θ0,θ1}\Theta=\{\theta_{0},\theta_{1}\} and Θ0={θ0}\Theta_{0}=\{\theta_{0}\} we have Θ1={θ1}\Theta_{1}=\{\theta_{1}\} and Λ~=L⁢(θ0)/L⁢(θ1)=1/R\tilde{\Lambda}=L(\theta_{0})/L(\theta_{1})=1/R, where R=L⁢(θ1)/L⁢(θ0)R=L(\theta_{1})/L(\theta_{0}) is the likelihood ratio from lecture 23. Thus for c<1c<1 the test rejects H0H_{0} if R≥1/cR\geq 1/c, and this is the most powerful test of theorem 23.2 with threshold 1/c1/c. For composite hypotheses no such optimality is guaranteed.

We now return to the general case and consider what the value of Λ\Lambda tells us about the data. The numerator of Λ\Lambda is the likelihood at the restricted maximum likelihood estimator θ^0\hat{\theta}_{0}, the best fit within H0H_{0}. If H0H_{0} is simple, then Θ0={θ0}\Theta_{0}=\{\theta_{0}\} and the numerator is just L⁢(θ0)L(\theta_{0}). A value of Λ\Lambda close to one means that imposing H0H_{0} costs little in fit. A value close to zero means that H0H_{0} fits the data much worse than the full model, and this is the evidence against H0H_{0}.

Since we usually work with log-likelihoods, it is convenient to express the test on the log scale. We call

equation (25.1) (25.1)
W=−2⁢log⁡Λ⁢(X)=2⁢(ℓ⁢(θ^)−ℓ⁢(θ^0))W=-2\log\Lambda(X)=2\bigl{(}\ell(\hat{\theta})-\ell(\hat{\theta}_{0})\bigr{)}

the generalised likelihood-ratio statistic. It is twice the drop in the maximised log-likelihood when H0H_{0} is imposed. Since −2⁢log-2\log is decreasing, we have Λ⁢(X)≤c\Lambda(X)\leq c if and only if W≥−2⁢log⁡cW\geq-2\log c, and thus the test rejects H0H_{0} for large values of WW.

As a first example, we apply the test to the two-sided problem from lecture 23, for which no uniformly most powerful test exists. When the variance is known, the distribution of WW under H0H_{0} can be found exactly.

Example 25.2.

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. N⁢(θ,σ2)N(\theta,\sigma^{2}) with known σ2\sigma^{2} and consider the null hypothesis H0:θ=θ0H_{0}\colon\theta=\theta_{0} against the alternative H1:θ≠θ0H_{1}\colon\theta\neq\theta_{0}. Thus we have Θ=ℝ\Theta=\mathbb{R} and Θ0={θ0}\Theta_{0}=\{\theta_{0}\}. From example 5.4 we know that the log-likelihood

ℓ⁢(θ)=−n2⁢log⁡(2⁢π⁢σ2)−12⁢σ2⁢∑i=1n(Xi−θ)2\ell(\theta)=-\frac{n}{2}\log(2\pi\sigma^{2})-\frac{1}{2\sigma^{2}}\sum_{i=1}^% {n}(X_{i}-\theta)^{2}

attains its maximum over ℝ\mathbb{R} at θ^=X¯\hat{\theta}=\bar{X}. Since the null hypothesis is simple, the restricted maximiser is θ0\theta_{0} and using formula (25.1) we find

W=2⁢(ℓ⁢(X¯)−ℓ⁢(θ0))=1σ2⁢(∑i=1n(Xi−θ0)2−∑i=1n(Xi−X¯)2).W=2\bigl{(}\ell(\bar{X})-\ell(\theta_{0})\bigr{)}=\frac{1}{\sigma^{2}}\Bigl{(}% \sum_{i=1}^{n}(X_{i}-\theta_{0})^{2}-\sum_{i=1}^{n}(X_{i}-\bar{X})^{2}\Bigr{)}.

Using the identity (2.1) from lecture 2, where θ0\theta_{0} is substituted for μ\mu, we find that the difference of the two sums of squares is n⁢(X¯−θ0)2n(\bar{X}-\theta_{0})^{2}. Thus we have

equation (25.2) (25.2)
W=n⁢(X¯−θ0)2σ2=Z2,where ⁢Z=n⁢(X¯−θ0)σ.W=\frac{n(\bar{X}-\theta_{0})^{2}}{\sigma^{2}}=Z^{2},\qquad\text{where }Z=% \frac{\sqrt{n}\,(\bar{X}-\theta_{0})}{\sigma}.

The test rejects for large values of WW, i.e. for large values of |Z||Z|. Thus we have recovered the two-sided zz-test, which example 22.8 derived by common sense.

Under ℙθ0\mathbb{P}_{\theta_{0}}, the statistic ZZ is standard normally distributed by proposition A.4 and thus, by definition A.2, its square W=Z2W=Z^{2} satisfies W∼χ12W\sim\chi^{2}_{1} for every sample size nn. Let χr,p2\chi^{2}_{r,p} be the pp-quantile of the χr2\chi^{2}_{r} distribution. Then the level α\alpha test rejects if W≥χ1,1−α2W\geq\chi^{2}_{1,1-\alpha}. Since ℙθ0⁢(Z2≥z1−α/22)=ℙθ0⁢(|Z|≥z1−α/2)=α\mathbb{P}_{\theta_{0}}(Z^{2}\geq z_{1-\alpha/2}^{2})=\mathbb{P}_{\theta_{0}}(% |Z|\geq z_{1-\alpha/2})=\alpha, the value z1−α/22z_{1-\alpha/2}^{2} is the (1−α)(1-\alpha)-quantile of χ12\chi^{2}_{1} and thus we have χ1,1−α2=z1−α/22\chi^{2}_{1,1-\alpha}=z_{1-\alpha/2}^{2}; from the tables we find χ1,0.952=3.841=1.962\chi^{2}_{1,0.95}=3.841=1.96^{2}. For n=25n=25, σ=2\sigma=2, θ0=10\theta_{0}=10 and observed mean x¯=10.9\bar{x}=10.9, for the data from lecture 22, we find w=25⋅0.81/4=5.06w=25\cdot 0.81/4=5.06, which is larger than 3.8413.841 and thus H0H_{0} is rejected at level 0.050.05. The pp-value is ℙ⁢(χ12≥5.06)=2⁢(1−Φ⁢(5.06))=2⁢(1−Φ⁢(2.25))=0.0244\mathbb{P}(\chi^{2}_{1}\geq 5.06)=2\bigl{(}1-\Phi(\sqrt{5.06})\bigr{)}=2\bigl{% (}1-\Phi(2.25)\bigr{)}=0.0244, which is the same value as obtained for the two-sided test in section 22.5.

One more property follows directly from the definition. If ψ=τ⁢(θ)\psi=\tau(\theta) is a one-to-one reparametrisation, the suprema in the definition of Λ\Lambda do not change and thus Λ\Lambda and WW do not depend on the choice of parametrisation of the model. This is the same invariance as in proposition 5.6, and exercise 25.3 verifies it in an example.

25.2 Wilks’ Theorem

In example 25.2 the statistic WW is exactly χ12\chi^{2}_{1} distributed under H0H_{0}, because X¯\bar{X} is exactly normal. Wilks’ theorem shows that in regular models WW has approximately a chi-squared distribution under H0H_{0} for large samples.

The theorem is stated for hypotheses which fix some coordinates of the parameter. Let Θ⊆ℝk\Theta\subseteq\mathbb{R}^{k} be open, write θ=(θ1,…,θk)\theta=(\theta_{1},\dots,\theta_{k}) for the coordinates of the parameter and let the null hypothesis fix the first rr coordinates at given values,

equation (25.3) (25.3)
Θ0={θ∈Θ|θj=θj0⁢ for all ⁢j≤r},\Theta_{0}=\bigl{\{}\,\theta\in\Theta\mathrel{\big{|}}\theta_{j}=\theta_{j}^{0% }\text{ for all }j\leq r\,\bigr{\}},

where 1≤r≤k1\leq r\leq k. For r=kr=k the null hypothesis is simple, and for r<kr<k the free coordinates θr+1,…,θk\theta_{r+1},\dots,\theta_{k} are nuisance parameters, unknown parameters about which the hypothesis says nothing. The number rr of constraints is the difference between the dimensions of Θ\Theta and Θ0\Theta_{0}.

Theorem 25.3 (Wilks).

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. from a model with parameter θ∈Θ⊆ℝk\theta\in\Theta\subseteq\mathbb{R}^{k} which is regular enough for the vector form of theorem 17.1, stated without its conditions in section 17.6, to hold. Let Θ0\Theta_{0} be of the form (25.3), suppose that with probability tending to one the restricted maximum likelihood estimator is the unique root of the likelihood equations over Θ0\Theta_{0}, and let Wn=−2⁢log⁡ΛnW_{n}=-2\log\Lambda_{n} be the generalised likelihood-ratio statistic for a sample of size nn. Then for every θ∈Θ0\theta\in\Theta_{0} we have

Wn→dχr2W_{n}\xrightarrow{\ \mathrm{d}\ }\chi^{2}_{r}

under ℙθ\mathbb{P}_{\theta} as n→∞n\to\infty.

We only give a proof sketch for the simplest case k=r=1k=r=1, a one-dimensional parameter with a simple null hypothesis, which shows where the chi-squared distribution comes from.

Proof sketch for k=r=1k=r=1.

In this case we write the null hypothesis as H0:θ=θ0H_{0}\colon\theta=\theta_{0}, where θ0\theta_{0} is the value θ10\theta_{1}^{0} from (25.3), and we have Wn=2⁢(ℓ⁢(θ^n)−ℓ⁢(θ0))W_{n}=2\bigl{(}\ell(\hat{\theta}_{n})-\ell(\theta_{0})\bigr{)}. We will expand the log-likelihood around the maximum likelihood estimator (MLE) instead of around θ0\theta_{0} as in lecture 17: using Taylor’s theorem with the Lagrange form of the remainder we find

ℓ⁢(θ0)=ℓ⁢(θ^n)+ℓ′⁢(θ^n)⁢(θ0−θ^n)+12⁢ℓ′′⁢(θn∗)⁢(θ0−θ^n)2\ell(\theta_{0})=\ell(\hat{\theta}_{n})+\ell^{\prime}(\hat{\theta}_{n})(\theta% _{0}-\hat{\theta}_{n})+\tfrac{1}{2}\,\ell^{\prime\prime}(\theta_{n}^{*})(% \theta_{0}-\hat{\theta}_{n})^{2}

for some θn∗\theta_{n}^{*} between θ0\theta_{0} and θ^n\hat{\theta}_{n}. Under the conditions of the theorem, θ^n\hat{\theta}_{n} solves the likelihood equation with probability tending to one. On this event the first derivative at θ^n\hat{\theta}_{n} is zero. When we rearrange, the factor 22 in WnW_{n} cancels the factor 12\tfrac{1}{2} of the remainder term, and we get

equation (25.4) (25.4)
Wn=−ℓ′′⁢(θn∗)⁢(θ^n−θ0)2=(−1n⁢ℓ′′⁢(θn∗))⁢(n⁢(θ^n−θ0))2.W_{n}=-\ell^{\prime\prime}(\theta_{n}^{*})\,(\hat{\theta}_{n}-\theta_{0})^{2}=% \Bigl{(}-\frac{1}{n}\,\ell^{\prime\prime}(\theta_{n}^{*})\Bigr{)}\Bigl{(}\sqrt% {n}\,(\hat{\theta}_{n}-\theta_{0})\Bigr{)}^{2}.

Now assume that H0H_{0} is true. By theorem 17.1 we have n⁢(θ^n−θ0)→dN⁢(0,1/ℐ︀⁢(θ0))\sqrt{n}\,(\hat{\theta}_{n}-\theta_{0})\xrightarrow{\ \mathrm{d}\ }N\bigl{(}0,% 1/\mathcal{I}(\theta_{0})\bigr{)}, and thus, by the continuous mapping theorem, proposition A.17, the second factor converges in distribution to Y2/ℐ︀⁢(θ0)Y^{2}/\mathcal{I}(\theta_{0}), where YY is standard normally distributed. The first factor is the term BnB_{n} from the proof of theorem 17.1, which converges in probability to ℐ︀⁢(θ0)\mathcal{I}(\theta_{0}) by the law of large numbers, proposition A.14, but evaluated at θn∗\theta_{n}^{*} instead of θ0\theta_{0}. Since θn∗\theta_{n}^{*} is between θ0\theta_{0} and the consistent estimator θ^n\hat{\theta}_{n}, the bound (R4) on the third derivative shows, as for the observed information in section 17.3, that this factor still converges in probability to ℐ︀⁢(θ0)\mathcal{I}(\theta_{0}). Finally, by Slutsky’s theorem, proposition A.16, we find

Wn→dℐ︀⁢(θ0)⋅Y2ℐ︀⁢(θ0)=Y2∼χ12,W_{n}\xrightarrow{\ \mathrm{d}\ }\mathcal{I}(\theta_{0})\cdot\frac{Y^{2}}{% \mathcal{I}(\theta_{0})}=Y^{2}\sim\chi^{2}_{1},

by definition A.2. Since the Fisher information cancels, the limit is independent of the details of the model. This completes the proof sketch. ∎

The proof for the general case is more challenging: the expansion will be in kk variables and will use the vector version of theorem 17.1, and the limit which replaces Y2Y^{2} will be the sum of rr independent, squared standard normal variables, one for each constraint. This is the origin of the number rr of degrees of freedom in the theorem. We omit this proof here.

25.3 Using the Theorem

Wilks’ theorem turns the generalised likelihood-ratio test into a recipe: compute the statistic W=2⁢(ℓ⁢(θ^)−ℓ⁢(θ^0))W=2\bigl{(}\ell(\hat{\theta})-\ell(\hat{\theta}_{0})\bigr{)} from the two maximised log-likelihoods, found numerically if need be as in lecture 18; count the degrees of freedom r=dimΘ−dimΘ0r=\dim\Theta-\dim\Theta_{0}; reject H0H_{0} at approximate level α\alpha, if W≥χr,1−α2W\geq\chi^{2}_{r,1-\alpha}; and report the approximate pp-value ℙ⁢(χr2≥w)\mathbb{P}(\chi^{2}_{r}\geq w) for the observed value ww. Only the counting of degrees of freedom requires some care: nuisance parameters are unrestricted under both hypotheses and do not count.

The theorem is a limit statement and there are three cases where problems can occur when applying the theorem to a fixed nn. First, the approximation may be poor for small sample size, as exercise 25.1 shows, and lecture 27 uses simulation to show how it improves as nn increases. Whenever the exact distribution of WW or of an equivalent test statistic is known, this distribution should be used, and lecture 31 does so for the standard tests. Secondly, if the regularity conditions are violated, for example if the support of the distribution depends on the parameter or if the model requires θ≥0\theta\geq 0 and the null hypothesis is H0:θ=0H_{0}\colon\theta=0, the expansion (25.4) will break down and the limit will not be χr2\chi^{2}_{r}. Finally, the theorem only describes WW under H0H_{0}. The theorem gives the size of the test, but the power of the test must be determined separately.

Summary.
  • •
    ​

    For hypotheses H0:θ∈Θ0H_{0}\colon\theta\in\Theta_{0} against H1:θ∈Θ∖Θ0H_{1}\colon\theta\in\Theta\setminus\Theta_{0}, the generalised likelihood ratio is Λ=supΘ0L/supΘL∈[0,1]\Lambda=\sup_{\Theta_{0}}L/\sup_{\Theta}L\in[0,1], and the generalised likelihood-ratio test rejects for small Λ\Lambda, i.e. for large W=−2⁢log⁡Λ=2⁢(ℓ⁢(θ^)−ℓ⁢(θ^0))W=-2\log\Lambda=2(\ell(\hat{\theta})-\ell(\hat{\theta}_{0})).

  • •
    ​

    For a two-point parameter space Θ={θ0,θ1}\Theta=\{\theta_{0},\theta_{1}\} the test is the Neyman–Pearson test; in general it is unchanged by reparametrisation.

  • •
    ​

    For a normal mean with known variance and H0:θ=θ0H_{0}\colon\theta=\theta_{0}, the statistic is W=n⁢(X¯−θ0)2/σ2=Z2W=n(\bar{X}-\theta_{0})^{2}/\sigma^{2}=Z^{2}, which is exactly χ12\chi^{2}_{1} under H0H_{0} and the test is the two-sided zz-test.

  • •
    ​

    Wilks’ theorem states that, under regularity conditions, if H0H_{0} fixes rr of the kk parameters, then W→dχr2W\xrightarrow{\ \mathrm{d}\ }\chi^{2}_{r} under H0H_{0}. The theorem is given without proof. For k=r=1k=r=1, a Taylor expansion of ℓ\ell around θ^n\hat{\theta}_{n} together with theorem 17.1 shows why the limit is χ12\chi^{2}_{1}.

  • •
    ​

    To use the theorem, compute WW from the two maximised log-likelihoods, count r=dimΘ−dimΘ0r=\dim\Theta-\dim\Theta_{0}, reject if W≥χr,1−α2W\geq\chi^{2}_{r,1-\alpha}. The approximation can be poor for small nn, the test fails if the regularity conditions are violated, and the power must be determined separately.

Exercise 25.1.

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. N⁢(μ,σ2)N(\mu,\sigma^{2}), where both parameters are unknown. Consider the hypothesis H0:μ=μ0H_{0}\colon\mu=\mu_{0} against the alternative H1:μ≠μ0H_{1}\colon\mu\neq\mu_{0}, where σ2\sigma^{2} is a nuisance parameter. Let Q=∑i(Xi−X¯)2Q=\sum_{i}(X_{i}-\bar{X})^{2}, S2=Q/(n−1)S^{2}=Q/(n-1) and t=n⁢(X¯−μ0)/St=\sqrt{n}\,(\bar{X}-\mu_{0})/S.

  1. 1.
    ​

    Following example 5.4, show that the maximised log-likelihood function over Θ\Theta is given by

    −n2⁢log⁡(2⁢π⁢Q/n)−n2.-\frac{n}{2}\log(2\pi Q/n)-\frac{n}{2}.
  2. 2.
    ​

    Show that, restricting ourselves to the region μ=μ0\mu=\mu_{0}, the maximum of the likelihood function is attained for σ^02=1n⁢∑i(Xi−μ0)2\hat{\sigma}_{0}^{2}=\frac{1}{n}\sum_{i}(X_{i}-\mu_{0})^{2} and find an expression for σ^02\hat{\sigma}_{0}^{2} in terms of QQ and X¯−μ0\bar{X}-\mu_{0} using the identity (2.1).

  3. 3.
    ​

    Deduce that

    W=n⁢log⁡(1+t2n−1),W=n\log\Bigl{(}1+\frac{t^{2}}{n-1}\Bigr{)},

    and that the generalised likelihood-ratio test rejects for large values of |t||t|.

  4. 4.
    ​

    State the approximate distribution of WW under H0H_{0} given by theorem 25.3 and justify your answer for the degrees of freedom. Recall that, under H0H_{0}, the statistic tt follows the tn−1t_{n-1} distribution by definition A.5 and proposition A.4. For n=10n=10, determine the value of |t||t| above which the approximate test with critical value χ1,0.952=3.841\chi^{2}_{1,0.95}=3.841 rejects and compare your result with the 0.9750.975-quantile 2.2622.262 of the t9t_{9} distribution. Comment upon your result.

Exercise 25.2.

An experiment with mm possible outcomes is repeated nn times independently. The number of times each outcome occurs is given by NjN_{j} for outcome jj. Thus, (N1,…,Nm)(N_{1},\dots,N_{m}) is multinomially distributed with probability weights

ℙp⁢(N1=n1,…,Nm=nm)=n!n1!⁢⋯⁢nm!⁢p1n1⁢⋯⁢pmnm\mathbb{P}_{p}(N_{1}=n_{1},\dots,N_{m}=n_{m})=\frac{n!}{n_{1}!\cdots n_{m}!}\,% p_{1}^{n_{1}}\cdots p_{m}^{n_{m}}

for all n1,…,nm∈ℕ0n_{1},\dots,n_{m}\in\mathbb{N}_{0} with n1+⋯+nm=nn_{1}+\dots+n_{m}=n, where p=(p1,…,pm)p=(p_{1},\dots,p_{m}) satisfies pj>0p_{j}>0 and ∑jpj=1\sum_{j}p_{j}=1. We test H0:p=p0H_{0}\colon p=p^{0} for a given vector p0=(p10,…,pm0)p^{0}=(p_{1}^{0},\dots,p_{m}^{0}) with pj0>0p_{j}^{0}>0 for all jj and ∑jpj0=1\sum_{j}p_{j}^{0}=1 against the alternative p≠p0p\neq p^{0}.

  1. 1.
    ​

    Show that the log-likelihood function is ∑jnj⁢log⁡pj\sum_{j}n_{j}\log p_{j} up to an additive constant and use the Lagrange multiplier method, with constraint ∑jpj=1\sum_{j}p_{j}=1, to show that the maximum of the likelihood function is at p^j=nj/n\hat{p}_{j}=n_{j}/n.

  2. 2.
    ​

    Show that

    W=2⁢∑j=1mnj⁢log⁡njn⁢pj0,W=2\sum_{j=1}^{m}n_{j}\log\frac{n_{j}}{n\,p_{j}^{0}},

    where 0⁢log⁡0=00\log 0=0.

  3. 3.
    ​

    Explain why theorem 25.3 gives W→dχm−12W\xrightarrow{\ \mathrm{d}\ }\chi^{2}_{m-1} under H0H_{0}.

  4. 4.
    ​

    A die is thrown 6060 times and the six faces appear 1313, 88, 1111, 66, 1212 and 1010 times, respectively. Test the hypothesis that the die is fair at level 0.050.05, using χ5,0.952=11.07\chi^{2}_{5,0.95}=11.07.

  5. 5.
    ​

    Let nj=n⁢pj0+djn_{j}=np_{j}^{0}+d_{j} so that ∑jdj=0\sum_{j}d_{j}=0. Show that, by expanding the logarithm to second order in dj/(n⁢pj0)d_{j}/(np_{j}^{0}), we find

    W≈∑j=1m(nj−n⁢pj0)2n⁢pj0.W\approx\sum_{j=1}^{m}\frac{(n_{j}-np_{j}^{0})^{2}}{np_{j}^{0}}.

    This is Pearson’s chi-squared statistic. Compute the value for the die in the previous part of the question.

Exercise 25.3.

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. with Bernoulli distribution, i.e. with success probability p∈(0,1)p\in(0,1). Furthermore, let S=∑iXiS=\sum_{i}X_{i} and p^=S/n\hat{p}=S/n and consider the hypothesis H0:p=p0H_{0}\colon p=p_{0} against the alternative H1:p≠p0H_{1}\colon p\neq p_{0}.

  1. 1.
    ​

    Show that

    W=2⁢(S⁢log⁡p^p0+(n−S)⁢log⁡1−p^1−p0),W=2\Bigl{(}S\log\frac{\hat{p}}{p_{0}}+(n-S)\log\frac{1-\hat{p}}{1-p_{0}}\Bigr{% )},

    where we use the convention 0⁢log⁡0=00\log 0=0.

  2. 2.
    ​

    Determine the approximate distribution of WW under H0H_{0} for large nn and use the resulting distribution to derive a test at level α\alpha.

  3. 3.
    ​

    In n=50n=50 trials, we observed 3232 successes. Test the hypothesis H0:p=1/2H_{0}\colon p=1/2 at level 0.050.05 and determine the approximate pp-value.

  4. 4.
    ​

    In exercise 17.2, the model was reparametrised using the log-odds ψ=log⁡(p/(1−p))\psi=\log\bigl{(}p/(1-p)\bigr{)}. Show that the generalised likelihood-ratio statistic for testing H0:ψ=ψ0H_{0}\colon\psi=\psi_{0} coincides with the one in the first part for p0=eψ0/(1+eψ0)p_{0}=e^{\psi_{0}}/(1+e^{\psi_{0}}), the value of the null proportion.