Updating Probabilities (Bayes Rule)

A car driving from KC to STL was pulled over for speeding. Which is more likely?

  • The car was a Corvette

  • The care was a Camry

Corvette’s are usually faster but There are a lot more Camry’s on the road

Scenario:

  • class consists of sophs (60%) and juniors (40%)

  • 50% of sophs have declared their major

  • 80% of the juniors have declared their major

Pick one student at random, what is the probability they are a soph?

  • soph (60%) - unconditional / marginal probability

Probability they have declared their major given they are a soph

  • 0.5 - (Declared | Soph)

P(A|B) = (P(B|A) * P(A)) / P(B)

Simple case: Two possibilities at each stage

● D = Has condition (or disease, etc.)

● DC = Does NOT have the condition

● T = Tests positive (test says has the condition)

● TC = Tests negative (tests says does not have the condition)

Simple case: Two possibilities at each stage

Prior probabilities

● P(D) = prevalence

● P(DC) = 1 – P(D)

Conditional:

● P(T|D) = true positive = sensitivity

● P(TC|D) = 1 - P(T|D) = false negative

● P(T|DC) = false positive

● P(TC|DC) = 1 - P(T|DC) = true negative = specificity

Intersections

● P(T and D) = P(T|D)P(D)

● P(T and DC) = P(T|DC)P(DC)

● P(T) = P(T and D) + P(T and DC)

An algorithm analyzes the content of email messages and classifies them as spam or not spam. Suppose that 20% of emails are spam. The algorithm is 95% accurate meaning it will correctly identify an email 95% of the time. If a message is classified as spam, what is the probability it actually was spam?

D = message is spam

T = algorithm says message is spam

Intersections

● P(T and D) = P(T|D)P(D) = .20x.95 = .19

● P(T and DC) = P(T|DC)P(DC) = .80x.05 = .04

● P(T) = P(T and D) + P(T and DC) = .19 + .04 = .23

Bayes Rule

● P(D|T) = P(T and D) / P(T) = .19 / .23 = .826

● Of messages that are classified as spam, 82.6% actually are spam.