Assignment #13 Solutions

Assignment 13
Exercise 8.4 For the hypotheses considered in Examples 8.12 and 8.13, the sign test
√
d
is based on the statistic N+ = #{i : Zi > 0}. Since 2 n(N+ /n − 12 ) → N (0, 1)
under the null hypothesis, the sign test (with continuity correction) rejects H0
when
√
uα n n
1
+ .
N+ − ≥
2
2
2
(a) Find the efficacy of the sign test. Make sure to indicate how you go about
verifying Equation (8.17).
Sketch of solution:
The indicators I{Zi > 0}, 1 ≤ i ≤ n,
are i.i.d. Bernoulli random variables with parameter F (θ), which is
the same as 1 − F (0 − θ). The N + statistic is the sum of these variables. Under the sequence of alternatives {θn }, it suffices to check that
the Lyapunov condition is satisfied by the triangular array of variables
formed by I{Z1 > 0} under θ1 , I{Z1 > 0}, I{Z2 > 0} under θ2 , etc.
This is straightforward because the Bernoulli variables are bounded.
(b) Find the ARE of the sign test with respect to the signed rank test and the
t-test. Evaluate each of these for the case of normal data.
Sketch of solution: With N + as the test statistic, we get µ(θ) = nF (θ)
and τ 2 (θ0 ) = n2 /4 for the sign test. Therefore, the efficacy of the sign test is
2f (0). This gives
f (0)2
R
and 4σ 2 f (0)2
2
2
3( f (z) dz)
as the ARE of the sign test with respect to the signed rank and t-tests, respectively.
For normal f (z), this gives ARE values of 2/3 and 2/π, respectively.
Exercise 8.5 Suppose X1 , . . . , Xn are a simple random sample from a uniform (0, 2θ)
distribution. We wish to test H0 : θ = θ0 against H1 : θ > θ0 at α = .05.
Define Q1 and Q3 to be the first and third quartiles of the sample. Consider test
A, which rejects when
Q3 − Q1 − θ0 ≥ An ,
274
and test B, which rejects when
X − θ0 ≥ Bn .
Based on the asymptotic distribution of X and the joint asymptotic distribution
of (Q1 , Q3 ), find the values of An and Bn that correspond with the test in (8.18).
Then find the asymptotic relative efficiency of test A relative to test B.
Sketch of solution:
Using the theory developed in Chapter 6 for the
joint distributions of quantiles (and a simple delta method application) for test
A, together with the central limit theorem for test B, we may show that
√
d
n(Q3 − Q − 1 − θ0 ) → N (0, θ2 ),
√
d
n(X − θ0 ) → N (0, θ2 /3)
under H0 because Var√Xi = θ2 /3. This means that we can take An = θ0 + uα θ0
and Bn = θ0 + uα θ0 / 3, where uα is the (1 − α) quantile of standard normal.
We also immediately obtain 1/3 as the ARE of test A with respect to test B.
Exercise 8.8 Let X1 , . . . , Xn be independent from Poisson (λ). Create a table in
which you list the exact power along with approximations (8.20) and (8.21) for
the test that rejects H0 : λ = 1 in favor of H1 : λ > 1 when
√
n(X n − λ0 )
√
≥ uα ,
λ0
where n = 20 and α = .05, against each of the alternatives 1.1, 1.5, and 2.
Sketch of solution: R code that accomplishes this is given below. For the
exact calculations, it uses the fact that the sum of independent Poisson variables
is Poisson.
alt=c(alt1.1=1.1, alt1.5=1.5, alt2.0=2.0)
u = qnorm(.95)
n = 20
null <- 1
alt <- c(alt1.1=1.1, alt1.5=1.5, alt2.0=2.0)
u <- qnorm(.95)
n <- 20
null <- 1
e8.20 <- pnorm(sqrt(n)*(alt-null)/sqrt(null) - u)
275
e8.21 <- pnorm(sqrt(n)*(alt-null)/sqrt(alt) - u*sqrt(null/alt))
exact <- 1-ppois(u*sqrt(n)+n, n*alt)
rbind(e8.20,e8.21,exact)
alt1.1
alt1.5
alt2.0
e8.20 0.1155286 0.7228116 0.9976528
e8.21 0.1267468 0.6853543 0.9772061
exact 0.1225030 0.6671309 0.9806610
Exercise 9.1 Hotelling’s T 2 . Suppose X(1) , X(2) , . . . are independent and identically
distributed from some k-dimensional distribution with mean µ and finite nonsingular covariance matrix Σ. Let Sn denote the sample covariance matrix
n
Sn
1 X (j)
(X − X)(X(j) − X)> .
=
n − 1 j=1
To test H0 : µ = µ0 against H1 : µ 6= µ0 , define the statistic
T 2 = (V(n) )> Sn−1 (V(n) ),
where V(n) =
√
n(X − µ0 ). This is called Hotelling’s T 2 statistic.
[Notes: This is a generalization of the square of a unidimensional t statistic. If the
sample is multivariate normal, then [(n − k)/(nk − k)]T 2 is distributed as Fk,n−k .
A Pearson chi square statistic may be shown to be a special case of Hotelling’s
T 2. ]
P
(a) You may assume that Sn−1 → Σ−1 (this follows from the weak law of large
numbers since P (Sn is nonsingular) → 1). Prove that under the null hypothesis,
d
T 2 → χ2k .
d
Sketch of solution: Under the null hypothesis, V(n) → Nk (0, Σ).
d
−1/2
Thus, Slutsky’s theorem gives Sn V(n) → Nk (0, Ik ), where we take the
−1/2
−1/2
square-root matrix so that it satisfies Sn Sn (Sn )> = Ik . The result
follows immediately.
√
(b) Let {µ(n) } be alternatives such that n(µ(n) − µ0 ) → δ. You may assume
that under {µ(n) },
√
d
n(X − µ(n) ) → Nk (0, Σ).
Find (with proof) the limit of the power against the alternatives {µ(n) } of the
test that rejects H0 when T 2 ≥ cα , where P (χ2k > cα ) = α.
276
Sketch of solution:
V(n) =
√
n(X − µ0 ) =
√
By Slutsky’s theorem,
n(X − µ(n) ) +
√
d
n(µ(n) − µ0 ) → Nk (δ, Σ)
under the sequence of alternatives µ(1) , µ(2) , . . .. Therefore,
d
Sn−1/2 V(n) → Nk (Σ−1/2 δ, Ik )
by Slutsky’s theorem. We conclude that
d
T 2 = (Sn−1/2 V(n) )> Sn−1/2 V(n) → χ2k (δ > σ −1/2 δ).
Therefore, the power converges to
P χ2k (δ > σ −1/2 δ) > cα .
(c) An approximate 1 − α confidence set for µ based on the result in part (a)
may be formed by plotting the elliptical set
{µ : n(X − µ)> Sn−1 (X − µ) = cα }.
1 3/5
For a random sample of size 100 from N2 (0, Σ), where Σ =
, pro3/5 1
duce a scatterplot of the sample and plot 90% and 99% confidence sets on this
scatterplot.
Hints: In part (c), to produce a random vector with the N2 (0, Σ) distribution,
take a N2 (0, I) random vector and left-multiply by a matrix A such that AA> =
Σ. It is not hard to find such an A (it may be taken to be lower triangular). One
way to graph the ellipse is to find a matrix B such that B > Sn−1 B = I. Then note
that
{µ : n(X − µ)> Sn−1 (X − µ) = cα } = {X − Bν : ν > ν = cα /n},
so it remains only to find points ν, closely spaced, such that ν > ν equals a constant. To find a matrix B such as the one specified, note that the matrix of
eigenvectors of Sn , properly normalized, gives an orthogonal matrix that diagonalizes.
Sketch of solution:
Below is some code that accomplishes this:
277
-1
-4
-3
-2
x[,2]
0
1
2
sigma <- matrix(c(1,.6,.6,1),2,2)
a <- chol(sigma)
n <- 100
x <- matrix(rnorm(2*n), ncol=2) %*% a
S <- var(x)
e <- eigen(solve(S))
B <- diag(c(1,1))
B <- e$vec %*% diag(sqrt(1/e$val))
theta <- seq(0,2*pi,len=250)
v1 <- cbind(cos(theta), sin(theta)) *
sqrt(qchisq(.90, 2) / n)
v2 <- cbind(cos(theta), sin(theta)) *
sqrt(qchisq(.99, 2) / n)
xbar=colMeans(x)
plot(x)
lines(t(xbar - B %*% t(v1)),
lwd = 2, lty = 2, col=2)
lines(t(xbar - B %*% t(v2)),
lwd = 2, lty = 2, col=3)
-3
-2
-1
0
1
2
x[,1]
Exercise 9.4 Pearson’s chi-square for a 2-way table: Product multinomial model.
If A and B are categorical variables with 2 and k levels, respectively, and we
collect random samples of size m and n from levels 1 and 2 of A, then classify
each individual according to its level of the variable B, the results of this study
may be summarized in a 2 × k table. The standard test of the independence of
variables A and B is the Pearson chi-square test, which may be written as
X
(Oj − Ej )2
,
Ej
all cells in table
where Oj is the observed count in cell j and Ej is the estimate of the expected
count under the null hypothesis. Equivalently, we may set up the problem as
follows: If X and Y are independent Multinomial(m, p) and Multinomial (n, p)
random vectors, respectively, then the Pearson chi-square statistic is
k X
(Xj − mZj /N )2 (Yj − nZj /N )2
2
W =
+
,
mZ
/N
nZ
/N
j
j
j=1
where Z = X + Y and N = n + m. (Note: I used W2 to denote the chi-square
statistic to avoid using yet another variable that looks like an X.)
Prove that if N → ∞ in such a way that n/N → α ∈ (0, 1), then
d
W2 → χ2k−1 .
278
Sketch of solution:
We first rewrite the chi-square statistic as follows:
k
1 X n[N Xi − m(Xi + Yi )]2 m[N Yi − n(Xi + Yi )]2
+
mnN 2 i=1
Zi /N
Zi /N
k 1 X m+n
=
[nXi − mYi ]2
2
mnN i=1 Zi /N
2
k mn X Yi Xi
−
/p̂i ,
=
N i=1 n
m
W2 =
where p̂i = Zi /N . We may then rewrite W2 as Vt Γ̂−1 V, where
r
mn Y1 X1
Yk Xk
V=
−
,...,
−
and
Γ̂ = diag(p̂1 , . . . , p̂k ).
N
n
m
n
m
The central limit theorem gives
√
d
m(X/m − p) → N (0, Σ) and
√
d
n(Y/n − p) → N (0, Σ),
where p is the common mean of X and Y under the null hypothesis and Σ =
diagΓ − ΓΓ> is the usual resulting covariance matrix. This leads to
√
d
N (X/m − p) → N (0, (1 − α)−1 Σ) and
√
d
N (Y/n − p) → N (0, α−1 Σ).
d
We may combine these two → results because X and Y are independent, and
after a little bit of algebra we obtain
d
V → N (0, Σ).
P
The Weak Law gives Γ̂ → Γ = diag(p1 , . . . , pk ), so we obtain
d
Γ̂−1/2 V → N (0, Γ−1/2 ΣΓ−1/2 ).
d
Thus, the usual chi-squared theory we’ve seen in the past shows that W 2 → χ2k−1 .
279