probability.txt (2503B)
1 ======================================================================== 2 Probability 3 ======================================================================== 4 5 Bayes Theoreom 6 7 P(A∣B)= P(B∣A)⋅P(A) / P(B) 8 9 Where: 10 11 P(A|B) = Posterior probability (probability of A given B has occurred) 12 P(B|A) = Likelihood (probability of B given A is true) 13 P(A) = Prior probability (initial belief about A before seeing evidence) 14 P(B) = Evidence (total probability of observing B) 15 16 Bayes' theorem lets you reverse conditional probabilities. If you know the probability of observing some evidence given a hypothesis, you can calculate the probability that the hypothesis is true given that you've observed the evidence. 17 18 Practical Example: 19 20 Imagine you're testing for a rare disease: 21 22 The disease affects 1% of the population: P(Disease) = 0.01 23 The test correctly identifies the disease 99% of the time: P(Positive|Disease) = 0.99 24 The test has a 5% false positive rate: P(Positive|No Disease) = 0.05 25 26 If you test positive, what's the actual probability you have the disease? 27 28 Using Bayes: 29 30 𝑃(Disease|Positive) = 0.99 × 0.01 / (0.99 × 0.01) + (0.05 × 0.99) 31 = 0.0099 / 0.0594 ≈ 16.7% 32 33 Even with a positive test, there's only about a 17% chance you actually have the disease—because the disease is so rare that false positives are common relative to true positives. 34 35 This is why Bayes' theorem is so powerful: it captures how evidence should change our confidence in a hypothesis, accounting for base rates and test accuracy. 36 37 38 Question: 39 40 A machine has 4 independent components, each of which fails during a shift with probability 0.05. What is the probability that at least one fails? 41 A: 5% B: 18.5% C: 19.0% D: 20% E: 81.5% 42 43 44 Probability of at least 1 failing: 45 46 0. so the component has a success probability of 1 - 0.05 = 0.95 47 1. calculate the probability of all components functioning successfully: 48 0.95 x 0.95 x 0.95 x 0.95 = 0.815 49 2. so 1 - 0.815 is 0.185 is the chance of at least 1 component fails 50 51 Probability of at least 2 failing: 52 53 "At least 2 fails" is that same bundle with one case removed — exactly 1. So: 54 0.05 x 0.95 x 0.95 x 0.95 = 0.0429 55 But there are four different components that could be the one that failed, and those are four separate outcomes, so add them up: 56 4 × 0.0429 = 0.1715 57 Then subtract: 58 0.185 − 0.1715 = 0.0140, about 1.4% 59 60 Same logic extends upward: to get "at least 3", you'd take 0.0140 and subtract P(exactly 2). Each step peels off one more case from the bundle.