13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing cse 312, winter...

21
13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1

Upload: others

Post on 30-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

13. hypothesis testing

CSE 312, Winter 2011, W.L.Ruzzo

1

Page 2: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

competing hypotheses

2

Page 3: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

competing hypotheses

3

Page 4: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

competing hypotheses

4

Page 5: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

competing hypotheses

5

Page 6: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

hypothesis testing

6

By convention, the null hypothesis is usually the “simpler” hypothesis, or “prevailing wisdom.” E.g., Occam’s Razor says you should prefer that unless there is good evidence to the contrary.

E.g.:

Page 7: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

decision rules

7

Page 8: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

error types

8

Page 9: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

likelihood ratio tests

9

Page 10: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

simple vs composite hypotheses

10

note that LRT is problematic for composite hypotheses; which value for the unknown parameter would you use to compute it’s likelihood?

Page 11: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

Neyman-Pearson lemma

11

Page 12: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

example

12

Page 13: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

13

another example

Given: A coin, either fair (p(H)=1/2) or biased (p(H)=2/3)

Decide: which

How? Flip it 5 times. Suppose outcome D = HHHTH

Null Model/Null Hypothesis M0: p(H)=1/2

Alternative Model/Alt Hypothesis M1: p(H)=2/3

Likelihoods:P(D | M0) = (1/2) (1/2) (1/2) (1/2) (1/2) = 1/32

P(D | M1) = (2/3) (2/3) (2/3) (1/3) (2/3) = 16/243

Likelihood Ratio:

I.e., alt model is ≈ 2.1x more likely than null model, given data

p(D |M 1 )p(D |M 0 )

= 16 / 2431/ 32 = 512

243 ≈ 2.1

Page 14: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

2

some notes

Log of likelihood ratio is equivalent, often more convenient

add logs instead of multiplying…

“Likelihood Ratio Tests”: reject null if LLR > threshold

LLR > 0 disfavors null, but higher threshold gives stronger evidence against

Neyman-Pearson Theorem: For a given error rate, LRT is as good a test as any (subject to some fine print).

14

Page 15: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

summary

Null/Alternative hypotheses - specify distributions from which data are assumed to have been sampled

Simple hypothesis - one distributionE.g., “Normal, mean = 42, variance = 12”

Composite hypothesis - more that one distributionE.g., “Normal, mean > 42, variance = 12”

Decision rule; “accept/reject null if sample data...”; many possible

Type 1 error: reject null when it is true

Type 2 error: accept null when it is falseα = P(type 1 error), β = P(type 2 error)

Likelihood ratio tests: for simple null vs simple alt, compare ratio of likelihoods under the 2 competing models to a fixed threshold.

Neyman-Pearson: LRT is best possible in this scenario.

15

Page 16: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

And One Last Bit of Probability Theory

Page 17: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

17

Page 18: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

18

Page 19: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

19

Page 20: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

20

Page 21: 13. hypothesis testing - courses.cs.washington.edu€¦ · 13. hypothesis testing CSE 312, Winter 2011, W.L.Ruzzo 1. competing hypotheses 2. competing hypotheses 3. competing hypotheses

21