σμ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
  • 日本語
  • 中文
Bayesian Inference skill›Module 1 · Beliefs and evidence›Topic 1.1·~50 minIntermediate

Priors likelihoods and posteriors

Skill positionModule 1 of 3 · Topic 1 of 4
1.1 Priors likelihoods and posteriors
—Lab score— / 100Total XP—Streak—

Changing your mind in a fair way

Bayes' rule is a recipe for changing your mind when you see evidence. You start with a prior: what you believed before seeing the data. Then you ask how likely the data would be under each possible truth. That is the likelihood. Multiply the two, rescale so that everything adds up to 111, and you get the posterior: your belief after the evidence. The number used to rescale is the evidence, the total probability of the data over all possible truths.

P(θ∣D)=P(D∣θ) P(θ)P(D),P(D)=∑θP(D∣θ) P(θ)P(\theta\mid D)=\frac{P(D\mid\theta)\,P(\theta)}{P(D)},\qquad P(D)=\sum_\theta P(D\mid\theta)\,P(\theta)P(θ∣D)=P(D)P(D∣θ)P(θ)​,P(D)=θ∑​P(D∣θ)P(θ)(1)

Take a strategy that is either good, winning 60%60\%60% of days, or bad, winning 50%50\%50% of days. Before any data you give a 30%30\%30% chance that it is good. It then wins 777 days out of 101010. That result is more likely under good (0.2150.2150.215) than under bad (0.1170.1170.117), but not by much, and good was unlikely to begin with. The posterior chance of good is only 44%44\%44%. With 707070 wins in 100100100 days, the same win rate gives 99.5%99.5\%99.5%. More data lets the likelihood outweigh the prior.

The arithmeticGood: prior 0.30.30.3 times likelihood 0.2150.2150.215 gives 0.06450.06450.0645. Bad: 0.7×0.117=0.08200.7\times0.117=0.08200.7×0.117=0.0820. The evidence is the sum, 0.14650.14650.1465. The posterior of good is 0.0645/0.1465=0.440.0645/0.1465=0.440.0645/0.1465=0.44. In odds form: prior odds 0.3/0.7=0.430.3/0.7=0.430.3/0.7=0.43 times the likelihood ratio 0.215/0.117=1.830.215/0.117=1.830.215/0.117=1.83 gives posterior odds 0.790.790.79, which is the same 44%44\%44%.
  • Prior, likelihood, posterior: what you believed, how well each truth explains the data, what you believe now.
  • Evidence P(D)P(D)P(D) is only the rescaling number that makes the posterior add up to 111.
  • Data beat the prior: the more data, the less the prior matters.

Lab · what's graded

  • A likelihood15 pts
  • The evidence15 pts
  • The posterior15 pts
  • Posterior odds15 pts
  • More data10 pts
  • Match the vocabulary15 pts
  • Why ten days is not proof15 pts
0/ 7 answered
Tasks
1Numeric answer15 ptsNot answered

If the strategy is good, each day is a win with chance 0.60.60.6. What is the chance of exactly 777 wins in 101010 days, (107) 0.67 0.43\binom{10}{7}\,0.6^{7}\,0.4^{3}(710​)0.670.43? Give four decimals.

l=l =l=accepted: ± 0.0005
2Numeric answer15 ptsNot answered

The prior chance of good is 0.30.30.3. The likelihood of the data is 0.2150.2150.215 under good and 0.1170.1170.117 under bad. What is the evidence P(D)=0.3×0.215+0.7×0.117P(D)=0.3\times0.215+0.7\times0.117P(D)=0.3×0.215+0.7×0.117? Give four decimals.

e=e =e=accepted: ± 0.0005
3Numeric answer15 ptsNot answered

What is the posterior chance that the strategy is good, 0.3×0.215 / 0.14650.3\times0.215\,/\,0.14650.3×0.215/0.1465? Give three decimals.

p=p =p=accepted: ± 0.003
4Numeric answer15 ptsNot answered

Prior odds of good against bad are 0.3/0.7=0.42860.3/0.7=0.42860.3/0.7=0.4286 and the likelihood ratio is 0.215/0.117=1.83760.215/0.117=1.83760.215/0.117=1.8376. What are the posterior odds (prior odds times likelihood ratio)? Give three decimals.

o=o =o=accepted: ± 0.004
5Choice10 ptsNot answered

What happens to the influence of the prior as more and more data arrive?

6Match15 ptsNot answered

Match each term with its meaning.

Pick the partner of each item on the left.

Prior
Likelihood
Posterior
Evidence
7Explain in words15 ptsNot answered

In one or two sentences, explain why a strategy that won 777 days out of 101010 still has only a 44%44\%44% chance of being good in this example.

Math modeKeyboard or LaTeX inputTask 1 of 7 · 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