σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Probability skill›Module 1 · Events and conditioning›Topic 1.2·~45 minBeginner

Conditional probability and Bayes' rule

Skill positionModule 1 of 5 · Topic 2 of 2
1.2 Conditional probability and Bayes' rule
—Lab score— / 100Total XP—Streak—

Updating on information

The conditional probability of AAA given BBB is P(A∣B)=P(A∩B)P(B)P(A\mid B)=\dfrac{P(A\cap B)}{P(B)}P(A∣B)=P(B)P(A∩B)​: restrict attention to the cases where BBB happened and ask how often AAA also happened. Rearranged it is the multiplication rule, P(A∩B)=P(A∣B) P(B)P(A\cap B)=P(A\mid B)\,P(B)P(A∩B)=P(A∣B)P(B). Events are independent exactly when P(A∣B)=P(A)P(A\mid B)=P(A)P(A∣B)=P(A).

P(B)=∑iP(B∣Ai)P(Ai),P(A∣B)=P(B∣A) P(A)P(B)P(B)=\sum_i P(B\mid A_i)P(A_i),\qquad P(A\mid B)=\frac{P(B\mid A)\,P(A)}{P(B)}P(B)=i∑​P(B∣Ai​)P(Ai​),P(A∣B)=P(B)P(B∣A)P(A)​(1)

The law of total probability splits BBB over a set of exclusive, exhaustive cases AiA_iAi​. Bayes' rule then reverses a conditional: from how likely the evidence is in each case, P(B∣A)P(B\mid A)P(B∣A), it gives how likely each case is given the evidence, P(A∣B)P(A\mid B)P(A∣B). The starting probability P(A)P(A)P(A) is the prior, and the result is the posterior. The most common mistake is to ignore the prior (the base rate).

A default screen that is mostly wrongA model flags firms likely to default. Two percent of firms default; the model flags 90% of defaulters and also flags 10% of healthy firms. Then P(flag)=0.9⋅0.02+0.1⋅0.98=0.116P(\text{flag})=0.9\cdot0.02+0.1\cdot0.98=0.116P(flag)=0.9⋅0.02+0.1⋅0.98=0.116 and P(default∣flag)=0.9⋅0.020.116≈0.155P(\text{default}\mid\text{flag})=\dfrac{0.9\cdot0.02}{0.116}\approx0.155P(default∣flag)=0.1160.9⋅0.02​≈0.155. A flagged firm defaults only about 15.5% of the time: the model is “” on defaulters, yet 84.5% of its flags are false alarms.
  • Conditional: P(A∣B)=P(A∩B)/P(B)P(A\mid B)=P(A\cap B)/P(B)P(A∣B)=P(A∩B)/P(B), the probability inside the world where BBB happened.
  • Total probability: add up P(B∣Ai)P(Ai)P(B\mid A_i)P(A_i)P(B∣Ai​)P(Ai​) over every case.
  • Bayes: posterior = likelihood × prior ÷ evidence. Do not confuse P(B∣A)P(B\mid A)P(B∣A) with P(A∣B)P(A\mid B)P(A∣B).
Rare events and the base rateAny screen for a rare event, whether fraud, default or a trading signal that works, produces mostly false positives unless it is extremely accurate, because the many non-events overwhelm the few real ones. Always ask “”, not only “”.

Lab · what's graded

  • A conditional probability15 pts
  • The chance of a flag15 pts
  • The posterior20 pts
  • The transposed conditional15 pts
  • The steps of a Bayes update15 pts
  • A 90% test that is mostly wrong20 pts
0/ 6 answered
Tasks
1Numeric answer15 ptsNot answered

P(A∩B)=0.12P(A\cap B)=0.12P(A∩B)=0.12 and P(B)=0.30P(B)=0.30P(B)=0.30. Find P(A∣B)P(A\mid B)P(A∣B).

P(A∣B)=P(A\mid B) =P(A∣B)=accepted: ± 0.001
2Numeric answer15 ptsNot answered

A default screen: 2% of firms default, the model flags 90% of defaulters and 10% of healthy firms. What is the overall probability that a randomly chosen firm is flagged? Give it to three decimals.

P(flag)=P(\text{flag}) =P(flag)=accepted: ± 0.0006
3Numeric answer20 ptsNot answered

A default screen: 2% of firms default, the model flags 90% of defaulters and 10% of healthy firms. A firm is flagged. What is the probability that it really defaults? Give it to three decimals.

P(default∣flag)=P(\text{default}\mid\text{flag}) =P(default∣flag)=accepted: ± 0.001
4Choice15 ptsNot answered

A default screen: 2% of firms default, the model flags 90% of defaulters and 10% of healthy firms. A manager says: “” What is wrong?

5Order the steps15 ptsNot answered

Put the steps of computing P(default | flag) in order.

Drag to reorder, or focus an item, press Space to lift it, the arrow keys to move it and Space to drop it.

  1. 1Add the two ways to be flagged to get P(flag)
  2. 2Divide the flagged-defaulter probability by P(flag)
  3. 3Write the prior P(default) and the likelihoods P(flag | default) and P(flag | healthy)
  4. 4Multiply each likelihood by the prior of its case
6Explain in words20 ptsNot answered

In two sentences, explain why most flags are false alarms even though the model catches 90% of defaulters.

Math modeKeyboard or LaTeX inputTask 1 of 6 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub