Professional Documents
Culture Documents
Week 7
Week 2
Week 3
Week 4
Probability:
Week 6
Review
Estimation: Week 5
Week
8
Week
9
Hypothesis testing:
Week
10
Week
11
Week 12
Linear regression:
Week 2 VL
Week 3 VL
Week 4 VL
Video lectures: Week 1 VL
Week 1
Week 5 VL
2101/2155
- Statistical tests;
- Rejection region;
Neyman-Pearson Lemma;
Uniformly most powerful;
Likelihood ratio test.
- Value of test;
- Accept the null or reject the null hypothesis.
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
Introduction
Formal means of distinguishing between probability
distributions using sample data.
Examples:
- Are the means of two normal distributions with the same
variance equal?
- Are the variances different?
- Is the parameter of the distribution equal to a constant?
2104/2155
Hypothesis testing
In hypothesis testing the choice is either reject or accept the
hypothesis. Assume that X1 , X2 , . . . , Xn are from a random
sample with density f (x; ).
A statistical hypothesis is defined to be a conjecture or an
assertion about the distribution of a random variable(s). If the
statistical hypothesis completely specifies the distribution, it is
called simple. Otherwise, it is called composite.
A statistical test of a statistical hypothesis, also called test
statistic, T is a rule or procedure for deciding whether to
reject T .
2105/2155
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
Hypothesis testing
Null Hypothesis H0 : the hypothesis being tested.
Alternative Hypothesis Ha : the hypothesis accepted if H0 is
rejected.
Results of Decision Making
Hypothesis
Decision
True
False
Reject H0
Type I Error=
No Error
Do not reject H0
No Error
Type II Error=
2107/2155
Ha :
2108/2155
If you do not reject the null and later found there is positive
correlation, this is called a Type II error and the cost would be
potential default due to too few reserves.
2109/2155
2110/2155
- H0 : 0 vs H1 : > 0 ;
- H0 : 0 vs H1 : < 0 .
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
v.s.
Ha : p 6= p0 ,
2113/2155
b
b
p E [b
p]
pp
p
=r
,
Var (b
p)
p (1 p)
n
has an approximate standard normal distribution.
f(x|H0)
np 0 z1/2
When
2114/2155
p
np 0 (1 p 0 )
np0
np 0 + z1/2
p
np 0 (1 p 0 )
b
p p0
p0 (1 p0 )
n
where T is standard normal distributed.
or
T > z1/2
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
2116/2155
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
2118/2155
f(x|H1)
How to
select blue
shaded area
(rejection
region) such
that purple
area (i.e.,
rejecting H0
given H1 is
true) is the
largest?
Note: blue
shaded area
is Type I
error = .
i) Pr ((X1 , X2 , . . . , Xn ) C ? |H0 ) = ;
ii) Pr ((X1 , X2 , . . . , Xn ) C ? |H1 ) >
Pr ((X1 , X2 , . . . , Xn ) A |H1 ).
2119/2155
Optimal tests: tests with higher power than any other test,
given a significance level .
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
Neyman-Pearson Lemma
Suppose X1 , X2 , . . . , Xn is a random sample from a distribution
whose density function is f (x; ). Let the joint density of
X1 , X2 , . . . , Xn be:
L (x1 , x2 , . . . , xn ; ) = f (x1 ; )f (x2 ; ). . .f (xn ; ) = Pr(X = x; ).
A subset C ? = {x; 0 , 1 } of the sample space is the best critical
region for testing the simple null/simple alternative test stated
above, if the following conditions are satisfied (see slide 2119):
i) Pr ((X1 , X2 , . . . , Xn ) C ? |H0 ) = ;
L (x1 , . . . , xn ; 0 )
6 k,
ii) (x; 0 , 1 ) =
L (x1 , . . . , xn ; 1 )
for every (x1 , . . . , xn ) C ? , where k 1 is a constant such
that: Pr ((X1 , . . . , Xn ) C ? |0 ) = .
Hence: when rejecting the null, when it is incorrect (i.e.,
(x1 , . . . , xn ) C ? ) the likelihood of the data coming from the
2120/2155
alternative is larger than from the null distribution.
L(x; 0 ) k L(x; 1 )
?
Pr (X A|0 ) k Pr (X A|1 )
- in case A C :
?
1 Pr(X C |0 ) k (1 Pr(X C |1 ))
2121/2155
and
C = (C C ? ) (C C ).
C () =Pr(X C ? C |) + Pr(X C C |)
?
(1)
C ? (1 ) C (1 ) =Pr(X C ? C |) Pr(X C C |)
?
(1/k) Pr(X C ? C |0 ) Pr(X C C |0 )
= (1/k) (C ? (0 ) C (0 )) = ( )/k = 0
2122/2155
C ? (1 ) C (1 ).
then any other test with significance level will have power
less than or equal to that of the likelihood ratio test.
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
2124/2155
H0 : = 0
H1 : = 1
v.s.
2125/2155
Qn
1
i=1 2
exp
1
2 2
(xi 0 )2
f0 (x) L(x; 0 )
=
=Q
n
f1 (x) L(x; 1 )
1 exp 12 (xi 1 )2
i=1 2
2
P
n
2
1
exp 2
2
i=1 (xi 0 )
P
< k.
=
n
2
1
exp 2
(x
)
1
i
2
i=1
i=1
n
X
i=1
(xi 1 )2
n
X
i=1
(xi 0 )2 < k1
= log(k) 2 2
xi2 2xi 1 + 21 xi2 2xi 0 + 20 < k1
2n x (0 1 ) + n 21 20 < k1
n
X
xi (0 1 ) < k2
= (k1 n 21 20 )/2
i=1
is small, * using
2126/2155
n
P
xi = n x.
i=1
Therefore, we have:
(a) if 0 > 1 (0 1 ) > 0 the likelihood ratio is small if x is
small;
(b) if 0 < 1 (0 1 ) < 0 the likelihood ratio is small if x is
large.
Pr X < x0 |H0 =
Pr (Z < z1 ) =
2127/2155
X 0
x
< 0 0 =
/ n
/ n
x0 0
z1 =
x0 = 0 z1 / n.
/ n
Pr
Best critical
region:
n
?
C = (x1 , . . . , xn ) : x 0 z1
n
C ? = (x1 , . . . , xn ) : x 0 + z1
o
o
n
X
i=1
xi (1 0 ) log((1 /0 ) k)
Thus
2128/2155
C?
= {(x1 , . . . , xn ) :
n
P
xi k1 }.
i=1
Pn
i=1
n
X
i=1
xi k1 ,
Xi k1 |0 .
2. Using
we have:
Pn m.g.f. technique (see week 4) P
n
2
i=1 Xi |H0 Gamma(n, 0 ) 20
i=1 Xi |H0 (2n),
!
n
n
X
X
Pr
Xi k1 |H0 =
Pr (2 0
Xi 2 0 k1 |H0 ) =
| {z }
i=1
i=1
21 (2n)
|
{z
}
2 (2n)
2 (2n)
21 (2n) = 2 0 k1
k1 = 1
.
2 0
n
P
?
2
Thus: C = (x1 , . . . , xn ) :
xi 1 (2n)/(2 0 ) .
i=1
2129/2155
where k is a constant
P such that Pr((x; 0 , 1 ) k|H0 ) = .
So we reject H0 if ni=1 xi k1 = log(k).
P
2. How to determine the distribution of ni=1 Xi |H0 , use CLT:
Pn
Pn
P
X n E[Xi ]
Xi E[ ni=1 Xi ]
i=1
p
p i
= i=1
Zn =
Pn
Var ( i=1 Xi )
n Var (Xi )
Pn
X n/2 d
p i
= i=1
Z N(0, 1)
n/12
!
n
X
p
n
Pr (Zn < z1 ) =
Pr
Xi z1 n/12 =
2
i=1
n
P
z1 n
n
?
Thus C = (x1 , . . . , xn ) :
xi 2 12
.
2130/2155
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
v.s.
H1 : 0 .
2132/2155
Example: Consider
Pnthe example from slide 2128.
We have (X ) = i=1 Xi and
!
P
n
n
X
0n exp ( ni=1 xi 0 )
0
P
(x; 0 , 1 ) = n
=
exp
xi (0 0 )
1 exp ( ni=1 xi 1 )
1
i=1
2133/2155
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
v.s.
H1 : > 0 ,
2134/2155
X N(, 2 /n).
2135/2155
exp
1
2 2
1
2 2
2
(x
)
0
i=1 i
< k,
Pn
2
(x
)
1
i
i=1
Pn
2. Next, determine a value x0 such that Pr X > k ? |H0 = .
2
We know that X |H0 N 0 , n calculate the value of
k ? = 0 + z1 / n.
2136/2155
Best critical
region:
n
?
C = (x1 , . . . , xn ) : x 0 + z1
o
.
Exercise UMP
Number of claim distribution. Consider a sample of size n
from a Poisson distribution. Xi Poi(), with joint p.d.f.:
Pn
exp(n) i=1 xi
fX (x; ) =
x1 ! . . . xn !
=(x1 ! . . . xn !)
exp log()
n
X
i=1
xi n
!
n
X
f (x; 1 )
= exp (log(1 ) log(0 ))
xi n (1 0 )
f (x; 0 )
i=1
2137/2155
P
P
(continued) () = ni=1 xi , reject H0 if T = ni=1 Xi k,
where Pr(T k|0 ) = .
P
2. We have T = ni=1 Xi POI(n0 ), thus
X
x
exp (n0 ) (n0 )
k2 = argmax
x!
k1
x=k1
P
Rejection region: C ? = {(x1 , . . . , xn ) | ni=1 xi k2 }.
Dental insurance: Consider a sample of size n from a twoparameter exponential distr, Xi EXP(1, ). The j.p.d.f. is:
P
exp ( ni=1 (xi )) , if < x(1) ;
fX (x, ) =
0,
if x(1) .
2138/2155
Distribution of minimum:
Pr(X(1) k) = Pr(X1 k, . . . , Xn k) = Pr(Xi k)n .
1. Solution: we have:
f (x, 1 )
0,
if 0 < x(1) 1 ;
=
exp (n (1 0 )), if 1 < x(1) .
f (x, 0 )
Note that f (x, 1 )/f (x, 0 ) is not defined for x(1) 0 , but
this is no problem because Pr(X(1) 0 |0 ) = 0.
T = () = X(1) , f (x, 1 )/f (x, 0 ) is nondecreasing function
in x(1) , hence we can use MLR.
k =0 log()/n.
2139/2155
Rejection region: C ? = (x1 , . . . , xn ) : x(1) 0 log()/n .
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
Note: LRT tests do not always lead to the best critical region.
2141/2155
0 z1/2 n
How to
select blue
f(x|H1)
shaded area
(rejection
region) such
that purple
area (i.e.,
rejecting H0
given H1 is
true) is the
largest?
Note: blue
shaded area
is Type I
0 + z1/2 n error = .
v.s.
H 1 : 1 ,
for a given ,
where = 0 1 .
Define the likelihood functions:
L0 () = L (x1 , x2 , . . . , xn ; ) ,
L () = L (x1 , x2 , . . . , xn ; ) ,
2142/2155
with 0 ,
with .
max {L ()}
L(x; b0 )
,
b
L(x; )
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
2 log((X )) 21 (r )
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
v.s.
H1 : 6= 0 ,
2146/2155
0 ={ = 0 }
and
={(, )}.
1 = { {(, 0 ) (0 , )}
2147/2155
n
exp
n
1 X
(xi x)2
2 2
i=1
(x) = exp
n
1 X
2
2
x)
(x
(x
0
i
i
2 2
i=1
<k
n
X
i=1
decreasing
xi2 + n20 20
n
X
i=1
= n (x 0 )2 > k1
xi
n
X
i=1
(x 0 )2 > k2
x 0 > |k3 |
2148/2155
xi2 + nx 2 2x
n
X
i=1
xi
(= k1 /n)
p
= k2
Pr 0 k ? X 0 + k ? H0 = .
Pr z1/2 Z z1/2 =
k ? = z1/2 / n.
C =
2149/2155
(x1 , . . . , xn ) : x
, 0 z1/2
n
0 + z1/2 ,
.
n
v.s.
H1 : > 0 ,
b=
0 , if x 0 , i.e., bounding condition,
2150/2155
where
b is the 0 which maximizes L0 ().
Exercise LRT
Testing equality in proportions of insured issuing claims.
Let X Bin(n1 , p1 ) and Y Bin(n2 , p2 ) with X and Y
independent.
Exercise: Test whether the proportions are equal, i.e.,
H0 : p1 = p2 = p v.s. H1 : p1 6= p2 , where p is unknown.
b1 = x/n1 and
Solution: Based on x and y the MLEs are p
b
p2 = y /n2 and the restricted MLE is b
p = (x + y )/(n1 + n2 ).
The GLR statistic is:
2151/2155
n1
b)n1 x
p x (1 p
x b
n1
b1 )n1 x
p1x (1 p
x b
b)n1 +n2 xy
p
f (x; b
p ) f (y ; b
p)
=
(x, y ) =
f (x; b
p1 ) f (y ; b
p2 )
b
p x+y (1
b1x (1 b
p
p1 )n1 x b
p2y (1 b
p2 )n2 y
n2
y
n2
y
b
p y (1 b
p )n2 y
b
p2y (1 b
p2 )n2 y
Exercise LRT
GLR test statistic under H0 depends on unknown parameter p.
Note rewrite H0 : = p2 p1 = 0 so H0 represents a
one-dimensional restriction in the parameters, i.e., r = 1 free
parameter.
An approximately size test is:
2 log((x, y )) 2 (1)
Hence, H0 is rejected if 2 log((x, y )) > 21
(1), i.e.,
C ? = (x1 , . . . , xn ) : 2 log((x, y )) > 21 (1)
2152/2155
Hypothesis testing
Introduction in Hypothesis testing
Introduction
Selection of null hypothesis
The first step
Example: testing proportions
Statistical test
Statistical test
Rejection region
Best critical region
Neyman-Pearson Lemma
Neyman-Pearson Lemma: examples and exercises
Uniformly most powerful (UMP)
Example: Uniformly most powerful (UMP)
Generalized likelihood ratio test
Asymptotic distribution for the GLR test
Example: generalized likelihood ratio test
Summary
Summary
Hypothesis tests
Testing procedure: When testing a hypothesis use the following
steps:
i. Define a statistical hypothesis.
Note that this includes a confidence level ();
ii. Define the test statistic T (using past weeks knowledge);
iii. Determine the rejection region C ? ;
iv. Calculate the value of the statistical test, given observed data
(x1 , . . . , xn );
v. Accept or reject H0 .
Note: we assume that H0 is true when testing! (see Type I
and Type II errors)
2153/2155
L(x; b0 )
<k
b
L(x; )
s.t.: Pr (X C ? |H0 ) = .
2155/2155