• Nie Znaleziono Wyników

1. LR test for composite hypotheses 2. Examples of LR tests:

N/A
N/A
Protected

Academic year: 2021

Share "1. LR test for composite hypotheses 2. Examples of LR tests:"

Copied!
30
0
0

Pełen tekst

(1)

Mathematical Statistics

Anna Janicka

Lecture XI, 6.05.2019

HYPOTHESIS TESTING III:

LR TEST FOR COMPOSITE HYPOTHESES EXAMPLES OF ONE-SAMPLE TESTS

(2)

Plan for today

1. LR test for composite hypotheses 2. Examples of LR tests:

Model I: One- and two-sided tests for the mean in the normal model, σ2 known

Model II: One- and two-sided tests for the mean in the normal model, σ2 unknown

+ One- and two-sided tests for the variance Model III: Tests for the mean, large samples

Model IV: Tests for the fraction, large samples

3. Asymptotic properties of the LR test

4. Test randomization

(3)

Testing simple hypotheses – reminder

We observe X. We want to test H 0 : θ = θ 0 against H

1

: θ = θ 1 . (two simple hypotheses)

We can write it as:

H 0 : X ~ f 0 against H

1

: X ~ f 1 ,

where f 0 and f 1 are densities of distributions

defined by θ and θ (i.e. P and P )

(4)

Likelihood ratio test for simple hypotheses.

Neyman-Pearson Lemma – reminder

H 0 : X ~ f 0 against H

1

: X ~ f 1 Let

such that

Then, for any K ⊆ X :

if P 0 (K) ≤ α , then P 1 (K) ≤ 1– β .

(i.e.: the test with critical region K* is the most powerful test for testing H

0

against H

1

)

β

α =

=

 

 

 ∈ >

=

1

*) (

and

*) (

) (

) : (

*

1 0

0 1

K P

K P

x c f

x x f

K X

(5)

Likelihood ratio test for composite hypotheses

X ~ P θ , {P θ : θ ∈ Θ} – family of distributions We are testing H 0 : θ ∈ Θ 0 against H

1

: θ ∈ Θ 1

such that Θ 0 ∩ Θ 1 = ∅, Θ 0 ∪ Θ 1 = Θ Let

H 0 : X ~ f 0 ( θ 0 ,⋅) for some θ 0 ∈ Θ 0.

H

1

: X ~ f 1 ( θ 1 , ⋅) for some θ 1 ∈ Θ 1 ,

where f 0 and f 1 are densities (for θ ∈ Θ 0 and θ

∈ Θ 1 , respectively)

Just like in the N-P Lemma, but models are statistic –

(6)

Neyman-Pearson Lemma – Example 1 – reminder

Normal model: X

1

, X

2

, ..., X

n

are an IID sample from N( µ , σ 2 ), σ 2 is known

The most powerful test for

H 0 : µ = 0 against H

1

: µ = 1.

At significance level α :

For obs. 1.37; 0.21; 0.33; -0.45; 1.33; 0.85; 1.78; 1.21; 0.72 from N(µ, 1) we have, for α = 0.05 :

→ we reject H0

µ

0

< µ

1

 

 

 >

=

n X u

x x

x

K

n 1 α

σ

2

1

, ,..., ) : (

*

54 . 9 0

1 645 .

82 1 .

0 > ⋅ ≈

X

Model I

(7)

Neyman-Pearson Lemma – Example 1 cont. – reminder

Power of the test

If we change α , µ 1 , n – the power of the test....

 

 

 − ⋅

Φ

=

 =

 

 > =

=

µ σ σ µ

n X n

P K

P

1 1

645 .

1 1

....

645 1 .

*) 1 (

≈ 0.91

(8)

Neyman-Pearson Lemma:

Generalization of example 1

The same test is UMP for H

1

: µ > 0 and for H 0 : µ ≤ 0 against H

1

: µ > 0

more generally: under additional assumptions about the family of distributions, the same test is UMP for testing

H

0

: µ ≤ µ

0

against H

1

: µ > µ

0

Note the change of direction in the inequality when testing

H

0

: µ ≥ µ

0

against H

1

: µ < µ

0

(9)

Neyman-Pearson Lemma – Example 2

Exponential model: X

1

, X

2

, ..., X

n

are an IID sample from distr exp( λ ), n = 10.

MP test for

H 0 : λ = ½ against H

1

: λ = ¼.

At significance level α = 0.05:

E.g. for a sample: 2; 0.9; 1.7; 3.5; 1.9; 2.1; 3.7; 2.5; 3.4; 2.8:

Σ = 24.5 → no grounds for rejecting H

0

.

{ ( , ,..., ) : 31 . 41 }

* = x

1

x

2

x

10

x

i

>

K

) ( )

, ( )

, (

) , ( )

, ( )

, 1 ( )

(

exp λ = Γ λ Γ

a

λ + Γ

b

λ = Γ

a

+

b

λ Γ

n 1

= χ

2 n

(10)

Neyman-Pearson Lemma – Example 2’

Exponential model: X

1

, X

2

, ..., X

n

are an IID sample from distr exp( λ ), n = 10.

MP test for

H 0 : λ = ½ against H

1

: λ = ¾.

At significance level α = 0.05:

E.g. for a sample: 2; 0.9; 1.7; 3.5; 1.9; 2.1; 3.7; 2.5; 3.4; 2.8:

Σ = 24.5 → no grounds for rejecting H

0

.

) ( )

, ( )

, (

) , ( )

, ( )

, 1 ( )

(

exp λ = Γ λ Γ

a

λ + Γ

b

λ = Γ

a

+

b

λ Γ

n2 12

= χ

2 n

{ ( , ,..., ) : 10 . 85 }

* = x

1

x

2

x

10

x

i

<

K

(11)

Example 2 cont.

The test

is UMP for H 0 : λ ≥ ½ against H

1

: λ < ½ The test

is UMP for H 0 : λ ≤ ½ against H

1

: λ > ½

{ ( , ,..., ) : 31 . 41 }

* = x

1

x

2

x

10

x

i

>

K

{ ( , ,..., ) : 10 . 85 }

* = x

1

x

2

x

10

x

i

<

K

(12)

Likelihood ratio test for composite hypotheses – cont.

Test statistic:

or

where are MLE of the null and alternative hypothesis models

We reject H 0 if λ > c for a constant c

(determined according to significance level)

) ,

( sup

) ,

( sup

0 0

1 1

0 0

1 1

X f

X f

θ λ θ

θ θ

Θ

∈ Θ

=

) ˆ ,

(

) ˆ ,

(

0 0

1 1

X f

X f

θ λ = θ

1 0

, ˆ

ˆ θ

θ

(13)

Likelihood ratio test for composite hypotheses – justification

Just like in the Neyman-Pearson Lemma, we compare the “highest chance of obtaining

observation X, when the alternative is true” to the “highest chance of obtaining observation X, when the null is true”; we reject the null

hypothesis in favor of the alternative if this

ratio is very unfavorable for the null.

(14)

Likelihood ratio test for composite hypotheses – alternative version

Test statistic:

or

where are the ML estimators for the model without restrictions and for the null model.

We reject H 0 if for a constant .

) ,

( sup

) ,

(

~ sup

0

0 0

0

f X

X f

θ λ θ

θ θ

Θ

∈ Θ

=

) ˆ ,

(

) ˆ ,

~ (

0

0

X

f

X f

θ λ = θ

ˆ

0

ˆ , θ θ

~ > c~

λ c~

more convenient if the null is simple or if models are nested

(15)

Likelihood ratio test for composite hypotheses – properties

For some models with composite hypotheses the

UMPT does not exist (so the LR test will not be UMP because there is no such test)

e.g. testing H

0

: θ = θ

0

against H

1

: θ ≠ θ

0

if the family of

distributions has a monotonic LR property, i.e. f

1

(x)/f

0

(x) is an increasing function of a statistic T(x) for any f

0

and f

1

corresponding to parameters θ

0

< θ

1

.

In order to have UMPT for H

0

: θ = θ

0

against H

1

: θ < θ

0

we would need a critical region of the type T(x)>c, and to have a UMPT for H

0

: θ = θ

0

against H

1

: θ > θ

0

we would need a

critical region of the type T(x)<c, so it is impossible to find a

UMPT for H

1

: θ ≠ θ

0.

.

(16)

Likelihood ratio test:

special cases

The exact form of the test depends on the distribution.

In many cases, finding the distribution is

hard/complicated (in many such cases, we

use the asymptotic properties of the LR test

instead of precise formulae)

(17)

Notation

x

something

always means a quantile of rank

something

(18)

Model I: comparing the mean

Normal model: X

1

, X

2

, ..., X

n

are an IID sample from N( µ , σ

2

), where σ

2

is known

H

0

: µ = µ

0

Test statistic:

H

0

: µ = µ

0

against H

1

: µ > µ

0

critical region

H

0

: µ = µ

0

against H

1

: µ < µ

0

critical region

H

0

: µ = µ

0

against H

1

: µ ≠ µ

0

critical region

Example 1

) 1 , 0 (

0

~

N X n

U σ

µ

= −

} )

( :

{

* = x U x > u

1α

K

} )

( :

{

* = x U x < u

α

= − u

1α

K

}

| ) ( :|

{

* = x U x > u

1α /2

K

(19)

Model I: example

Let X

1

, X

2

, ..., X

10

be an IID sample from N( µ , 1

2

):

-1.21 -1.37 0.51 0.37 -0.75 0.44 1.20 -0.96 -1.14 -1.40

Is µ = 0? (for α = 0.05)

In the sample: mean = -0.43, variance = 0.92 Test statistic:

H

0

: µ = 0 against H

1

: µ ≠ 0, u

0.975

≈1.96 (p-value ≈ 0.172)

H

0

: µ = 0 against H

1

: µ < 0, u

0.05

≈ -1.64 (p-value ≈ 0.086)

H

0

: µ = 0 against H

1

: µ > 0, u

0.95

≈1.64 (p-value ≈ 0.914)

→ in none of these cases are there grounds to reject H

0

for α = 0.05

but we would reject H : µ = 0 in favor of H : µ < 0 for α = 0.1

36 . 1 1 10

0 43

.

0 − ≈ −

= −

U

(20)

Model II: comparing the mean

Normal model: X

1

, X

2

, ..., X

n

are an IID sample from N( µ , σ

2

), where σ

2

is unknown

H

0

: µ = µ

0

Test statistic:

H

0

: µ = µ

0

against H

1

: µ > µ

0

critical region

H

0

: µ = µ

0

against H

1

: µ < µ

0

critical region

H

0

: µ = µ

0

against H

1

: µ ≠ µ

0

critical region

) 1 (

0

~ −

= − n t n

S T X µ

)}

1 (

) ( :

{

* = x T x > t

1

n

K

α

)}

1 (

) ( :

{

* = x T x < t n

K

α

)}

1 (

| ) ( :|

{

* = x T x > t

1 / 2

n

K

α

) 1 (

) 1

(n − = −t1 n

tα α

(21)

Model II: example (mean)

Let X

1

, X

2

, ..., X

10

be an IID sample from N( µ , σ

2

):

-1.21 -1.37 0.51 0.37 -0.75 0.44 1.20 -0.96 -1.14 -1.40

Is µ = 0? (for α = 0.05)

In the sample: mean = -0.43, variance = 0.92 Test statistic:

H

0

: µ = 0 vs H

1

: µ ≠ 0, t

0.975

(9) ≈ 2.26 (p-value ≈ 0.188)

H

0

: µ = 0 vs H

1

: µ < 0, t

0.05

(9) ≈ -1.83 (p-value ≈ 0.094)

H

0

: µ = 0 vs H

1

: µ > 0, t

0.95

(9) ≈1.83 (p-value ≈ 0.906)

→ in none of these cases are there grounds to reject H

0

for α = 0.05

but we would reject H : µ = 0 in favor of H : µ < 0 for α = 0.1

42 . 1 10

92 . 0

0 43

.

0 − ≈ −

= −

U

(22)

Model II: comparing the variance

Normal model: X

1

, X

2

, ..., X

n

are an IID sample from N( µ , σ

2

), where σ

2

is unknown

H

0

: σ = σ

0

Test statistic:

H

0

: σ = σ

0

against H

1

: σ > σ

0

critical region

H

0

: σ = σ

0

against H

1

: σ < σ

0

critical region

H

0

: σ = σ

0

against H

1

: σ ≠ σ

0

critical region

) 1 (

) ~ 1

(

2

2 0

2

2

− −

= n S n

σ χ χ

)}

1 (

) ( :

{

* = x

2

x >

12

n

K χ χ

α

)}

1 (

) ( :

{

* = x

2

x <

2

n

K χ χ

α

)}

1 (

) (

) 1 (

) ( :

{

*

2

2 / 1 2

2 2 / 2

>

<

=

n

x

n x

x K

α α

χ χ

χ

χ

(23)

Model II: example (variance)

Let X

1

, X

2

, ..., X

10

be an IID sample from N( µ , σ

2

):

-1.21 -1.37 0.51 0.37 -0.75 0.44 1.20 -0.96 -1.14 -1.40

Is σ =1? (for α = 0.05)

In the sample: variance = 0.92 Test statistic:

H

0

: σ = 1 against H

1

: σ > 1

H

0

: σ = 1 against H

1

: σ < 1 H

0

: σ = 1 against H

1

: σ ≠ 1

→ in none of these cases are there grounds to reject H (for α = 0.05)

28 . 1 8

92 . 0

2

9 ⋅ ≈

χ =

92 .

2

16

95 .

0

χ

33 .

2

3

05 .

0

χ

02 . 19

; 70 .

2

02.975

2 025 .

0

≈ χ ≈

χ

(24)

Model III: comparing the mean

Asymptotic model: X

1

, X

2

, ..., X

n

are an IID sample from a distribution with mean µ and variance

(unknown), n – large.

H

0

: µ = µ

0

Test statistic:

has, for large n, an approximate distribution N(0,1) H

0

: µ = µ

0

against H

1

: µ > µ

0

critical region

H

0

: µ = µ

0

against H

1

: µ < µ

0

critical region

H

0

: µ = µ

0

against H

1

: µ ≠ µ

0

critical region

S n T X − µ

0

=

} )

( :

{

* = x T x > u

1α

K

} )

( :

{

* = x T x < u

α

= − u

1α

K

}

| ) ( :|

{

* = x T x > u

1α /2

K

(25)

Model IV: comparing the fraction

Asymptotic model: X

1

, X

2

, ..., X

n

are an IID sample from a two-point distribution, n – large.

H

0

: p = p

0

Test statistic:

has an approximate distribution N(0,1) for large n H

0

: p = p

0

against H

1

: p > p

0

critical region

H

0

: p = p

0

against H

1

: p < p

0

critical region

H

0

: p = p

0

against H

1

: p p

0

critical region

) 0 (

1 )

1

( X = = p = − P X =

P

p p

p n p

p n p

p p

p U X

) 1

( ˆ )

1

* (

0 0

0 0

0

0

= −

= −

} )

( :

{

* = x U x > u

1α

K

} )

( :

{

* = x U x < u

α

= − u

1α

K

}

| ) ( :|

{

* = x U x > u

α

K

(26)

Model IV: example

We toss a coin 400 times. We get 180 heads. Is the coin symmetric?

H

0

: p = ½

for α = 0.05 and H

1

: p ≠ ½ we have u

0.975

=1.96 → we reject H

0

for α = 0.05 and H

1

: p < ½ we have u

0.05

= -u

0.95

=-1.64

→ we reject H

0

for α = 0.01 and H

1

: p ≠ ½ we have u

0.995

=2.58

→ we do not reject H

0

for α = 0.01 and H

1

: p < ½ we have u

0.01

= -u

0.99

=-2.33

→ we do not reject H

0

p-value for H

1

: p ½: 0.044 p-value for H

1

: p < ½: 0.022

2 ) 400

2 / 1 1

( 2 / 1

) 2 / 1 400

/ 180

* ( = −

= −

U

(27)

Asymptotic properties of the LR test

We consider two nested models, we test H

0

: h( θ ) = 0 against H

1

: h( θ ) ≠ 0

Under the assumption that h is a nice function

Θ is a d-dimensional set

Θ

0

= { θ : h( θ ) = 0} is a d – p dimensional set

Theorem: If H

0

is true, then for n→∞ the distribution of the statistic converges to a chi-squared

distribution with p degrees of freedom

λ ~

ln

2

(28)

Asymptotic properties of the LR test – example Exponential model: X

1

, X

2

, ..., X

n

are an IID sample from Exp( θ ).

We test H

0

: θ = 1 against H

1

: θ ≠ 1

then:

from Theorem:

for a sign. level α =0.05 we have so we reject H

0

in favor of H

1

if

X MLE ( θ ) = θ ˆ = 1 /

( ( 1 ) )

1 exp )

exp(

) exp(

) (

)

~ (

1 1

1

ˆ

= −

Σ

Σ

= − Π

= Π n X

X x

x x

f

x f

n i

X i X

i

i n

λ

θ

) 1 ( )

ln )

1 ((

~ 2 ln

2 λ = n X − − X  →

D

χ

2

c

c ~ 2 ln ~ ln

~ 2

~ > ⇔ λ >

λ

c~

ln 2 84

. 3 )

1

2

(

95 .

0

≈ ≈

χ

2 / 84 .

~

3

> e

λ

(29)

Test randomization

Sometimes, a test with a significance level exactly equal to α does not exist (e.g. for discrete random variables).

In such cases, we need randomization.

(The UMPT, if it exists, needs to be randomized).

eg. no of heads in 8 tosses, H

0

: p = ½, H

1

: p <½, α=0.05:

X≤1 reject, X>2 OK, X=2: p=1/11 reject

xi 0 1 2 3 4 5 6 7 8

pi 0.004 0.03 0.11 0.22 0.27 0.22 0.11 0.03 0.004 cum pi 0.004 0.04 0.15 0.36 0.64 0.86 0.97 0.996 1.000

(30)

Cytaty

Powiązane dokumenty

in this case, the type I error is higher than the significance level assumed for each simple test..... ANOVA test

The basic rule of comparing tests is the following: for a given set of null and alternative hypotheses, for a given significance level, the test which is more powerful is

We also consider spaces with plurisubharmonic norms and introduce the class of analytic Sidon sets.. Of course the sequence (ε n ) is a model for the Rademacher functions on

On the other hand, it is clear that the category Mod(T ) may be identified with the full subcate- gory of Mod(R) consisting of all right R-modules M such that M = M T , and this

Does the paper include new scientific content or value of utility (specify to what extent).. yes no

Keeping the type of option constant, in-the-money options experience the largest absolute change in value and out-of-the-money options the smallest absolute change in

We need to find

It is shown that in the fixed horizon case the game has a solution in pure strategies whereas in the random horizon case with a geometric number of observations one player has a