elec 303 – random signals lecture 17 – hypothesis testing 2 dr. farinaz koushanfar ece dept.,...

36
ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Upload: violet-oneal

Post on 18-Jan-2018

220 views

Category:

Documents


0 download

DESCRIPTION

Four versions of MAP rule  discrete, X discrete  discrete, X continuous  continuous, X discrete  continuous, X continuous

TRANSCRIPT

Page 1: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

ELEC 303 – Random Signals

Lecture 17 – Hypothesis testing 2Dr. Farinaz Koushanfar

ECE Dept., Rice UniversityNov 2, 2009

Page 2: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

outline

• Reading: 8.2,9.3• Bayesian Hypothesis testing• Likelihood Hypothesis testing

Page 3: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Four versions of MAP rule

• discrete, X discrete

• discrete, X continuous

• continuous, X discrete

• continuous, X continuous

)|x(p)(p |X

)|x(f)(p |X

)|x(p)(f |X

)|x(f)(f |X

Page 4: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example – spam filter

• Email may be spam or legitimate• Parameter , taking values 1,2, corresponding to

spam/legitimate, prob p(1), P(2) given• Let 1,…, n be a collection of special words,

whose appearance suggests a spam• For each i, let Xi be the Bernoulli RV that denotes

the appearance of i in the message• Assume that the conditional prob are known• Use the MAP rule to decide if spam or not.

Page 5: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Bayesian Hypothesis testing• Binary hypothesis: two cases• Once the value x of X is observed, Use the Bayes

rule to calculate the posterior P|X(|x)• Select the hypothesis with the larger posterior• If gMAP(x) is the selected hypothesis, the correct

decision’s probability is P(= gMAP(x)|X=x)• If Si is set of all x in the MAP, the overall probability

of correct decision is P(= gMAP(x))=i P(=i,XSi)

• The probability of error is: i P(i,XSi)

Page 6: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Multiple hypothesis

Page 7: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example – biased coin, single toss

• Two biased coins, with head prob. p1 and p2

• Randomly select a coin and infer its identity based on a single toss

• =1 (Hypothesis 1), =2 (Hypothesis 2) • X=0 (tail), X=1(head)• MAP compares P(1)PX|(x|1) ? P(2)PX|(x|2)• Compare PX|(x|1) and PX|(x|2) (WHY?)• E.g., p1=.46 and p2 =.52, and the outcome tail

Page 8: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example – biased coin, multiple tosses

• Assume that we toss the selected coin n times• Let X be the number of heads obtained• ?

Page 9: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example – signal detection and matched filter

• A transmitter sending two messages =1,=2• Massages expanded: – If =1, S=(a1,a2,…,an), if =2, S=(b1,b2,…,bn)

• The receiver observes the signal with corrupted noise: Xi=Si+Wi, i=1,…,n

• Assume WiN(0,1)

Page 10: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Likelihood Approach to Binary Hypothesis Testing

Page 11: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

BHT and Associated Error

Page 12: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Likelihood Approach to BHT (Cont’d)

Page 13: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Likelihood Approach to BHT (Cont’d)

Page 14: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Binary hypothesis testing

• H0: null hypothesis, H1: alternative hypothesis

• Observation vector X=(X1,…,Xn)• The distribution of the elements of X depend

on the hypothesis• P(XA;Hj) denotes the probability that X

belongs to a set A, when Hj is true

Page 15: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Rejection/acceptance

• A decision rule:– A partition of the set of all possible values of the

observation vector in two subsets: “rejection region” and “acceptance region”

• 2 possible errors for a rejection region:– Type I error (false rejection): Reject H0, even

though H0 is true

– Type II error (false acceptance): Accept H0, even though H0 is false

Page 16: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Probability of regions

• False rejection:– Happens with probability

(R) = P(XR; H0)• False acceptance:– Happens with probability

(R) = P(XR; H1)

Page 17: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Analogy with Bayesian

• Assume that we have two hypothesis =0 and =1, with priors p(0) and p(1)

• The overall probability of error is minimized using the MAP rule:– Given observations x of X, =1 is true if– p(0) pX|(x|0) < p(1) pX|(x|1) – Define: = p(0) / p(1)– L(x) = pX|(x|1) / pX|(x|0)

• =1 is true if the observed values of x satisfy the inequality: L(x)>

Page 18: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

More on testing

• Motivated by the MAP rule, the rejection region has the form R={x|L(x)>}

• The likelihood ratio test– Discrete:

L(x)= pX(x;H1) / pX(x;H0)– Continuous:

L(x) = fX(x;H1) / fX(x;H0)

Page 19: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example

• Six sided die• Two hypothesis

• Find the likelihood ratio test (LRT) and probability of error

Page 20: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Error probabilities for LRT

• Choosing trade-offs between the two error types, as increases, the rejection region becomes smaller– The false rejection probability (R) decreases – The false acceptance probability (R) increases

Page 21: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

LRT

• Start with a target value for the false rejection probability

• Choose a value such that the false rejection probability is equal to :P(L(X) > ; H0) =

• Once the value x of X is observed, reject H0 if L(x) >

• The choices for are 0.1, 0.05, and 0.01

Page 22: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Requirements for LRT

• Ability to compute L(x) for observations X• Compare the L(x) with the critical value • Either use the closed form for L(x) (or log L(x))

or use simulations to approximate

Page 23: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example

• A camera checking a certain area• Recording the detection signal• X=W, and X=1+W depending on the presence

of the intruders (hypothesis H0 and H1)• Assume W~N(0,)• Find the LRT and acceptance/rejection region

Page 24: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example

Page 25: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example

Page 26: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example

Page 27: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example (Cont’d)

Page 28: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example (Cont’d)

Page 29: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Error Probabilities

Page 30: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example: Binary Channel

Page 31: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example: Binary Channel

Page 32: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example: Binary Channel

Page 33: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example: More on BHT

Page 34: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example: More on BHT

Page 35: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example: More on BHT

Page 36: ELEC 303 – Random Signals Lecture 17 – Hypothesis testing 2 Dr. Farinaz Koushanfar ECE Dept., Rice University Nov 2, 2009

Example: More on BHT