Stat 111 Homework 6 Solutions, Spring 2015

Stat 111 Homework 6 Solutions, Spring 2015
Problem 1. Suppose we observed i.i.d. survival times for n patients after they received an exciting
new treatment, Y1 , , Yn ∼ Expo(λ) for some fixed λ.
(a) What is the MLE of λ?
Maximizing the log-likelihood by differentiation shows that the MLE is λ̂ = 1/Ȳ .
(b) What is the expected Fisher information for the MLE?
In an exponential distribution, the expected Fisher Information is nλ−2 .
(c) What is the asymptotic distribution for λ̂M LE ?
√
We know that the MLE is asymptotically Normal, that is: n(λ̂ − λ) → N (0, λ2 ) (here, the right
2
arrow is meant to indicate convergence in distribution), which means that approximately λ̂ ∼ N (λ, λn ).
You would like to instead make an inference on the mean survival time, µ = 1/λ, for these patients.
*Hint: Use the Delta method and the invariance principle for the following parts:
(d) What are the mean and variance of the MLE for µ? What is the asymptotic distribution of that
estimator?
By the delta method and invariance of the MLE, the MLE of µ is g(λ̂) = λ̂−1 = Ȳ , which has asymptotic distribution: Ȳ ∼ N ( λ1 , nλ1 2 ). Note: g 0 (λ) = −λ−2 .
(e) Based on the facts that Yi ∼ Expo(λ) and we are estimating a mean, why do the results in
part (d) make sense?
By the Central Limit Theorem, the sample mean should converge to the stated distribution.
Problem 2. You forget if Marathon Monday (April 20) is a University holiday or not, and you try
to determine this based on the shuttle bus schedule (why you wont look it up online is a whole other
story). Let Xi = the amount of time between shuttle bus arrivals at Memorial hall. It is reasonable
to assume independent Xi ∼ Expo(λ), with λ = 1/10 minutes on a normal weekday, and λ = 1/20
minutes on University holidays.
(a) You wait at the bus stop for 60 minutes on Marathon Monday and count how many busses arrive.
Let Y = # busses that arrive during this time. What distribution does Y have if Marathon Monday
is a normal weekday? What if it is a University holiday?
If waiting times are exponential, then the number of busses are distributed Poisson with parameter
λt. (Stat 110 Fact) In particular for a weekday the distribution is Pois(6) and for a holiday it is Pois(3).
(b) What are your hypotheses? What is the test statistic?
We are trying to determine if it is a holiday, so consistent with the “proof by contradiction” interpretation, we set up H0 : λ = 1/10 versus HA : λ = 1/20. The test statistic T is the total number of bus
counts in the 60 minute period, which is reasonable since we know its distribution follows a Poisson
based on part (a).
1
(c) Provide a reasonable critical region for the test statistic. What is α, the probability of Type I
error, for this test?
If we try to get close to α = .05. qpois(0.05,lambda=6) yields a rejection rule of : “Reject if T ≤ 2”.
The exact type-I error for this rule is .062. However, there is no real reason to set α = 0.05 here since
the two hypotheses could easily be switched (since they are both simple hypotheses). A better choice
would be to lower the sum of the two types of errors, which would lead to a rejection region of “Reject
if T ≤ 4”, which gives Type I error of 0.285 (and Type II error of 0.185). Other choices besides these
two could be reasonable as well with the correct justification.
(d) What is the power for this test under the alternative hypothesis?
The power is the probability T <= 2 assuming a Poisson distribution with mean 3. Calculating in R
using ppois(2,lambda=3), we determine this to be 0.423.
(e) How can you increase the power of this test? Explain in 1-2 sentences.
Intuitively, the power of the test will increase if the null and alternative distributions are spread further
apart. One way to achieve this is wait for a longer duration of time at the stop to increase λt.
Problem 3. Let i.i.d X1 , ..., Xn ∼ N (µX , σ 2 ) and independently i.i.d. Y1 , ..., Yn ∼ N (µY , σ 2 ) with σ 2
known (σ 2 and n are the same for the two groups).
(a) What is the distribution of (Ȳ − X̄)?
The distribution of the sum of independent normals is normal with means and variances summed.
From this we can derive that Ȳ − X̄ is N (µY − µX , 2σ 2 /n).
Unless stated otherwise, let σ 2 = 102 , n = 16, and α = 0.05 for the remaining parts:
(b) Let H0 : µY ≤ µX , HA : µY > µX . Evaluate the power function for the test when µY = 10 and
µX = 9.
To determine the power of the test we first determine the critical region. That is, we determine c such
that P (T ≥ c) = 0.05, where T follows the null N (0, 200/16) distribution. This can be found with R’s
qnorm function: qnorm(0.95,mean=0,sd=sqrt(200/16)) which results in 5.815. Then to determine
the power, we determine P (U ≥ c) assuming U is distributed N (1, 200/16) which can be found with
pnorm(5.815,mean=1,sd=sqrt(200/16),lower.tail=FALSE), which is 0.0866.
(c) How many observations should be sampled (determine n and let it be the same in the two groups)
in order for the test in part (b) to have 90% power when HA : µY − µX = 2?
The smallest value of n such that the power is at least 0.90 is 429. To get this answer, we first need
to solve for n in the following set equation (Note: Φ−1 (1 − 0.90) = −1.28 and Φ−1 (0.95) = 1.645:
q


!
r
√
200
1.645
−
2
200
T −2
2 n
n
p
P T ≥ 1.645
|µY − µX = 2 = P Z = p
≥
= 1.645 − √
n
200
200/n
200/n
√ 2 n
= 1 − Φ 1.645 − √
= 0.90
200
2
This means that the interior of Φ must be equal to -1.28, thus solving for n we find:
n≥
200((Φ−1 (0.05) − Φ−1 (1 − 0.90))2 )
200((1.645 + 1.28)2 )
=
= 428.2 ≈ 429
22
22
Here’s the R command:
> 200*((qnorm(0.90)+qnorm(0.95))^2)/4
[1] 428.1924
(d) Now instead let H0 : µY = µX , HA : µY 6= µX , with all else the same as part (b). Calculate the
power for this test.
To determine the power of the test we first determine the critical region. That is, we determine c
such that P (|T | > c) = 0.05, where T follows the null N (0, 200/16) distribution. This can be found
with R’s qnorm function: qnorm(0.975,mean=0,sd=sqrt(200/16)) = 6.929519 Then to determine
the power, we determine P (|U | > c) assuming U is distributed N (1, 200/16) which can be found
with 1-pnorm(6.929519,mean=1,sd=sqrt(200/16))+pnorm(-6.929519,mean=1,sd=sqrt(200/16),
which is 0.0592.
(e) On one plot, sketch the power curves (by hand) for the test in parts (b) and (d) for various values
of µY − µX . Clearly label which curve is which.
0.6
0.4
0.0
0.2
power2side
0.8
1.0
The power curve should be U -shaped for the two sided test and S -shaped for the 1-sided test with
the 1-sided test slightly large on the positive axis. Here are the exact curves calculated in R, along
with the code that created the plot:
−15
−10
−5
0
5
10
15
delta
> delta=seq(-15,15,.1)
> power1side=1-pnorm(5.815,mean=delta,sd=sqrt(200/16))
> power2side=1-pnorm(6.93,mean=delta,sd=sqrt(200/16))+pnorm(-6.93,mean=delta,sd=sqrt(200/16))
> power1side[delta==1]
[1] 0.08661667
> power2side[delta==1]
[1] 0.05921473
> plot(power2side~delta,type="l",lwd=3,ylim=c(0,1))
> lines(power1side~delta,col="blue",lwd=3,lty=2)
(f) Compare the power curves in part (e). Why is this not surprising?
For µY > µX , the one sided test is more powerful than the two sided test. This is not surprising since
in the one-sided test we have a smaller critical value than the two-sided test.
3
Problem 4. Suppose that i.i.d Xi , ..., Xn ∼ Beta(a, 1).
(a) Let Y = − ln(X). Use the change of variables formula to calculate the PDF of Y (or determine it
through the CDF). What named distribution does Y follow?
Let FY be the CDF of Y .
FY = P {Y ≤ y}
= P {− ln(X) ≤ y}
= P {X ≥ e−y }
= 1 − FX (e−y )
Now differentiating w.r.t to y to determine the p.d.f, we find f (y) ∝ e−y fy (e−y ) = e−y ∗e−y(a−1) = e−ya .
This is of the form of an exponential distribution with parameter a.
For a1 > a0 , we would like to test the following hypotheses (a0 is known, a1 is unknown):
H0 : a = a0 vs. HA : a = a1
(b) What sample statistic is the Likelihood Ratio test based on? Call this statistic T . Determine
whether T is sufficient.
The Likelihood Ratio Test Statistic is calculated to be:
P
an e−a0 yi
Λ(a) = min 1, 0 −a P y =
i
a1 e 1
a0
a1
n
!
e−(a0 −a1 )
P
yi
It is the minimum since if the sample data is agreement with the null hypothesis,Pthe deonominator ends
up being calculated using a0 and is hence 1). The important statistic is T = yi , and it is sufficient
P
since it is the only statistic related to a in the likelihood: (in
P the factorization, h(x, θ) = exp[a · yi ].
Note: this can also be written in terms of T = nȳ or T = ln(xi ).
(c) Show that the Likelihood Ratio test is monotonic in T [this shows that the test is uniformly most
powerful].
Based on part (a), we can write the log of the likelihood ratio as proportional to T (a1 − a0 ). Since
the log is monotonic in T , the likelihood is monotonic in T . (Exponentiation is monotonic, and the
composition of monotonic functions is monotonic.)
(d) Let a0 = 1 and n = 10. What value of c should be chosen so that the critical region T ≤ c leads
to an α = 0.05 level of the test. You can use R for this problem. [Hint: you will need to determine
the distribution of T first].
By representation, the sum of n i.i.d Expo(λ) r.v.s is Gamma(n, λ). (This can also be verified inductively.) In R, qgamma(0.05,shape=10) yields 5.425.
4