chap 9 testing hypotheses and assessing goodness of fit...

46
Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統統統統統統統統統統統統 統統統統統 random sample 統統統統統統統 統統統 . 統 : 統統 X 1 , X 2 ,…, X n ~ i.i.d N (μ, σ 2 ) 統統統 μ 統統統 μ 1 統 μ 2 , 統統統統統統統 . 統統統統統 : 統統統統 Neyman-Pearson Lemma 統統 H 0 : Null hypothesis ( H 0 統統統統統統統統統統統統統統統統統統 ) H 1 : Alternative hypothesis Simple Hypotheses : 統 H 0 : μ=μ 1 v.s. H 1 : μ=μ 2 Composite Hypothesis : H 0 : X 1 , X 2 ,…, X n 統統 Poisson(λ) H 1 : not Poisson(λ) 統 H 1 統統 P(λ 1 ) 統統 simple Hypothesis Ex: B (n, p) H 0 : p = 0.50 v.s. H 1 : p = 0.25 or H 1 : p ≠ 0.5 ( two-sided alternative )

Upload: kalkin

Post on 19-Jan-2016

79 views

Category:

Documents


2 download

DESCRIPTION

Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之 random sample 來區分二分佈之 一種方法 . 例 : 給定 X 1 , X 2 , … , X n ~ i.i.d N (μ, σ 2 ) 想決定 μ 究竟是 μ 1 或 μ 2 , 則為區分二分佈 . 主要之架構 : 理論根據 Neyman-Pearson Lemma 而來 H 0 : Null hypothesis ( 一般 H 0 取較為簡單或拒絕的結果為較嚴重的假設 ) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Chap 9 Testing Hypotheses and Assessing Goodness of Fit

統計假設檢定基本上是基於一分配所得之 random sample 來區分二分佈之一種方法 .

例 : 給定 X1, X2 ,…, Xn ~ i.i.d N (μ, σ2 ) 想決定 μ 究竟是 μ1 或 μ2 , 則為區分二分佈 . 主要之架構 : 理論根據 Neyman-Pearson Lemma 而來H0 : Null hypothesis ( 一般 H0 取較為簡單或拒絕的結果為較嚴重的假設 ) H1 : Alternative hypothesisSimple Hypotheses : 如 H0 : μ=μ1 v.s. H1 : μ=μ2

Composite Hypothesis : H0 : X1, X2 ,…, Xn 來自 Poisson(λ) H1 : not Poisson(λ) 若 H1 改為 P(λ1) 則為 simple Hypothesis

Ex: B (n, p) H0 : p = 0.50 v.s. H1 : p = 0.25 or H1 : p ≠ 0.5 ( two-sided alternative ) p < 0.5 ( one-sided alternative ) p > 0.5

Page 2: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.2 The Neyman-Pearson Paradigm

根據 Neyman-Pearson 決定是否接受 null hyp. 是看檢定統計量 T(x) 是落在acceptance region 或在 rejection region

1. Type error : HⅠ 0 為真 , 但 reject H0 . P ( reject H0 | H0 is true ) = α 若 H0 為 simple, 稱 α 為 significance level . 若 H0 為 composite, 則在每一特殊 θ 下有一 type errorⅠ 此時 significance level 為 max P (Type error)Ⅰ2. Type error : HⅡ 0 false, but accept H0 . P (accept H0 | H0 false) = β

‧Power function P (reject H0 |θ) = 1 –β 與 θ 相關

理想狀況 : α = β = 0 , 但除非是在 trivial case 下否則是不可能 , 通常在樣本數固定的情況下 α↓ 則 β↑. Neyman-Pearson 解決這種矛盾的方法是先將 significance level α 固定後 , α 通常是很小的值 , 再設法建造一 test 使 β 為最小 .

H0 True False

Accept ˇ Type Ⅱ

Reject Type Ⅰ ˇ

Page 3: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Ex. 設 X ~ B (n, p) H0 : p = 0.5 v.s. HA : p > 0.5 . 即 Rejection region 為由 X 中之大的值構成 ,

利用 binomial 之分佈表 , 設 rejection region 為 {8,9,10}, 則α = P (X > 7 | p = 0.5) = 1 – P (X 7) = 0.0547≦

若 rejection region 為 {7,8,9,10}, 則α = P (X 7 | p = 0.5) = 0.172≧

The Neyman - Pearson approach 則先設定 α 之值 . 如選 α= 0.0547 .若 true value of p 為 0.6 .1 - β(0.6) = P(X 8 | p =0.6) = 0.1673 ≧1 - β(0.7) = P(X 8 | p =0.7) = 0.3828≧

Power 隨著 p 增加 ( 即 遠離 H0 : p = 0.5) 而增加

Page 4: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

0.01) 0.05; 0.1; general,(in

accept levelt significan if

reject levelt significan if

0547.0)8(

8 observe

0107.0)9(

9 observe , .

)(P value-p

,t T sample,t}>region{Treject eg.

reject be willhypothesis e th

for which α of aluesmallest v the:value-p )d(

test theof valuecritical the

called is t then,t},>{Tregion Rejection eg.

valuecritical )c(

5.0

5.0

*H

*

0

valuep

valuep

XPvaluep

x

XPvaluep

xEg

tT

個成功若

個成功若上例中

即為則其

為所得的若由

Page 5: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Ex. 再考慮前述檢定 goodness of fit to a Poisson dist. 虛無假設 : 數據來自於 Poisson dist. 對立假設 : 來自一未註明之 discrete dist.

=============== α particles

在單位時間內所放射的 α 粒子數目為一隨機變數 . 假設 (1) 在觀察時段中 , ( 每個 atom 原子 ) 其 emission rate 為一常數 (2) 所觀察的 α particles 數目 , 來自於 a very large number of independent sources (atoms 原子 )對此 radioactive decay data, Poisson 模型為一 appropriate 的模型 , Poisson postulate (i) the underlying rate at which the events occur is constant in space or in time (ii) events in disjoint intervals of space or time occur independently (iii) There are no multiple events.

radioactive sources放射性物質

Page 6: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Berkson (1966) 分析從美國國家標準局所獲得的

(1) 在連續的放射中紀錄 10,220 次 (2) observed mean emission rate = =0.8396

(3) 準確度 ( 用於紀錄時間的 clock 可達 0.0002秒 )

Berkson 分析 1207 intervals, each of length 10秒 . 見 :

Americium 241鋂 (Am, 原子序 95)

) time)(sec(total

)emissions of# total(

, 其中 λ= 0.8392 x 10 (秒 ) = 8.932 (為 Poisson的 mean)P1 = π0+π1+π2

P16 =

The joint distribution of the counts in all cells is multinomial with n = 1207 & probabilities P1, P2, …, P16 .

!)(

k

ekxP

k

k

17k

k

Page 7: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Goodness of Fit : Pearson’s chi-square statistic = (8.99) d.f. = # of cells - # of indep. parameters o fitted -1 = 16 -1 -1 = 14

do not reject 亦可採用 generalized likelihood test, 即

cells all

22 )(

i

ii

E

EO

83.0)99.8( 214 P Fig.8.1

214

16

1~log2

i i

ii E

OO

Page 8: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

上述二例均有一共同性質 , 即檢定係基於一檢定統計量 , 且此統計量在虛無假設下之分佈函數為已知 .( 稱為 null distribution ) 因為知此 null dist. 我們可以方可定義顯著水準為 α 的 rejection region. 且在前述之二例中 rejection region 均為 {T > t} 之形式 ; T 為檢定統計量 . 在這些情形下 ,稱 t 為 ” critical values of the test”.

Critical value 將 rejection region 及 acceptance region 區分出來 .( 再回到第8 章中之 p-value 與 α 之間的關係 recall ) 若觀察到 之值為 c, 則 p* = P ( > c). 故若 c > (α) , 則 p* < α若 c < (α) , 則 p* > α.

所以 The test rejects iff. p* < α.換句話說 p* 是會使 null hypothesis 被 reject 之最小 α.

2

2 22

Page 9: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.3 Optimal Tests : The Neyman-Pearson Lemma   針對一 null hypothesis v.s. alternative, 通常都有很多檢定滿足 signification level α. 從這些檢定中如何挑選出最好的一個 ” test” ? 一個最好的 test 通常是指顯著水準為 α, 而且比任何其他檢定之檢定力來得高 .

   Neyman-Pearson Lemma 證明在檢定 simple v.s. simple 假設時 , 存在一最好之檢定 , 而此檢定是根據在二假設下之 likelihoods 之比值而得.

Page 10: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

x

Af

xf

a

H) x(A

f

H xf

. Defn

0be todefined is ratio likelihood Then the

(simple)by specified (p.m.f) p.d.fjoint theis(ii)

)simple(0

by specified (p.m.f) p.d.f.joint theis0

(i)

Assume

Lemma (Neyman-Pearson Lemma) H 0 : μ=μ0 v.s. HA : μ=μ1

  令 d* 為一檢定 , 它拒絕虛無假設 . 當

( f0 (x) 為 H 0 成立時之 likelihood function )

且令 α* 為 d* 之顯著水準 . 若 α 為另一顯著水準 α α* ≦ 之檢定 , 則

d 之檢力 ≦ d* 之檢力 . (Most powerful test)

cxf

xf

A

)(

)(0

Page 11: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

) of valueslargefor rejects best test (The

*ln4

5ln10

3

2ln

4

5

3

2

4.0

5.0

6.0

4.0

4.06.010

5.010

0.6=P: , 0.5=P: P)B(10, :Eg

10

10

10

10

6.0

5.0

0

k

ckck

c

k

k

kf

kf

HH

k

k

kk

a

Page 12: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

k 0 1 2 3 4 7 8 9 109.31

6.21

4.14

2.76

1.84

0.55

0.36

0.24

0.16)()( 6.05.0 kfkf

0.0547power haswhich

0.0547 yprobabiliterror Ⅰ with typeother test

anyexist not dose thesesays lamma P-N The

1673.071 is ealternativ test v.s

ofpower the&05437.07 =α

levelt significan then the7=c* i.e,,0.55=c If

6.0

5.0

kP

kP

Page 13: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Ex. 令 X1, X2 ,…, Xn ~ N (μ, σ2 ), σ2 已知 .

考慮 H 0 : μ=μ0 v.s. HA : μ=μA

其中 μ0 及 μA 為給定之常數 .

在顯著水準 α 之下 , 由 Neyman-Pearson Lemma

])(2

1exp[

])(2

1exp[

)(

)(

1

22

1

202

1

0

n

iAi

n

ii

x

x

xf

xf

使 小之值與使 小之值對等)(

)(

1

0

xf

xf

20

1

2 )()( i

n

iAi xx

20

20

1

0 )(2)()( nnxcxf

xfAAi

Page 14: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

c ) | Zn /

(

),N(X

) | 'P(

reject 'or

accept ')(

)( , 0 -

reject 'or

accept ')(

)( , 0 -

10''

0-10

2

0

0

'

1

0A0

1

0A0

c

nZc

XP

n

cx

cx

cxcxf

xf

cx

cxcxf

xf

i

i

i

i

i

由於

的求法

則若

則若

Page 15: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Eg. X1, X2 ,…, Xn ~ i.i.d N (μ, σ2 ) σ is known H 0 : μ=μ0 v.s. Ha : μ=μA Require signification level = αN-P Lemma Among all tests with signification level α, the test reject for

is most powerful.

1. if μ0 –μA > 0, the likelihood ratio test is small if is small

2. if μ0 –μA < 0, the likelihood ratio test is small if is large Assumeμ0 –μA < 0, Now choose x0 , s.t.

cxf

xf

A

)(

)(0

)]}()(2[2

1exp{

])(2

1exp[

])(2

1exp[

)(

)( 20

202

1

22

1

202

1

0

AAn

iAi

n

ii

nxnx

x

xf

xf

)( 00xXP

)()( 0000 00

n

x

n

XPxXP

z

n

x

00

power of this test )()( 00

n

x

n

XPxXP AA

AA

Page 16: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Def : if HA is composite, A test that is most powerful for every simple alternative in HA is said to be uniformly most powerful.

Eg. : X1, X2 ,…, Xn ~ i.i.d N (μ, σ2 ) H 0 : μ=μ0 v.s. HA : μ> μ0 For a particular simple alternative μ=μA> μ0 , the most powerful test reject for with x0 only depends on μ0 , n &σ2 but not on μA . this test is ∵ most powerful & is the same for every simple alternative in HA , it is uniformly most powerful.

在檢定 H 0 : μ μ≦ 0 v.s. HA : μ> μ0 時 上述檢定仍為 uniformly most powerful

但在檢定 H 0 : μ=μ0 v.s. HA : μ≠μ0 時則非 UMP

Page 17: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.4 The Duality of Confidence Intervals & Hypothesis Tests 信賴區間或集合與假設檢定之間有一對偶關係存在 .我們將証明信賴集合可由假設檢定得之 , 反之亦然 .

Ex: 令 X1, X2 ,…, Xn 為一 random sample, 其共同分佈為 N (μ, σ2 ), μ 為 unknown, σ2 為 known. 考慮下列檢定 H 0 : μ=μ0 v.s. HA : μ≠μ0 .考慮一指定顯著水準為 α 的檢定 , that rejects H 0 當 . c 之決定即當 H 0 為真時

即當

or

-100(1-α)% C.I. for μ0 為

cX 0 )( 0 cXP

)2

( Zc x

)2

(0 ZX x

)2

(0

)2

( ZXZ xx

)2

(0

)2

( ZXZX xx

)2

()2

(, ZXZX xx

比較接受區間與信賴區間 , 兩者是一樣的 . 換句話說 : 信賴區間即為所有會接受 H 0 : μ=μ0 μ0 值 .

Page 18: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

以下我們給出更一般的性質 .令 θ 為一機率分佈族之參數 .

定理 A: For the hypothesis H 0 : θ=θ0 , 假設對 Θ 中每一 θ0 都有一 level α 之檢定 . 令此檢定之接受區域為 A(θ0), 則集合 (acceptance region)

為 θ0 之 100(1-α)% conf. region.

pf : A(θ∵ 0) 為一 level α 檢定的接受域 Now By def. of

定理 B: 假設 為 θ 之 100(1-α)%, 信賴域即 θ0 . 則 為 對檢定 H 0 : θ=θ0 之一 α level acceptance region 這種對偶性質相當有用 . 其中一種不易求時 , 則設法求另一種 .

)}(:{)( 0 AxxC

),..,( 1 nxxx

1)|)(( 00AxP

1)|)(()|)(( 0000 AxPxCP

)(xC

)(xC

1]|)([ 00 xCP

)(|)( 00 xCxA

Page 19: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.5 Generalized Likelihood Ratio Tests ( 廣義概似比檢定 )

(i) 當 hypothesis is simple v.s. simple 時 likelihood ratio test is optimal.(ii) 當 hypotheses 不是 simple 時 , 我們發展一 likelihood ratio test 之推廣 test. 稱為 generalized likelihood ratio test. 這種 tests 一般不見得為 optimal, 但 在沒有任何 tests 為 optimal 時 , 它的表現一般而言 , 是還不錯的 . Generalized likelihood ratio tests 有很多好處 , 它們所扮演的角色就像估計 中的 M.L.E. 一樣

令 X = (X1, X2 ,…, Xn) 之 joint p.d.f. 為 L (X1, X2 ,…, Xn |θ)則 H 0 可能為 , W0 為一所有可能之 θ 之一 subset ,

考慮

00 : WH

11 : WH 10 WW

)|,...,(max

)|,...,(max

*1

1

1

0

nW

nW

XXL

XXL

Page 20: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Λ* 值小時 , 即對 H 0 不利 . 為了計算上之方便改用下列 test: 令

∴ Λ = min (Λ*,1) Λ* 小時 , Λ 亦小The rejection region for a likelihood ratio tests consists of small values of Λ,如所有 Λ λ≦ 0

10 WW

)|,...,(max

)|,...,(max

1

10

n

nW

XXL

XXL

Page 21: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Example: X1, X2 ,…, Xn ~ i.i.d N (μ, σ2 ) σ is known test H 0 : μ=μ0 W0={μ0 } H 1 : μ≠μ0 W1={μ≠μ0} Ω=R : 此 max 在 時達到

所以

=

)|,...,(max 1

nXXL

i

Xix

i

ix

e

e

n

n

22

2)(

22

2)0(

)2(

1

)2(

1

2202

)()(2

1Xxx ii

e

X

Page 22: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

= = =

i.e. under H0 i.e. at level α, rejects H0 when or

在尋找一顯著水準為 α 之 Likelihood ratio test 時 , 我們要決定 λ0 之值使得當 H0 為真時 , P(Λ λ≦ 0) = α若當 H0 為真時 , Λ 之 prob. 分配為已知 , 則可找得 λ0, 但一般樣本分配可能相當複雜 , 則可用下列之定理 .

i

ii

ii XnxXXxx )()(2)()( 20

20

220

))(()(2 000 XXnXXn

]2)[( 00 XXXn2

0)( Xn

00 log2log2 cXn 2

02)(

),(~

2

0 nNX

2202 1

~)( xXn

)()( 21

202

xXn )2(0

Z

n

X

Page 23: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

定理 A: 當 joint p.d.f. 滿足某些平滑條件時 , -2logΛ 之 null dist. 當 n→∞ 時 , 會趨近於 Chi-square dist. with d.f. = dimΩ - dimW0 其中 dimW0 及 dimΩ 指在 W0 及 Ω 中 free parameters 之數 . 在上例中 , dimΩ= 0, dimW0 = 1 ∵W0={μ0}, σ 又已知 , 沒有 free parameter Ω 中只有 μ 為 free.

Page 24: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.6 Likelihood Ratio Tests for the Multinomial Distribution

在 multinomial goodness-of-fit test 中 , 虛無假設 H0 : P = P (θ) W0 , 其中 P 為 cell prob. 向量 , θ 為參數 HA : H0 not true

likelihood ratio 之分子部份 .

其中 xi 為 m 格子中之觀測計數 .由 M.L.E. 之定義 : 一 M.L.E. 即為使 Likelihood function 為最大之 θ. ∴相對應 之 Pi 值以 表之 .

由於 P Ω 時 , 沒有 以外之限制

所以 the likelihood ratio 為

}0,1{1

m

iPiPi

mxm

x

mWP

PPxx

n)()(

!!

!max 1

110

)ˆ(iP

1Pi

n

xP ii ˆ

ix

iP

Pi

xPxPxx

n

xP

xP

xx

nm

im

mm

mm

m

11

11

11

1

ˆ)ˆ(

ˆˆ!!

!

)ˆ()ˆ(!!

!

Page 25: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

分別代表觀測到的格子計數及期望值under HA : Ω 為 free 所以 dimΩ = m-1under H0 : depend on a k-dimensional parameter θ ( 為估計值 ) ∴ dim W0 = k .由前述定理 :

當 H0 為真 , n 很大時

利用 Taylor expansion 對函數 f (x) 在 x = x0 處展開

ii Pnx ˆ

)ˆ( , ˆ wherelog2ˆ

)ˆ(logˆ2log2

11iiii

m

i i

ii

i

im

ii nPEPnO

E

OO

P

PPn

)ˆ(iP

)ˆ(

ˆlogˆ2log2

1 i

im

ii

P

PPn

)parameter true( )ˆ(ˆiii PPP

0log)(

x

xxxf

0

200

1)(

2

1)()(

xxxxxxf

Page 26: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

second term on the right hand side.

此檢定即為前面 8.2節中提到的 Pearson’s -test for goodness of fit. 而 Pearson’s -test for goodness of fit 通常較常被用 . 因為計算上比較容易 .

m

i

m

i Pi

PioPnPiiPn

1

2

1 )ˆ(

)ˆ(ˆ)ˆ(ˆ2log2

= 0

)1)ˆ(ˆ( PiiP

cell all

2

1

2

)ˆ(

)ˆ(

Ei

(Oi-Ei)

nPi

Pixm

i

i

ii Pnx ˆ

22

Page 27: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Ex : (Hardy-Weinberg Equilibrium) Genotype

M.L.E. of θ Blood Type

H0 : as special above. H1 : the multinomial dist. does not have the probability specified above.

α= 0.05

= 0.00575 + 0.01559 + 0.01056 = 0.0319

AA Aa aa

(1-θ)2 2θ(1-θ) θ2

M MN N

Observed 342 500 187

Expected 340.6 502.8 185.6

424.02

2ˆ23

n

xx

6.185

)6.185187(

8.502

)8.502500(

6.340

)6.340342()( 22222

E

EOx

Page 28: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

x12 (0.05) = 3.84 do not reject H0

x2 (0.76) = 0.09 so the p-value 為 0.76 p-value 之另一種解釋為在模型正確的假設下 , 會出現此值之機率為 76%. The likelihood ratio test statistic 為

p-value 為 0.86.

0.032 log2log23

1

i i

ii E

OO

Page 29: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Ex B (Bacterial Clumps) 在一檢查牛奶是否被細菌污染之實驗中 , 將 0.01 毫升的牛奶灑在一1平方公分之玻璃片上 , 再在顯微鏡下觀察在有格子之方塊中有多少個細菌塊 .首先 Poisson model 似乎看起來十分合理 , 因為細菌塊相當均勻的分佈在牛奶中 , 但實際上可能會有兩個問題 .

1. 在牛奶滴的下表面在與玻璃片相接處可能濃度較高 .2. 玻璃片的厚度不一致 . 在中心較厚 , 在邊緣較薄 . 所以細菌的濃度亦非均勻分佈 .

Page 30: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

以下為 Bliss & Fisher (1953) 之表 , 為在 400 個方格上之計數 .

Number per square 0 1 2 3 4 5 6 7 8 9 10 19

Frequency 56 104 80 62 42 27 9 9 5 3 2 1

Fit P (λ) 中 λ 之M.C.E. 40.2400

1191041560ˆ

xxx

下表顯示 observed 及 expected counts 及 chi-square test stat. 之計算值 . 最後幾個格子則集合在一起 , 使得 expected counts 不致太小 ,靠近 5.

Observed 56 104 80 62 42 27 9 20

Expected 34.9 85.1 103.8 84.4 51.5 25.1 10.2 5.0

Component of X2 12.8 4.2 5.5 6.0 1.8 0.14 0.14 45.0

i

ii

E

)-E(O 2

x2 = 75.6 x∵ 62 (0.005) = 18.55 d.f. =6=8-1-1

p-value < 0.005 rejects H0 model fails 之原因來自第一格及最後一格 ,太多小的及太多大的 .

Page 31: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Ex C. (Fisher’s Reexamination of Mendel’s Data) 在孟德爾許多有名的實驗中 , 其中一個實驗是將 smooth, yellow (平滑 ,黃色 ) 的male peas, 與 wrinkled, green (皺 , 綠色 ) 的 female peas 相配 . 根據現在的基因理論 . 子孫的相對頻率應為 :

Type Frequency Observed count Expected count

Smooth-yellow3/4 3/4

9/16 315 312.75 = 556 x 9/16

Smooth-green3/4 1/4

3/16 108 104.25 = 556 x 3/16

Wrinkled-yellow1/4 3/4

3/16 102 104.25 = 556 x 3/16

Wrinkled-green1/4 1/4

1/16 31 34.75 = 556 x 1/16

556 dimΩ-dimW0

d.f. = 3

p-value < 0.9 Pearson chi-square = 0.604

= 0

618.0 log2log24

1

i i

ii E

OO

2

Page 32: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

若模型正確會有這樣的差距之機率有 90%, 所以沒有理由拒絕 H0 .只有在 p-value很小時 , 我們才會懷疑模型的正確性 . 或 On the basis of chance 只有 10% of the time 會比這更靠近 .又當模型 fit 太好時 , 如 p-value 為 0.999, 我們會懷疑此模型之可靠性 , 亦是十分合理 . Fisher 將 Mendel 之實驗結果混何在一起來作檢驗 .如將二獨立實驗 , 根據所得數據作 -test d.f. 為 p 及 r, 則在虛無假設下可將二統計量合併 ( 相加 ) 得另一 chi-square with d .f. p+r . Fisher 將所有 Mendel 所有的實驗結果合併在一起 , 如此做了以後發現 p-value 變成 0.99996. 而這樣的好的match, 照機會在 100,000 次中只有可能發生 4次 .

(問題 ) Mendel 是否故意或無意識的捏造數據 ? 或技術員捏造 ? 上帝介入賜予他的 ? 較合理的解釋是他一直做到 good fit 為止 . 在此 -square 假設 n 為 fixed.

Mendel 並非唯一結果 is “too good to be true” 的科學家 . 一為英國心理學家Cyril Burt 在研究”遺傳對智力的影響”的辯論中 , 有極大的 impact. 他許多論文及相當多方面的數據都在設法支持此論點 . Burt 是在 1946年為第一位封爵的心理學家 , 但到了 1970年他的工作受到不少攻擊 , 被別人懷疑為杜撰資料 , 在他最有名的研究之一有 40,000父與子的智力及職業中 , Dorfman (1920) 將智商分數以normal dist. 來 fit, 並作 goodness of fit. P-values 分別對父親與兒子而言都超過1-10-7 及 1-10-6. Dorfman 之結論是 Burt 的 frequency dist. 為人類學測量歷史中最 normally distributed !!

2

2

Page 33: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.7 The Poisson Dispersion Test The likelihood ratio test及 Pearson’s chi-square test 是在未對 alternativehypothesis 作任何假設下得到的 . 若我們對 alternative hyp. 有些了解 , power一般會比較好 . 以下討論 Poisson dist. 之檢定 .

樹葉上的昆蟲數 : 當葉子大小不同時 , 且採自於不同的植物時 , 可能各個 counts 之 rates λ 並不同 .

昆蟲孵出時通常都是一群一群 , 所以不滿足 independence 之假設 .給定 counts x1,…,xn

H0 : xi 來自 P(λ) v.s. H1 : xi 來自 P (λi )

under H0, . under Ω. M.C.E. of λi 為 xi xix

eix

ix

x

xiex

i

xex

n

in

i ii

n

i ii

1

1

1

!

ˆˆ

!

ˆˆ

Page 34: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

利用 Taylor Series argument 可得近似之對等型式 .

∵under Ω = W0 W∪ 1 有 n 個 free parameters dimΩ = n∴

under W0 dim W0 = 1

∴ degree of freedom dimΩ-dim W0 為 n-1.

n

ii

ii xx

x

xx

1log2log2

n

i

ii x

xx

1log2

0

200

0

1)(

2

1)(log)(

xxxxx

x

xxxf

n

iii x

xxxx1

2 1

2

12

mean est.

variance)n(est. 可看成為1

log21

2

n

ii xx

x

Page 35: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

對 Poisson dist. 而言 , mean 和 variance 是一致的 . 而對 H1 而言 , variance是大於 mean. 故此檢定常被稱為 the Poisson dispersion test. 此檢定 alternatives一若相對於 Poisson dist. 為 overdispersed. 如 negative binomial dist. The ratio 有時用來測量群聚的程度 .( 在沒有足夠數據 , 使得在好幾個 cells 中無法

累積有相當的數據 , 以致無法使用 Pearson’s chi-square test 時 , 即用 Poisson disp.test) ( 每個 cell 中至少要有 5 個 obs. 才會使得 Pearson chi-square 中的檢定統計量接近一 的分佈 )

Ex. A. (石綿纖維之例 ) 國家標準局 . 石綿纖維在 23 方格上之 counts 是否可用 Poisson dist. 來fit.

用 Poisson dispersion test.

or likelihood ratio test d.f. = 23 – 1 = 22 p-value 大約為 0.21 ∴ 證據不足以拒絕 H0, 但因樣本小 (23 個 obs. ), power 可能較低 .

x2

56.261

1

2

n

ii xx

x

11.27log2

x

xx ii

2

Page 36: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

Ex. B. (細菌塊 ) 牛奶中之細菌塊是否可用 Poisson = 4.59

under H0 T~ 由中央極限定理 .

∴Poisson model fails to fit the data.

2222

2400

1191041560ˆ x

xxx

222

)(1

xxnn

xxi

i

7.75240.2

59.4400ˆ 2

x

x

nT

0)5.12(13992

399560

3992

399)560(

xx

TPTP

2399

Page 37: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.8 Hanging Rootograms 本節中為利用 graphical 方式顯示 observed 及 expected values in histograms. 我們使用由臨床化學 (Martin, Cudizinowicz, & Fanger, 1975 ) 之一組數據說明之 . 下表為 152 個血清中之鉀的成分 , 在臨床化學常以此建立分配以決定在病人的血清含鉀的成分是否正常 . 下表為數據之分佈表 , 想 fit normal 分配 .

9-1(a) 為頻率之直方圖 . 看起來是 bell-shaped, 但 normal 分配不只是bell-shaped 而已 . 故將 observed 與由 normal fit 之期望值比較 . 由 data 估計 μ及 σ. 設 xj-1, xj 分別為第 j 個 interval 之左、右端點 . 則根據normal model 落在此區間之機率為

若 sample size 為 n, 則落在第 j 個區間之預測或配合值為然後可以與 nj 比較之 .

9-1(b)為 ” hanging histogram” of the differences . 但此量很難解釋因為一 cell 到另一 cell 之變異是否為 constant .

sx ˆ,ˆ

ˆˆ)(ˆ 1

1xxxx

xXxPPjj

jjj

jj Pnn ˆˆ

jj nn ˆ

Page 38: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

( 方法一 ) hanging rootogram 若忽略期望值估計量之變異 在此例中 n, Pj (或 nj) 皆很小 , 則

對那些相對較大的 Pj (或 nj) 則 之差異亦大 .Variance stabilized transformation X ~ r.v. E (X) = μ 當 Var (X) = h (μ) 考慮 Y = f (x).

在上述例子 h (μ)=μ

hanging rootogram 即可考慮 的轉換 ∴當 or 可視為大的 deviate 差異 = or = 1 or 1.5

)1()()ˆ( jjjjj PnPnVarnnVar

)(ˆ)ˆ( jjjjj nEnnPnnVar

jj nn ˆ

=> 此 unequal variability 使得無法由 hanging rootogram( 即( ) 之大小來判斷 dist.fit 的好壞 ), ∵當 大時 , 可能是真正 fit 較差的地方 ,也可能是由於在該處的variance 較大所造成 .

jj nn ˆjj nn ˆ

constant )()]('[)()]('[)( 22 hfXVarfYVar

)(

1)('

hf

)()(' fc

f

xxf )( 4/1)( xVar )4/1)(( jnVar

)(2ˆ jjj nVarnn )(3 jnVar

2

12

2

13

Page 39: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

( 方法二 ) hanging chi-gram (= components of Pearson’s chi-square statistics) ( ) ( )

∴ 此方法亦 stabilize the variance of nj

j

jj

n

nn

ˆ

ˆ

jjjj nnPnnVar ˆ)ˆ(

ˆ

j

jj

n

nnVar

Page 40: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

9.9 Probability Plots “機率圖”是一相當有用的圖示法 , 可觀察數據與理論分配值之差異 . 考慮一樣本數為 n 之隨機樣本 , 其共同分配為 uniform [0,1]. 令X (1)< X (2)<…< X (n) 為其有序樣本 .則 E X (j) = 此性質即建議繪製點 ( , X (j) ) 在圖上 .圖9-2為一樣本為100 之圖 .圖9-3

令 Y1, …, Y100 為一隨機樣本 , 其共同分配為二 indep. U [0,1] 之平均 .i.e. Y=(U1+U2)/2, 其機率密度函數為 f (y) = 4y , 0 y 1/2≦ ≦ 4 - 4y , 1/2 y 1≦ ≦將 ( , Y (j) ) 畫圖 , 可看出偏離直線 .在左邊的尾端 observed > expected U [0,1]在右邊的尾端 observed < expected Y 分佈的 tails 比 uniform (0,1) 的 tail 下降的快 ( 即 tail 較 light )此技巧亦可推廣到其他連續隨機變數 . 由前面已知若 X 為連續 , 其分配函數Fx 為 strictly increasing. 則 Y = Fx(X) ~ U [0,1]∴給一樣本 X1,…, Xn 繪

F(X (k) ) v.s. 或 X (k) v.s. F-1( )

1n

j1n

j

1n

j

1n

k

1n

k

Page 41: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

1

1..plot

1

1

n

kGXor

n

kGsv

X

xGxFF

k

k則

屬此類尺度參數,常態分配即稱為位置參數,

之形式為若在有些情形下,

Page 42: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

ExA:前述之 probability plot 之方法應用在 Michelson 之光速測定實驗數據,由 1897年 6月 5日至 7月 2日,將原始值減去 299000 後之 100 個數據如下 (data from Stigler 1977):

Fig.9.4

Page 43: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

expected > nsobservatio 右邊

(normal) expected < nsobservatio 左邊

on distributi normal

0 lexponentia double

,2

1

ondistributi

lexponentia double a from variablesompseudorand 500 ExB

2

為重故其尾部比少的多比但其尾端下降速率為

對稱於

::

xx

x

ee

xexf

Fig.9.7

Fig. 9.6

Fig. 9.5

plot.y probabilit theof ssstraightne affect thenot does

1,471.0),,(

aGamma

precipitation

Page 44: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

ExD:血清中含鉀的成分

deviation in the right tail are apparent

Page 45: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

large. b H rejects

1

fit test.-of-goodnessskewness oft coefficien

variance.meanxx(1)

skewness.or asymmetry, of form theoften takenormality from Departures

Normalityfor Tests 9.10

10

31

3

1

n1

之可利用及有相的是否來自一常態分配且若欲檢定依組樣本

s

XXn

b

n

ii

Page 46: Chap 9 Testing Hypotheses and Assessing Goodness of Fit 統計假設檢定基本上是基於一分配所得之  random sample  來區分二分佈之

(2) 若分配為對稱,但可能尾端很重或很輕或中央太尖或太平,這類的偏離可以 coefficient of kurtosis 來決定

4

1

4

2

1

s

XXn

b

n

ii

得到近似值。但可用不易計算樣本分配之及但在虛無假設下,

太大或太小。當同樣

simulation

form closedbb

b ,H rejests

21

20

另外亦可用 probability plot 中之相關係數 r 來檢定, r 值小的時候為配合度不佳,即 rejects when r is small。在 normal 假設下之 r的 sampling dist用 simulation 得到Table