• Nie Znaleziono Wyników

2. Asymptotic properties of the LR test

N/A
N/A
Protected

Academic year: 2021

Share "2. Asymptotic properties of the LR test"

Copied!
29
0
0

Pełen tekst

(1)

Mathematical Statistics

Anna Janicka

Lecture XII, 13.05.2019

HYPOTHESIS TESTING IV:

PARAMETRIC TESTS: COMPARING TWO OR MORE POPULATIONS

(2)

Plan for today

1. Parametric LR tests for one population – cont.

2. Asymptotic properties of the LR test

3. Parametric LR tests for two populations 4. Comparing more than two populations

ANOVA

(3)

Notation

x

something

always means a quantile of rank

something

(4)

Model III: comparing the mean

Asymptotic model: X1, X2, ..., Xn are an IID sample from a distribution with mean

µ

and variance

(unknown), n – large.

H0:

µ

=

µ

0

Test statistic:

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

µ

=

µ

0 against H1:

µ

>

µ

0

critical region

H0:

µ

=

µ

0 against H1:

µ

<

µ

0

critical region

H0:

µ

=

µ

0 against H1:

µ ≠ µ

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

(5)

Model IV: comparing the fraction

Asymptotic model: X1, X2, ..., Xn are an IID sample from a two-point distribution, n – large.

H0: p = p0

Test statistic:

has an approximate distribution N(0,1) for large n H0: p = p0 against H1: p > p0

critical region

H0: p = p0 against H1: p < p0 critical region

H0: p = p0 against H1: p

p0 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

1α /2

K

(6)

Model IV: example

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

H0: p = ½

for α = 0.05 and H1: p ½ we have u0.975 =1.96 → we reject H0 for α = 0.05 and H1: p < ½ we have u0.05 = -u0.95 =-1.64

→ we reject H0

for α = 0.01 and H1: p ½ we have u0.995 =2.58

→ we do not reject H0

for α = 0.01 and H1: p < ½ we have u0.01 = -u0.99 =-2.33

→ we do not reject H0

p-value for H1: p ½: 0.044 p-value for H1: p < ½: 0.022

2 ) 400

2 / 1 1

( 2 / 1

) 2 / 1 400

/ 180

* ( = −

= − U

(7)

Likelihood ratio test for composite hypotheses – reminder

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)

(8)

Likelihood ratio test for composite hypotheses – reminder (cont.)

Test statistic:

or

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

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~

(9)

Asymptotic properties of the LR test

We consider two nested models, we test H0: h(

θ

) = 0 against H1: 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 H0 is true, then for n→∞ the distribution of the statistic converges to a chi-squared

distribution with p degrees of freedom

λ

~ ln 2

degrees of freedom = number of restrictions

(10)

Asymptotic properties of the LR test – example Exponential model: X1, X2, ..., Xn are an IID sample from Exp(

θ

).

We test H0:

θ

= 1 against H1:

θ

≠ 1

then:

from Theorem:

for a sign. level

α

=0.05 we have so we reject H0 in favor of H1 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 ~ 2ln ~ ln

~ 2

~ > ⇔

λ

>

λ

c~

ln 2 84

. 3 )

1

2 (

95 .

0

χ

2 / 84 .

~ 3

> e

λ

(11)

Comparing two or more populations

We want to know if populations studied are

“the same” in certain aspects:

parametric tests: we check the equality of certain distribution parameters

nonparametric tests: we check whether

distributions are the same

(12)

Model I: comparison of means, variance known, significance level

α

X1, X2, ..., XnX are an IID sample from distr N(

µ

X,

σ

X2), Y1, Y2, ..., YnY are an IID sample from distr N(

µ

Y,

σ

Y2),

σ

X2,

σ

Y2 are known, samples are independent H0:

µ

x =

µ

Y

Test statistic:

H0:

µ

x =

µ

Y against H1:

µ

x >

µ

Y

critical region

H0:

µ

x =

µ

Y against H1:

µ

x

≠ µ

Y

critical region

) 1 , 0 (

2 ~

2 Y N

U X

Y Y X

X

n n

σ σ +

= −

} )

( :

{

* = x U x > u

1α

K

}

| ) ( :|

{

* = x U x > u

1α /2

K

assuming H0 is true

(13)

Model I – comparison of means. Example

X1, X2, ..., X10 are an IID sample from distr N(

µ

X,112), Y1, Y2, ..., Y10 are an IID sample from distr N(

µ

Y,132) Based on the sample:

Are the means equal, for significance level 0.05?

H0:

µ

x =

µ

Y against H1:

µ

x

≠ µ

Y

we have: u0.975 ≈ 1.96.

|0.557| < 1.96 → no grounds to reject H0

498 ,

501 =

= Y

X

557 .

498 0 501

10 11 10

132 2

≈ +

= − U

(14)

Model II: comparison of means, variance

unknown but assumed equal, significance level

α

X1, X2, ..., XnX are an IID sample from distr N(

µ

X,

σ

2), Y1, Y2, ..., YnY are an IID sample from distr N(

µ

Y,

σ

2) with

σ

2 unknown, samples are independent

H0:

µ

x =

µ

Y Test statistic:

H0:

µ

x =

µ

Y against H1:

µ

x >

µ

Y

critical region

H0:

µ

x =

µ

Y against H1:

µ

x

≠ µ

Y

critical region

)}

2 (

) ( :

{

* = x T x > t

1

n

x

+ n

y

K

α

)}

2 (

| ) ( :|

{

* = x T x > t1 /2 nx + ny

K α

Assuming H0 is true

2 1 1

2 1 2 1 1

2 1

) (

, )

(

= =

=

= Y

Y X

X

n

i i

Y n n

i i

X n X X S Y Y

S

) 2 (

~ ) 2 (

) 1 (

) 1

( 2 2

+

+ +

+

= X Y X Y

Y X

Y X

Y Y

X x

n n

t n

n n n

n n S

n S

n

Y T X

(15)

Model II: comparison of means, variance unknown but assumed equal, cont.

can be rewritten as

where

is an estimator of the variance

σ

2 based on the two samples

) 2 (

~ ) 2 (

) 1 (

) 1

( 2 2

+

+ +

+

= X Y X Y

Y X

Y X

Y Y

X x

n n

t n

n n n

n n S

n S

n

Y T X

) 2 (

1 ~

1 +

+

=

Y X

Y X

n n

t n

S n

Y T X

2 ) 1 (

) 1

( 2 2

2

+

+

=

y x

Y Y

X x

n n

S n

S S n

(16)

Model II: comparison of variances, significance level

α

X1, X2, ..., XnX are an IID sample from distr N(

µ

X,

σ

X2), Y1, Y2, ..., YnY are an IID sample from distr N(

µ

Y,

σ

Y2),

σ

X2,

σ

Y2 are unknown, samples are independent H0:

σ

X =

σ

Y

Test statistic:

H0:

σ

X =

σ

Y against H1:

σ

X >

σ

Y

critical region

H0:

σ

X =

σ

Y against H1:

σ

X

≠ σ

Y

critical region

) 1 ,

1 (

2 ~

2

= X Y

Y

X F n n

S F S

)}

1 ,

1 (

) ( :

{

* = x F x > F1 nXnY

K α

)}

1 ,

1 (

) (

) 1 ,

1 (

) ( : {

*

2 / 1

2 /

>

<

=

X Y

Y X

n n

F x

F

n n

F x

F x

K

α α

assuming H0 is true

2 1 1

2 1 2 1 1

2 1

) (

, )

(

= =

=

= Y

Y X

X

n

i i

Y n n

i i

X n X X S Y Y

S

(17)

Model II: comparison of means, variances unknown and no equality assumption

X1, X2, ..., XnX are an IID sample from distr N(

µ

X,

σ

X2), Y1, Y2, ..., YnY are an IID sample from distr N(

µ

Y,

σ

Y2),

σ

X2,

σ

Y2 are unknown, samples independent H0:

µ

x =

µ

Y

The test statistic would be very simple, but:

It isn’t possible to design a test statistic such that the distribution does not depend on

σ

X2 and

σ

Y2 (values)...

2 1 1

2 1 2 1 1

2 1

) (

, )

(

= =

=

= Y

Y X

X

n

i i

Y n n

i i

X n X X S Y Y

S

?

2 ~

2

Y Y X

X

n S n

S

Y X

+

(18)

Model III: comparison of means for large samples, significance level

α

X1, X2, ..., XnX are an IID sample from distr. with mean µX, Y1, Y2, ..., YnY are an IID sample from distr. with mean µY , both distr. have unknown variances, samples are independent,

nX, nY – large.

H0: µx = µY Test statistic:

H0: µx = µY against H1: µx > µY

critical region

H0: µx = µY against H1: µx ≠ µY

critical region

) 1 , 0 (

2 ~

2 Y N

U X

Y Y X

X

n S n

S +

=

assuming H0. is true, for large samples

approximately

} )

( :

{

* = x U x > u

1α

K

}

| ) ( :|

{

* = x U x > u

1α /2

K

2 1 1

2 1 2 1 1

2 1

) (

, )

(

= =

=

= Y

Y X

X

n

i i

Y n n

i i

X n X X S Y Y

S

(19)

Model III – example (equality of means?)

(20)

Model IV: comparison of fractions for large samples, significance level

α

Two IID samples from two-point distributions. X – number of successes in nX trials with prob of success pX, Y – number of successes in nY trials with prob of success pY. pX and pY

unknown, nX and nY large.

H0: pX = pY Test statistic:

where

H0: pX = pY against H1: pX > pY critical region

H0: pX = pY against H1: pX pY critical region

( )

~ (0,1)

) 1

* (

1

1 N

p p

n Y n

X U

Y

X n

n Y X

+

=

} )

( :

{

* = x U

x > u

1α

K

}

| ) ( :|

{

* = x U

x > u

1α /2

K

y

x n

n

Y p X

+

= +

assuming H0. is true, for large samples

approximately

(21)

Model IV – example (equality of probabilities?)

(22)

Tests for more than two populations

A naive approach:

pairwise tests for all pairs But:

in this case, the type I error is higher than

the significance level assumed for each

simple test...

(23)

More populations

Assume we have k samples:

, and

all X

i,j

are independent (i=1,...,k, j=1,.., n

i

) X

i,j

~N(m

i

, σ

2

)

we do not know m

1

, m

2

, ..., m

k

, nor σ

2

let n=n

1

+n

2

+...+n

k

nk

k k

k

n n

X X

X

X X

X

X X

X

, 2

, 1

,

, 2 2

, 2 1

, 2

, 1 2

, 1 1

, 1

,..., ,

...

, ,...,

,

, ,...,

,

2 1

(24)

Test of the Analysis of Variance (ANOVA) for significance level

α

H

0

: µ

1

= µ

2

=... = µ

k

H

1

: ¬ H

0

(i.e. not all µ

i

are equal) A LR test; we get a test statistic:

with critical region

for k=2 the ANOVA is equivalent to the two-sample t-test.

) ,

1 (

~ ) /(

) (

) 1 /(

) (

1 1

2 ,

1

2

k n

k F k

n X

X

k X

X F k n

i

n

j i j i

k

i i i

i − −

= −

∑ ∑

= =

=

∑ ∑

= = = = = =

= k

i i i

k i

n

j i j

n

j i j

i

i n X

X n X n

n X

X i i

1

1 1 ,

1 ,

1 , 1

1

)}

, 1 (

) ( :

{

* x F x F

1

k n k

K = >

α

− −

(25)

ANOVA – interpretation

we have

– between group variance estimator

– within group variance estimator

∑ ∑

= =

k i

n

j i j i

i X X

k

n 1 1

2

, )

1 (

Sum of Squares (SS)

Sum of Squares Between (SSB)

Sum of Squares Within (SSW)

=

k

i ni Xi X

k 1

)2

1 ( 1

∑ ∑ ∑

∑ ∑

= = = k= + = =

i

k i

n

j i j i

i i

k i

n

j i j

i

i X X n X X X X

1 1 1

2 ,

2

1 1

2

, ) ( ) ( )

(

(26)

ANOVA test – table

source of

variability sum of squares degrees of freedom

value of the test statistic F between

groups SSB k-1

within groups SSW n-k

total SS n-1 F

(27)

ANOVA test – example

Yearly chocolate consumption in three cities: A, B, C based on random samples of nA = 8, nB = 10, nC = 9 consumers. Does consumption depend on the city?

α=0.01

→ reject H0 (equality of means), consumption depends on city

A B C

sample mean 11 10 7

sample variance 3.5 2.8 3

61 . 5 )

24 . 2 (

and

31 . 24 12

/ 7 . 73

2 / 63 . 75

7 . 73 8

3 9 8 . 2 7 5 . 3

63 . 75 9

) 3 . 9 7 ( 10 )

3 . 9 10 ( 8 ) 3 . 9 11 (

3 . 9 )

9 7 10 10

8 11 (

99 . 0

2 2

2 27

1

=

=

+

+

=

=

+

+

=

=

+

+

=

F F

SSW SSB

X

(28)

ANOVA test – table – example

source of

variability sum of squares degrees of freedom

value of the test statistic F between

groups 75.63 2

within groups 73.7 24

total 149.33 26 12.31

(29)

Cytaty

Powiązane dokumenty

Therefore these tests were compared in terms of Type III error rates across the variety of population distributions, mean difference (effect size), and sample sizes.. Key words: Type

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

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

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

Using Monte Carlo experiments the asymptotic behavior of the modified robust ver- sions of the Wald statistic is compared with the standard significance test for the Cox model based

Marking, Points and Grades For the Reading Comprehension, Language Elements and Listening Comprehension parts of the examination, compare the learners’ answers with the answer

Drugi odnosił się do badań uczonego nad postacią Antoniego Tyzenhauza, natomiast trzeci i czwarty dotyczyły odpowiednio sylwetek uczniów wileńskiego hi- storyka i

Кащен- ка Запорозъка слава за художшстю не належить до найкращих його TBOpiß, але вона щкава тим, що написана на iviaTepiaai досл!дження