Homework 4. Solutions. 1. Let X , ..., X

Homework 4.
Solutions.
1. Let X1 , ..., Xn be a sample from a Bernoulli distribution (iid) with parameter p.
(a) Construct the most powerful test for H0 : p = p0 vs HA : p = p1 , where p1 > p0 at the
significance level α.
By Neyman-Pearson’s Lemma the most powerful test rejects H0 if
p0
f (X1 , ..., Xn ; p0 )
Πn p0Xi (1 − p0 )1−Xi
n
<
c
⇔
Π
< c ⇔ i=1
i=1
Xi
n
f (X1 , ..., Xn ; p1 )
p1
Πi=1 p1 (1 − p1 )1−Xi
⇔
n X
Xi 1 − p0
1 − p1
1−Xi
<c
n
n
X
X
1 − p0
p0
p0 (1 − p1 )
+ (1 − Xi ) ln
< c2 ⇔
< c1 ⇔
Xi > k,
Xi ln
p1
1 − p1
p1 (1 − p0 )
i=1
i=1
Xi ln
i=1
(1−p1 )
1)
< 1 and ln pp01 (1−p
< 0. The number k should be chosen based on the signifisince pp10 (1−p
(1−p0 )
0)
cance level α to satisfy
n
X
α = P(
Xi > k|H0 ) = P (Binomial(n, p0 ) > k) or
P (Binomial(n, p0 ) ≤ k) = 1 − α.
i=1
In other words, k is (1 − α)-quantile of Binomial distribution with parameters n and p0 .
(b) What is the most powerful test for p0 = 0.3, n = 25, α = 0.098? (Hint: use Table 1
and part 2a)
In particular, for p0 = 0.3, n = 25, α = 0.098 we have P (Binomial(25, 0.3) ≤ 10) = 0.902
P
from Table 1, thus k = 10 and the most powerful test rejects H0 if 25
i=1 Xi > 10.
2
2. (a) Construct a Pearson’s χ test for
H0 : (X1 , X2 , X3 , X4 ) has multinomial distribution with parameters (θ1 , 2θ1 , θ2 , 1 − 3θ1 − θ2 )
against
HA : X has some other multinomial distribution,
at the significance level α = 0.05.
Note that m = 4, k = 2, so df = 4 − 1 − 2 = 1. Reject H0 at the 0.05 level of significance
if
4
X
(Xi − Ei )2
> χ21 (0.95) = 3.84,
E
i
i=1
where
E1 = nθˆ1 , E2 = n2θˆ1 , E3 = nθˆ2 , E4 = n(1 − 3θˆ1 − θˆ2 ).
Thus, we need to find the MLE of θ1,2 first. The likelihood function is
lik(θ1 , θ2 ) =
n!
θ1X1 (2θ1 )X2 θ2X3 (1 − 3θ1 − θ2 )X4 .
X1 !X2 !X3 !X4 !
The log-likelihood function is
L(θ1 , θ2 ) = ln
n!
+ X1 ln θ1 + X2 ln 2 + X2 ln θ1 + X3 ln θ2 + X4 ln(1 − 3θ1 − θ2 ).
X1 !X2 !X3 !X4 !
Then set the partial derivatives 0
L01 =
X 1 X2
X4 (−3)
X1 + X 2
3X3
+
+
=0⇔
=
θ1
θ1
(1 − 3θ1 − θ2 )
θ1
θ2
1
L02 =
Then
θ1 = θ2
X4 (−1)
X3
X4
X3
+
=0⇔
=
θ2
(1 − 3θ1 − θ2 )
θ2
(1 − 3θ1 − θ2 )
X 1 + X2
X3 ˆ
X1 + X 2
, X3 (1 − 3θ1 − θ2 ) = X4 θ2 ⇔ θˆ2 =
, θ1 =
3X3
n
3n
Thus
E1 = (X1 + X2 )/3, E2 = 2(X1 + X2 )/3, E3 = X3 , E4 = X4
and the test rejects H0 if
(X1 − (X1 + X2 )/3)2 (X2 − 2(X1 + X2 )/3)2
+
> χ21 (0.95) = 3.84,
(X1 + X2 )/3
2(X1 + X2 )/3
(b) Apply the test in (a) to the data X = (24, 32, 36, 8).
The expected counts are E = (56/3, 112/3, 36, 8). Pearson’s χ2 -statistic is 16/7 = 2.29 <
3.84, so do not reject H0 at 0.05 level significance.
2
3. Let X1 , ..., Xn be i.i.d. N (µX , σX
) random variables. Let Y1 , ..., Ym be i.i.d. N (µY , σY2 )
random variables. The sample (X1 , ..., Xn ) is independent from the sample (Y1 , ..., Ym ). Summary statistics are n = 13, X = 5.7, s2X = 1.5, m = 16, Y = 5.1, s2Y = 5.
2
= σY2 = 2. Construct a 95% confidence interval for µX − µY .
(a) Assume that σX
¯ Y¯ −∆
X−
This means case 1(a) Z = √
, so the confidence interval is
σ
1/n+1/m
s
s
s
√
¯ − Y¯ ± zα/2 σ 1 + 1 ⇔ 5.7 − 5.1 ± 1.96 2 1 + 1 ⇔ 0.6 ± 1.96 2 · 29 ⇔ 0.6 ± 1.035
X
n m
13 16
13 · 16
2
= σY2 , but it is unknown. Construct a 95% confidence interval
(b) Now assume that σX
for µX − µY .
q
¯ Y¯ −∆
X−
¯ − Y¯ ±tα/2 sp 1 + 1
This means case 1(b) T = √
, so the confidence interval is X
n
m
sp 1/n+1/m
12·1.5+15·5
= 3.44.
13+16−2
s2p
=
0.6 ± 2.052 ·
q
with df = n + m − 2,
Thus the CI is
3.44(1/13 + 1/16) ⇔ 0.6 ± 1.4965 ⇔ (−0.822, 2.022)
2
2
6= σY2 at the significance level
= σY2 is rejected against HA : σX
(c) Show that H0 : σX
α = 0.05.
s2
s2
1
This is F -test. Reject H0 is sX2 > F12,15 (0.975) = 2.96, or sX2 < 1/F15,12 (0.975) = 3.18
=
Y
s2
Y
0.3145. Observe sX2 = 1.5
= 0.3, so (marginally) reject H0 .
5
Y
(d) Using the result in (c), construct a 95% confidence interval for µX − µY . r
2
¯ Y¯ −∆
¯ − Y¯ ± tα/2 sX +
This means case 2. T = √ X−
, the confidence interval is X
2
2
n
sX /n+xY /m

with df =
s2
X
n

 2 2
 (sX /n)
n−1
s2
Y
+m
+
2



(s2 /m)2 
Y
"
=
m−1
2
5
+ 16
( 1.5
)
13
#
= 24. Thus the CI is
(1.5/13)2
(5/16)2
+ 15
12
q
0.6 ± 2.064 1.5/13 + 5/16 ⇔ 0.6 ± 1.35 ⇔ (−0.75, 1.95).
2
s2Y
m
(e) Using the result in (c), test H0 : µX = µY + 1 against HA : µX < µY + 1 at the
significance level α = 0.05.
¯ Y¯ −∆
H0 : µX − µY = 1 versus HA : µX − µY < 1. Reject H0 if √ X−
< −tα with
2
2
sX /n+xY /m
df = 24. Observe √
0.6−1
1.5/13+5/16
= −0.6115 > −1.711, so do not reject H0 .
= √−0.4
89
16·13
4. Find the exact null distribution (i.e. the distribution under the null hypothesis) of
Wilcoxon signed rank sum for n = 6. Find the rejection rule for the two-sided test at the
significance level α = 0.25.
The statistic W+ takes on possible values between 0 (all differences are negative) and
21 = 1+...+6 (all differences are positive). Altogether there are 26 = 64 possible assignments
of signs to 6 differences. The distribution of W+ under H0 is symmetric, with the center
(median) 10.5. Thus, we only need to find probabilities P (W+ = k|H0 ), k = 0, 1, ..., 10, since
P (W+ = k|H0 ) = P (W+ = 21 − k|H0 ). The following table summarizes different cases with
corresponding probabilities
2
3
4
5
6
7
8
9
10
W+ 0 1
∅ {1} {2} {3}
{4}
{5}
{6}
{1, 2} {1, 3} {1, 4} {1, 5}
{1, 6}
{2, 3} {2, 4}
{2, 5}
{2, 6}
{3, 4}
{3, 5}
{3, 6}
{4, 5}
{4, 6}
{1, 2, 3} {1, 2, 4} {1, 2, 5} {1, 2, 6}
{1, 3, 4} {1, 3, 5} {1, 3, 6}
{1, 4, 5}
{2, 3, 4} {2, 3, 5}
{1, 2, 3, 4}
1
1
1
2
2
3
4
4
4
5
5
P
64
64
64
64
64
64
64
64
64
64
64
Since 64α/2 = 8, at most 8 different assignments of signs should be included in one half
of the rejection region. Then reject H0 if W+ ≤ 4 or W+ ≥ 21 − 4 = 17 (by symmetry).
Check
P (reject H0 |H0 ) = P (W+ ≤ 4 or W+ ≥ 17|H0 ) = 2P (W+ ≤ 4|H0 ) = 2
(But 2P (W+ ≤ 5|H0 ) = 0.3125 > 0.25)
3
7
= 0.21875 < 0.25.
64