### HW07

```Statistics 2: Worksheet 7
November 2014
This homework is due in at 5pm on Thu. 20th Nov. Hand in your answer to
Q1(a,b,c,d) and Q2d.
1. A Dutch farmer buys a large box of tulip bulbs from a wholesaler. However,
when he gets home, he cannot remember whether he bought the box with
(i) 60% red and 40% yellow bulbs, or (ii) 25% red and 75% yellow. So he
plants 12 bulbs. He decides he will select (i) if 8 or more come up red, and (ii)
otherwise.
(a) Formulate this as a hypothesis test, identifying the random variables and
their distribution (state your assumptions clearly), the null and alternative
hypotheses, and the critical region in terms of the test statistic and the
critical value.
[Hint: consider the random variables Xi such that Xi = 0 with probability
1−p if bulb i is yellow, and Xi = 1 if bulb i is red and the random variable
P
T (X) = ni=1 Xi .]
(b) What is the power function for this test? What is the significance level
(α) and the Type II error level (β)?
(c) In R, plot the power function, and show the two hypotheses.
(d) Show that the farmer’s test statistic is optimal, in the Neyman-Pearson
(NP) sense.
(e) What size of sample and what critical value should the farmer select if he
wants a level 5% test with Type 2 error of 10%? Plot the power function
with this choice of n and c.
Hint: generalise your power function to include n and c as arguments.
Then use trial and error to find n and c values which satisfy both criteria. You will not be able to match either criteria exactly (because the
1
test statistic y is discrete), so getting within 1 percentage point on each
criterion is good enough.
2. Consider a test between two simple hypotheses. For each of the following
statistical models, derive the NP optimal test statisic, and try to find the
simplest equivalent representation.
iid
Hint: often, when X ∼ f (θ), it is easiest to find the NP test statistic as
Qn
n
f (xi ; θ1 ) Y f (xi ; θ1 )
fn (x; θ1 )
i=1
T (x) =
= Qn
=
.
fn (x; θ0 )
f
(x
;
θ
)
i
0
i=1 f (xi ; θ0 )
i=1
In other words, find t(x) = f (x; θ1 )/f (x; θ0 ) first, and then take T (x) =
Qn
i=1 t(xi ).
iid
(a) X ∼ Poisson(λ), with H0 : λ = λ0 , H1 : λ = λ1 with 0 < λ1 < λ0 .
iid
(b) X ∼ Exponential(λ), and H0 : λ = λ0 , H1 : λ = λ1 with 0 < λ0 < λ1 .
iid
(c) X ∼ N(µ, σ 2 ), with σ 2 specified, and H0 : µ = µ0 , H1 : µ = µ1 with
µ0 < µ1 .
iid
(d) X ∼ N(µ, σ 2 ), with µ specified, and H0 : σ 2 = σ02 , H1 : σ 2 = σ12 with
0 < σ02 < σ12 .
End
2
```