Loading [MathJax]/jax/output/HTML-CSS/jax.js

Example Problems on Hypothesis Testing

ST702 Homework 7 on Hypothesis Testing

8.2

In a given city it is assumed that the number of automobile accidents in a given year follows a Poisson distribution. In past years the average number of accidents per year was 15, and this year it was 10. Is it justified to claim that the accident rate has dropped?

Since λ is also the mean of the Poisson distribution, we want to test

P(X=10|λ=15)=10i=0e1515ii!.

We can do this in R.

> ppois(10, 15)
[1] 0.1184644

8.6

Suppose that we have two independent random samples: X1,,Xniidexp(θ) and Y1,,Ymiidexp(μ).

a

Find the LRT of H0:θ=μ vs. H1:θμ.

Our LRT looks like

λ(x,y)=supθni=11θexi/θmj=11θeyj/θsupθ,μni=11θexi/θmj=11μeyj/μ=supθ1θneni=1xi/θ1θmemj=1yj/θsupθ,μ1θneni=1xi/θ1μmemj=1yj/μ=supθ1θn+meni=1xi+mj=1yiθsupθ,μ1θneni=1xi/θ1μmemj=1yj/μ

We can take the derivative of the top and set it equal to zero to find the supremum.

topθ=exi+yjθθ(m+n+2)(xi+yj(m+n)θ)=0ˆθ=xi+yjm+n

We can do the same to the bottom. In Mathematica:

Solve[texteyμμmtn=0μexteyμμmtn=0,{μ,t}].

This gives

ˆμ=¯y, ˆθ=¯x.

Thus,

λ(x,y)=(m+n)m+n(ni=1xi)n(mj=1yj)mnnmm(ni=1xi+mj=1yj)m+n.

b

Show that the test in part (a) can be based on the statistic

T=XiXi+Yi. λ(x,y)=(m+n)m+n(ni=1xi)n(mj=1yj)mnnmm(ni=1xi+mj=1yj)m+n=(m+n)m+nnnmm(ni=1xini=1xi+mj=1yj)n(mj=1yjni=1xi+mj=1yj)m=(m+n)m+nnnmmTn(1T)m

c

Find the distribution of T when H0 is true.

If H0 is true then θ=μ

T=ni=1xini=1xi+mj=1yjni=1gamma(1,θ)ni=1gamma(1,θ)+mj=1gamma(1,θ)=gamma(n,θ)gamma(n,θ)+gamma(m,θ)=gamma(n,θ)gamma(n+m,θ)=beta(n,m)

8.8

A special case of a normal family is one in which th mean and the variance are related, that n(θ,aθ) family. If we are interested in testing this relationship regardless of the value of θ, we are again faced with a nuisance parameter problem.

a

Find the LRT of H0:a=1 vs. H1:a1 based on a sample X1,,Xn from a n(θ,aθ) family, where θ is unknown.

We will start by finding our MLEs (since we can follow the same process for top and bottom).

(θ,a)=nlog(2π)2nlog(aθ)x2i2θxi+nθ22aθa=n2a+x2i2θxi+nθ22a2θθ=n2θ+x2i2θxi+nθ22aθ2+xinθaθ

We can then set these equal to 0 and solve. In Mathematica:

Solve[-n/(2 a) + (x2 - 2 \[Theta] x1 + n \[Theta]^2)/(
    2 \[Theta] a^2) == 
   0 && -n/(2 \[Theta]) + (x2 - 2 \[Theta] x1 + 
   n \[Theta]^2)/(
    2 a \[Theta]^2) + (x1 - n \[Theta])/(a \[Theta]) == 
   0, {a, \[Theta]}]

Which gives

ˆθ=¯x,ˆa=(xi)2+n(x2i)nxi.

When a=1,

Solve[-n/(2 \[Theta]) + 
	(x2 - 2 \[Theta] x1 + n \[Theta]^2)/(
   2 *1 *\[Theta]^2) + 
   (x1 - n \[Theta])/(1* \[Theta]) == 0, \[Theta]]
ˆθ1=n+nn+4(x2i)2n

Thus,

λ(x)=(12πˆθ1)n/2e(xiˆθ1)22ˆθ1(12πˆaˆθ)n/2e(xiˆθ)22ˆaˆθ=(12πn+nn+4(x2i)2n)n/2e(xin+nn+4(x2i)2n)22ˆθ1(12π(xi)2+n(x2i)nxi¯x)n/2e(xi¯x)22(xi)2+n(x2i)nxi¯x

b

A similar question can be asked about a related family, the n(θ,aθ2) family. Thus, if X1,,XNiidn(θ,aθ2), where θ is unknown, find the LRT of H0:a=1 vs. H1:a1.

We will follow the same process as above.

a=n2a+x2i2θxi+nθ22a2θ2θ=2θn2x12aθ2+θ2(n)2θx1+x2aθ3+nθ
Solve[-(n/\[Theta]) - (-2 x1 - 2 n \[Theta])/(2 a \[Theta]^2) 
	+ ( x2 - 2 x1 \[Theta] - n \[Theta]^2)/(a \[Theta]^3) 
	== 0 && -n/(2 a) + (x2 - 2 \[Theta] x1 + 
	n \[Theta]^2)/(2 \[Theta]^2 a^2) == 0, {\[Theta], a}]

This gives

ˆθ=¯x, ˆa=(x2i)+n(xi)2(x2i).

With a=1

Solve[-(n/\[Theta]) - (- x1 - n \[Theta])/\[Theta]^2 
	+ ( x2 - 2 x1 \[Theta] - n \[Theta]^2)/\[Theta]^3 
	== 0 , \[Theta]]
ˆθ1=xi+(xi)2+4n(x2i)2n. λ(x)=(12πˆθ21)n/2e(xiˆθ1)22ˆθ21(12πˆaˆθ2)n/2e(xiˆθ)22ˆaˆθ2=(12πˆ(xi+(xi)2+4n(x2i)2n)2)n/2e(xixi+(xi)2+4n(x2i)2n)22ˆ(xi+(xi)2+4n(x2i)2n)2(12π(x2i)+n(xi)2(x2i)(¯x)2)n/2e(xi¯x)22(x2i)+n(xi)2(x2i)(¯x)2

8.9

Stefanski (1996) establishes the arithmetic-geometric-harmonic mean inequality (see Example 4.7.8 and Miscellanea 4.9.2) using a proof based on likelihood ratio tests. Suppose that Y1,,Yn are independent with pdfs λieλiyi, and we want to test H0:λ1==λn vs. H1λi are not all equal.

a

Show that the LRT statistic is given by (¯Y)n/(Yi)1 and hence deduce the arithmetic-geometric mean inequality.

Notice that Yiexponential(1/λi). The MLE of ˆλiis1Yi. Under H0, all of these are the same, so we have an iid sample and can say that ˆλ=1¯Y. Thus, the LRT statistic is

λ(x)=1¯yeyi¯y1yieyiyi=(1¯y)eyi¯y(1yi)e1=(1¯y)nen¯y¯y(1yi)en=(1¯y)n1yi.

Recall that the LRT is bounded above by 1.

1(1¯y)n1yi(1¯y)n1yi¯y(yi)1/n

b

Make the transformation Xi=1/Yi, and show that the LRT statistic based on X1,,Xn is given by [n/(1/Xi)]n/Xi and hence deduce the geometric-harmonic mean inequality.

First we can find the PDF of X.

P(Xy)=P(1Yy)=P(1/yY)=1P(Y1/y)FX=1eλxifx=λx2eλx

Then we can find the MLEs.

L(λ|x)=λix2ieλixi(λ|x)=log(λi)2log(xi)λixiλ=1λi1xiunder H00=nλ1xi1xi=nλˆλ=n1xiunder H10=1λi1xiˆλi=xi

Then, as above, we can calculate our LRT.

λ(x)=n1xix2ien1xixixix2iexixi=[n(1/Xi)]nXi

Again, this is bounded by 1, which gives us

¯x(xi)1/n