Professional Documents
Culture Documents
The subset of the real line R for which the test is equal to 1 is called the rejection
(or critical) region. The complement of the critical region (in the support of the
test statistic) is the acceptance region.
Example: let denote the (unknown) mean male age in Sweden.
You want to test: H0 : = 27 vs. H1 : 6= 27
100 , the average age of 100 randomly-drawn Swedish males.
Let your test statistic be X
Just as with estimators, there are many different possible tests, for a given pair of
hypotheses H0 , H1 . Consider the following four tests:
100 6 [25, 29]
1. Test 1: 1 X
100 6 29
2. Test 2: 1 X
100 6> 35
3. Test 3: 1 X
100 6= 27
4. Test 4: 1 X
Which ones make the most sense?
Also, there are many possible test statistics, such as: (i) med100 (sample median); (ii)
max(X1 , . . . , X100 ) (sample maximum); (iii) mode100 (sample mode); (iv) sin X1 (the
sine of the first observation).
In what follows, we refer to a test as a combination of both (i) a test statistic; and
(ii) the mapping from realizations of the test statistic to {0, 1}.
Next we consider some common types of tests.
1.1
P
1
2
(X
2)
exp
i
2
~ =
Pi
(X)
n )2
exp 12 i (Xi X
1 n
2
if max(X1 , . . . , Xn ) 2
if max(X1 , . . . , Xn ) > 2.
1 n
if max(X1 , . . . , Xn )
if max(X1 , . . . , Xn ) >
0
max(X1 ,...,Xn )
2
n if max(X1 , . . . , Xn ) > 2
otherwise
1 if max(X1 , . . . , Xn ) 2
0 otherwise.
(1)
(graph)
Wald Tests
Another common way to generate test statistics is to focus on statistics which are
asymptotically normal distributed, under H0 (i.e., if H0 were true).
A common situation is when the estimator for , call it n , is asymptotically normal,
with some asymptotic variance V (eg. MLE). Let the null be H0 : = 0 . Then, if
the null were true:
(n 0 ) d
q
N (0, 1).
1
V
n
(2)
statement
Zn
(n 0 ) d
q
N (0, 1)
1
V
n
still holds (using the plim operator and Slutsky theorems). In what follows, therefore,
we assume for simplicity that we know V .
We consider two cases:
(i) Two-sided test: H0 : = 0 vs. H1 : 6= 0 .
Under H0 : the CLT holds, and the t-stat is N (0, 1)
Under H1 : assume that the true value is some 1 6= 0 . Then the t-stat can be written
as
(n 1 ) (1 0 )
(n 0 )
q
= q
+ q
.
1
1
1
V
V
V
n
n
n
d
The first term N (0, 1), but the second (non-stochastic) term diverges to or ,
depending on whether the true 1 exceeds or is less than 0 . Hence the t-stat diverges
to or with probability 1.
Hence, in this case, your test should be 1(|Zn | > c), where c should be some number
in the tails of the N (0, 1) distribution.
Multivariate version: is K-dimensional, and asymptotic normal, so that under H0 ,
we have
d
n(n 0 ) N (0, ).
Then we can test H0 : = 0 vs. H1 : 6= 0 using the quadratic form
d
Zn n (n 0 )0 1 (n 0 ) 2k .
Test takes the form: 1(Zn > c).
(ii) One-sided test: H0 : 0 vs. H1 : > 0 .
Here the null hypothesis specifies a whole range of true (0 = (, 0 ]), whereas
the t-test statistic is evaluated at just one value of .
Just as for the two-sided test, the one-sided t-stat is evaluated at 0 , so that Zn =
n 0
.
1
n
Score test
~ =
Consider a model with log-likelihood function log L(|X)
1
n
1X
~
log L(|X)
log
f
(x
|)
=
.
i
=0
=0
n i
log f (xi |)=0 . Under the null hypothesis, S(0 ) converges to
Z
E0 Wi =
d
f (x|)|=0
d
f (x|0 )
f (x|0 )dx
=
f (x|)dx
1=0
=
1
V0
E0 Wi2
= E0
log f (X|)=0
2
V0 .
1
S(0 )
n
So a test of H0 : = 0 could be formulated as 1 | 1 | > c , where c is in the
n
V0
P log f (xi |)
1
i
a
n
n n 0 = n 1 P 2 log f (x |) =0
i
2
n
=0
(3)
S(0 )
= n
.
V0
a
(The notation = means that the LHS and RHS differ by some quantity which is
op (1).)
Hence, the above implies that (applying the information inequality, as we did before)
S( )
1
d
a
0
N (0, )
n n 0 = n
V0
|
{z
} | {zV0 }
(1)
(2)
The Wald statistic is based on (1), while the Score statistic is based on (2). In this
sense, these two tests are asymptotically equivalent. Note: the asymptotic variance
of the Wald statistic (2) equal the reciprocal of V0 .
(Later, you will also see that the Likelihood Ratio Test statistic is also asymptotically
equivalent to these two.)
The LR, Wald, and Score tests (the trinity of test statistics) require different models
to be estimated.
LR test requires both the restricted and unrestricted models to be estimated
Wald test requires only the unrestricted model to be estimated.
7
n.
Consider X1 , . . . , Xn i.i.d. (, 2 ). Test statistic X
Test H0 : = 2 vs. H1 : 6= 2.
Why are the following good or bad tests?
n 6= 2)
1. 1(X
n 1.2)
2. 1(X
n 6 [1.8, 2.2])
3. 1(X
n 6 [10, 30])
4. 1(X
Test 1 rejects too often (in fact, for every n, you reject with probability 1). Test 2
n is close to 2. Test 3 is not so bad, Test 4
is even worse, since it rejects even when X
accepts too often.
Basically, we are worried when a test is wrong. Since the test itself is a random
variable, we cannot guarantee that a test is never wrong, but we can characterize
how often it would be wrong.
There are two types of mistakes that we are worried about:
Type I error: rejecting H0 when it is true. (This is the problem with tests 1
and 2.)
Type II error: Accepting H0 when it is false. (This is the problem with test
4.)
Let Tn T (X1 , . . . , Xn ) denote the sample test statistic. Consider a test with rejection region R (i.e., test is 1(Tn R)). Then:
P (type I error) = P (Tn R | 0 )
P (type II error) = P (Tn 6 R | c0 )
Example: X1 , X2 i.i.d. Bernoulli, with probability p.
1
2
vs. H1 : p 6= 12 .
2
Consider the test 1 X1 +X
6= 1 .
2
Test H0 : p =
2
So P( X1 +X
= 1|p)=p2 . Graph.
2
Power function
More generally, type I and type II errors are summarized in the power function.
9
Definition: the power function of a hypothesis test with a rejection region R is the
function of defined by () = P (Tn R|).
Example: For above example,
2
(p) = P X1 +X
6= 1|p = 1 p2 . Graph
2
Power function gives the Type I error probabilities, for any singleton null hypothesis H0 : = 0 .
From (p), see that if you are worried about Type I error, then you should only
use this test when your null is that p is close to 1 (because only for p0 close to
1 is the power function low).
1 (p) gives you the Type II error probabilities, for any point alternative
hypothesis
So if you are worried about Type II error, then (p) tells you that you should
use this test when your alternative hypothesis postulates that p is low (close to
zero). We say that this test has good power against alternative values of p close
to zero.
Important: power function is specific to a given test 1(Tn R), regardless of
the specific hypotheses that the test may be used for.
Example: X1 , . . . , Xn U [0, ].
~ < c).
Test H0 : 2 vs. H1 : > 2. Derive () for the LR test 1((X)
10
In practice, researchers often concerned about Type I error (i.e., dont want to reject
H0 unless evidence overwhelming against it): conservative bias?
But if this is so, then you want a test with a power function () which is low for
0 , but high elsewhere:
Reflecting perhaps the conservative bias, researcher often use tests of size =0.05,
or 0.10.
n N (, 1/n), and Zn ()
Example:
X1 , . . . , Xn i.i.d. N (, 1). Then X
n(Xn ) N (0, 1).
Consider the test 1 (Zn (2) > c), for the hypotheses
H0 : 2 vs. H1 : > 2.
The power function
n 2) > c|)
() = P ( n(X
= 1 (c + n(2 ))
where () is the standard normal CDF. Note that () is increasing in .
class C if, for every other test in class C with power function ()
() (),
for every c0 .
Often, the classes you consider are test of a given size . Graphically, the power
function for a UMP test lies above the upper envelope of power functions for all other
tests in the class, for c0 :
(graph)
2.1
It can be difficult in general to see what form an UMP test for any given size is.
But in the simple case where both the null and alternative hypotheses are simple
hypotheses, we can appeal to the following result.
Theorem 8.3.12 (Neyman-Pearson Lemma): Consider testing
H0 : = 0 vs. H1 : = 1
13
(so both the null and alternative are singletons). The pdf or pmf corresponding to i
~ i ), for i = 0, 1. The test has a rejection region R which satisfies:
is f (X|
~ R
X
~ Rc
X
~ 1 ) > k f (X|
~ 0)
if f (X|
~ 1 ) < k f (X|
~ 0)
if f (X|
()
and
~ R|0 ).
= P (X
Then:
Any test satisfying (*) is a UMP test with level .
If there exists a test satisfying (*) with k > 0, then every UMP level test is
a size test and every UMP level test satisfies (*).
In other words, for simple hypotheses, a likelihood ratio test of the sort
!
~ 1)
f (X|
>k
1
~ 0)
f (X|
~
1)
is UMP-size (where k is chosen so that P ( ff ((X|
> k|0 ) = ).
~
X|
)
0
P
f ( i Xi |p= 43 )
P
.
f ( i Xi |p= 21 )
14
(i) ( 94 , +)
(ii) ( 34 , +)
(iii) ( 41 , +)
(iv) (, +).
Hence, the NP test would have one of these four rejection regions, depending on the
desired size:
a test with R=(i) is UMP-size 0 (implemented by setting k > 49 )
a test with R=(ii) is UMP-size 14 (implemented by setting 34 < k < 94 )
a test with R=(iii) is UMP-size 34 (implemented by setting 14 < k < 34 )
a test with R=(iv) is UMP-size 1 (implemented by setting k < 14 )
Example A: X1 , . . . , Xn N (, 1). Test H0 : = 0 vs. H1 : = 1 . (Assume
1 > 0 .)
By the NP-Lemma, the UMP test has rejection region characterized by
P
exp 21 i (Xi 1 )2
> k.
P
exp 12 i (Xi 0 )2
Taking logs of both sides:
(1 0 )
Xi > log k +
1X
Xi >
n i
1
n
n
(1 0 )2
2
log k + 12 (1 0 )2
d.
(1 0 )
15
2.1.1
Discussion of NP Lemma
(From Amemiya pp. 190-192) First, consider a Bayesian approach to this testing
problem. Assume that decisionmaker incurs loss 1 if he mistakenly chooses H1 when
H0 is true, and 2 if he mistakenly chooses H0 when H1 is true. Then, given data
observations ~x, he will
Reject H0 (=accept H1 ) 1 P (0 |~x) < 2 P (1 |~x) ()
where P (0 |~x) denotes the posterior probability of the null hypothesis given data ~x.
In other words, this Bayesians rejection region R0 is given by
1
P (1 |~x)
>
.
R0 = ~x :
P (0 |~x)
2
If we multiply and divide the ratio of posterior probabilities by f (~x), the (marginal)
joint density of ~x, and use the laws of probability, we get:
P (1 |~x)f (~x)
1
R0 = ~x :
>
P (0 |~x)f (~x)
2
L(~x|1 )P (1 )
1
= ~x :
>
L(~x|0 )P (0 )
2
1 P (0 )
L(~x|1 )
>
c .
= ~x :
L(~x|0 )
2 P (1 )
In the above, P (0 ) and P (1 ) denote the prior probabilities for, respectively, the null
and alternative hypotheses. This provides some intuition for the likelihood ratio
form of the NP rejection region.
Next we see how this Bayesian-motivated rejection region is UMP. In the case of two
simple hypotheses: the feature of UMP reduces to that of being admissible, in the
sense that among all tests with size , the UMP/admissible test(s) must have the
smallest type 2 error . For any testing scenario, the frontier (in (, ) space) of
potential admissible tests is convex. (Why?)
Hence we are going to show that the test derived above with rejection region R0
lies on the (, ) frontier. Reconsider the (Bayesian) optimal test problem: choose
rejection region R to minimize expected loss
~ R)P (X
~ R) + 2 P (1 |X
~ R)P
(X
~ R).
min (R) 1 P (0 |X
R
We will show that the region R0 defined above optimizes this problem. Consider any
1 ). Then we can rewrite
other region R1 . Recall that R0 = (R0 R1 ) (R0 R
1 )P (R0 R
1)
(R0 ) =1 P (0 |R0 R1 )P (R0 R1 ) + 1 P (0 |R0 R
0 R1 )P (R
0 R1 ) + 2 P (1 |R
0 R
1 )P (R
0 R
1 ).
+ 2 P (1 |R
16
0 )P (R1 R
0)
(R1 ) =1 P (0 |R1 R0 )P (R1 R0 ) + 1 P (0 |R1 R
1 R0 )P (R
1 R0 ) + 2 P (1 |R
1 R
0 )P (R
1 R
0 ).
+ 2 P (1 |R
First and fourth terms of equations above are identical. From the definition of R0
1 , we know
above, we know that (R0 )ii < (R1 )iii . That is, for all ~x R0 R0 R
from (*) that 1 P (0 |~x) < 2 P (1 |~x). Similarly, we know that (R0 )iii < (R1 )ii ,
implying that (R0 ) < (R1 ).
Moreover, using the laws of probability, we can re-express
1 ) 0 R + 1 R
(R) = 1 P (0 )P (R|0 ) + 2 P (1 )P (R|
with 0 = 1 P (0 ) and 1 = 2 P (1 ). Hence, graphically, in (, ) space, the optimal
test (with region R0 ) lies at tangency of (, ) frontier with a line with slope 0 /1 .
Hence, the optimal Bayesian test (R0 ) is admissible.
Now consider non-Bayesian statistician. He doesnt want to specify priors P (0 ),
P (1 ), so 0 , 1 are not fixed. But he is willing to specify a desired size . Hence the
optimal test is the one with a rejection region characterized by the slope of the line
tangent at in the (, ) space. From the above calculations, we know that this
slope is equivalent to c. That is, the NP test corresponds to an optimal Bayesian
test with 0 /1 = c.
2.2
The case covered by NP Lemma that both null and alternative hypotheses are simple
is somewhat artificial. For instance, we may be interested in the one-sided hypotheses H0 : 0 vs. H1 : 0 , where is scalar. It turns out UMP for one-sided
hypotheses
n
o exists under an additional assumption on the family of density functions
~
f (X|)
:
~
~
Definition: the family of densities f (X|)
has monotone likelihood ratio in T (X)
0
~ such that for any pair < the densities f (X|)
~
is there exists a function T (X)
0
0
~
~
~
and f (X| ) are distinct and the ratio f (X| )/f (X|) is a nondecreasing function of
~ That is, there exists a nondecreasing function g() and function T (X)
~ such
T (X).
~ 0 )/f (X|)
~
~
that f (X|
= g(T (X)).
~ = x and T (x) = x, then MLR in x means that f (x|0 )/f (x|) is
For instance: let X
nondecreasing in x. Roughly speaking: larger xs are more likely under larger s.
~
~ Then:
Theorem: Let be scalar, and let f (X|)
have MLR in T (X).
17
~ which is
(i) For testing H0 : 0 vs. H1 : 0 , there exists a UMP test (X),
given by
~ >C
1 when T (X)
~ =
~ =C
(X)
when T (X)
~ <C
0 when T (X)
~ = .
where (, C) are chosen to satisfy E0 (X)
~ is strictly increasing for all points for which
(ii) The power function () = E (X)
0 < () < 1.
(iii) For all 0 , the test described in part i is UMP for testing H00 : 0 vs.
H10 : 0 at level = (0 ).
(iv) For any < 0 , the test minimizes () (type-I error).
Proof: See Lehmann and Romano, Testing Statistical Hypotheses, pg. 65. Sketch:
~ 1 )/f (X|
~ 0 ).
Consider testing 0 vs. 1 > 0 . By NP Lemma, this depends on ratio f (X|
~ where g() is nondecreasing.
Given MLR condition, this ratio can be written g(T (X))
~ 1 )/f (X|
~ 0 ) is large, which is when T (X) is large;
Then UMP test rejects when f (X|
~
~ is also UMP-size for
this is test (X). Since this test does not depend on 1 , (X)
testing H0 : 0 vs. H1 : 1 > 0 (composite alternative).
00
00
~ is also UMP-size E0 (X)
~
Now since MLR holds for all (0 , ; > 0 ), the test (X)
00
00
0
0
~ cannot be UMP (why?).
for testing vs. . Hence ( ) ( ), otherwise (X)
00
~ ) and f (X|
~ 0 ) rules out (00 ) = (0 ).
Furthermore, the distinctiveness of f (X|
Hence we get (ii).
X
n
is also UMP for size = 0.05 for the one-sided hypotheses H0 : 0 vs. H1 : >
0 . Call this test 1.
18
Taking this example further, we have that for the one-sided hypotheses H0 : > 0
n < 0 1.64
will be UMP
vs. H1 : < 0 , the one-sided T-test which rejects when X
n
for size = 0.05. Call this test 2.
Now consider testing
H0 : = 0 vs. H1 : 6= 0 . ()
Note that the alternative hypothesis is equivalent to < 0 or > 0 . Can we
find an UMP size- test?
For any alternative point 1 > 0 , test 1 is UMP, implying that 1 (1 ) is maximal
among all size- tests. Furthermore, by second part of NP Lemma, if a UMP size-
test exists for problem (*), it must have the same rejection region as test 1.
For 2 < 0 , however, test 2 is UMP, implying that 2 (2 ) is maximal. Furthermore,
1 (2 ) < < 2 (2 ) from part (ii) of theorem above, which contradicts the statement
above that test 1 is UMP for this problem. Thus there is no UMP size- test for
problem (*).
But note that both Test 1 and Test 2 are biased for the hypotheses
(*). It turns
out
that the two-sided T-test which rejects when Xn > 0 +1.96/ n or Xn < 0 1.96/ n
is UMP among size- unbiased tests. See discussion in CB, pp. 392-395.
19
In practice, we use large-sample theory that is, LLNs and CLTs in order to
determine the approximate critical regions for the most common test statistics.
Why? Because finite-sample properties can be difficult to determine:
Example: X1 , . . . , Xn i.i.d. Bernoulli with prob. p.
Want to test H0 : p
1
2
n =
vs. H1 : p > 21 , using the test stat X
1
n
Xi .
n is the distribution of
n is finite. The exact finite-sample distribution for X
a B(n, p) random variable, which is:
0 with prob n0 (1 p)n
... ...
1 with prob pn
1
n
times
d
On the other hand, by the CLT, we know that n(Xn p) N (0, 1). Hence, consider
p(1p)
q1
1
1
the T-test statistic Zn n Xn 2 / 4 = 2 n X
n 2 .
Under any p
1
2
for n large enough. (In fact, this equation holds with equality for p = 12 , and holds
with strict inequality for p < 12 .)
Corresponding to this test, you can derive the asymptotic power function, which is
a (p) limn P (Zn > c), for c = 1 (1 ):
(Graph)
1
Indeed, the Clopper-Pearson (1934) confidence intervals for p are based on inverting this exact
finite-sample test.
20
Note that the asymptotic power function is equal to 1 at all values under the
alternative. This is the notion for consistency for a test: that it has asymptotic
power 1 under every alternative.
Note also that asymptotic power (rejection probability) is zero under every p of
the null, except p = 21 .
(skip) Accordingly, we see that asymptotic power, vs. fixed alternatives, is not
a sufficiently discerning criterion for distinguishing between tests.
We can deal
1
with this by considering local alternatives of the sort p = 2 + h/ n. Under
ad
n(Xn p)
ditional smoothness assumptions on the distributional convergence of
p(1p)
around p =
alternatives.
3.1
1
,
2
Note: 21 denotes a random variable from the Chi-squared distribution with 1 degree
of freedom. By Lemma 5.3.2 in CB, if Z N (0, 1), then Z 2 21 . Clearly, 2 random
variables only have positive support.
Proof: Assume null holds. Use Taylor-series expansion of log-likelihood function
around the MLE estimator n :
X
i
log f (xi |0 ) =
X
i
log f (Xi |n ) +
X
log f (Xi |)=n (0 n )
1 X 2
log f (Xi |)=n (0 n )2 + ...
(4)
2
2 i
X
1 X 2
(0 n )2 + ...
=
log f (Xi |n ) +
log
f
(X
|)
i
=n
2
2
i
i
+
where P
(i) the second term
disappeared because the MLE n sets the first-order con
dition i log f (Xi |) =n = 0; (ii) the remainder term is op (1). This is a secondorder Taylor expansion.
21
log
Now
f (xi |0 )
f (Xi |n )
!
=
h
i2
1 X 2
log
f
(X
|)
n(
)
+ op (1).
i
0
n
=n
n i 2
2
1
1 X 2
p
,
log
f
(X
|)
E
log f (Xi |0 ) =
i
0
n
=
2
2
n i
V0 (0 )
where V0 (0 ) denotes the asymptotic variance of the MLE estimator (and is equal to
the familiar information bound 1/I(0 )).
n(n 0 ) d
Finally, we note that
N (0, 1). Hence, by the definition of the 21 random
V0 (0 )
variable:
~ 2 .
2 log (X)
1
In the multivariate case ( being k-dimensional), the above says that
a
~ = n(0 n )I(0 )1 (0 n ) 2 .
2 log((X))
k
Hence, LR-statistic is asymptotically equivalent to Wald and Score tests.
Example: X1 , . . . , XN i.i.d. Bernoulli with prob. p. Test H0 : p =
H1 : p 6= 21 . Let Yn denote the number of 1s.
~ =
(X)
n
yn
n
yn
1
2
vs.
1 yn 1 nyn
2
2
.
yn yn nyn nyn
n
n
22