advertisement

6.3: Bayes Theorem We can use Bayes Theorem when we know some conditional probabilities, but wish to know others. For example: We know P(test positive|have disease), and we wish to know P(have disease|test positive) Ex. 1 (book ex 2- p. 419) Suppose that one person in 100,000 has a particular rare disease for which there is a fairly accurate diagnostic test. This test is correct 99% of the times for someone who has the disease and 99.5%% of the time for someone who does not. Let F=event one has the disease E=event one tests positive We know that P(F) = 1/100,000 = .00001 P(E|F)= P(positive|disease) = .99 and P( πΈΜ | πΉΜ ) = P(negative| don’t have disease) = .995 Determine P(F|E) = P(has disease|test positive) = ___ and P (πΉΜ | πΈΜ )= P(does not have disease |test negative)= ___ P(E|F) F Μ Μ Μ P(E|πΉ) (0.99)(0.00001) P(F|E) = (0.99)(0.00001)+(0.005)(0.99999) = 0.002 P(πΉΜ |πΈΜ ) = (0.995)(0.99999) (0.995)(0.99999)+(0.01)(0.00001) = 0.9999999 Bayes Theorem: Suppose the E and F are events from a sample space S such that p(E)≠0 and p(F) ≠0. Then P(F|E) = π(πΈ |πΉ )π(πΉ) Μ )π(πΉΜ ) π(πΈ |πΉ )π(πΉ)+(πΈ |πΉ Ex. 2: F=studied for final, E=passed class Assume: P(F) = P(studied)=.8 P(E|F)= P(passed|studied)=.9 and P(E| πΉΜ ) = P(passed|didn’t study)=.2 Find P(F|E) = P(studied|passed)= ___ P (πΉΜ | πΈΜ )= P(didn’t study | failed) = ___ P(E|F) F Μ Μ Μ P(E|πΉ) Ex. 3: Spam filters Idea: spam has words like “offer”, “special”, “opportunity”, “Rolex”, … Non-spam has words like “mom”, “lunch”,… False negatives: when we fail to detect spam False positives: when non-spam is seen as spam Let S=spam E=has a certain word Assume P(S)=0.5 P(S|E) = π(πΈ |π )π(π) π(πΈ |π)π(π)+(πΈ |πΜ )π(πΜ ) P(E|S) S Μ Μ Μ P(E|π) Consider that “Rolex” occurs in 250/2000= .125 spam messages and in 5/1000=.005 non-spam messages. Assume P(S)=0.5 (.5)(.125) Ex: P(S|uses word “Rolex”) = (.5)(.125)+(.5)(.005) = .962